Skip to content

Commit 65451cb

Browse files
Merge branch 'sycl' into empty_task_removal
2 parents 65e97c9 + f74664a commit 65451cb

File tree

309 files changed

+11226
-3409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

309 files changed

+11226
-3409
lines changed

.github/workflows/gh_pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
if: github.repository == 'intel/llvm'
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020
with:
2121
path: repo
2222
- name: Install deps

.github/workflows/sycl_containers.yaml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Checkout
31-
uses: actions/checkout@v2
31+
uses: actions/checkout@v3
3232
with:
3333
fetch-depth: 2
3434
- name: Build and Push Container
@@ -47,7 +47,7 @@ jobs:
4747
runs-on: ubuntu-latest
4848
steps:
4949
- name: Checkout
50-
uses: actions/checkout@v2
50+
uses: actions/checkout@v3
5151
with:
5252
fetch-depth: 2
5353
- name: Build and Push Container
@@ -70,18 +70,17 @@ jobs:
7070
needs: base_image_ubuntu2004
7171
steps:
7272
- name: Checkout
73-
uses: actions/checkout@v2
73+
uses: actions/checkout@v3
7474
with:
7575
fetch-depth: 2
7676
- name: Get dependencies configuration
7777
id: deps
7878
run: |
7979
DEPS=`cat devops/dependencies.json`
80-
DEPS="${DEPS//'%'/'%25'}"
81-
DEPS="${DEPS//$'\n'/'%0A'}"
82-
DEPS="${DEPS//$'\r'/'%0D'}"
80+
DEPS="${DEPS//$'\r'/''}"
81+
DEPS="${DEPS//$'\n'/' '}"
8382
echo $DEPS
84-
echo "::set-output name=deps::$DEPS"
83+
echo "deps=$DEPS" >>$GITHUB_OUTPUT
8584
- name: Build and Push Container
8685
uses: ./devops/actions/build_container
8786
with:
@@ -108,18 +107,17 @@ jobs:
108107
needs: base_image_ubuntu2004
109108
steps:
110109
- name: Checkout
111-
uses: actions/checkout@v2
110+
uses: actions/checkout@v3
112111
with:
113112
fetch-depth: 2
114113
- name: Get dependencies configuration
115114
id: deps
116115
run: |
117116
DEPS=`cat devops/dependencies.json`
118-
DEPS="${DEPS//'%'/'%25'}"
119-
DEPS="${DEPS//$'\n'/'%0A'}"
120-
DEPS="${DEPS//$'\r'/'%0D'}"
117+
DEPS="${DEPS//$'\r'/''}"
118+
DEPS="${DEPS//$'\n'/' '}"
121119
echo $DEPS
122-
echo "::set-output name=deps::$DEPS"
120+
echo "deps=$DEPS" >>$GITHUB_OUTPUT
123121
- name: Build and Push Container
124122
uses: ./devops/actions/build_container
125123
with:

.github/workflows/sycl_linux_build_and_test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ jobs:
161161
- name: Pack LIT
162162
run: tar -cJf lit.tar.xz -C $GITHUB_WORKSPACE/src/llvm/utils/lit .
163163
- name: Upload toolchain
164-
uses: actions/upload-artifact@v2
164+
uses: actions/upload-artifact@v3
165165
with:
166166
name: sycl_linux_${{ inputs.build_artifact_suffix }}
167167
path: llvm_sycl.tar.xz
168168
- name: Upload LIT
169-
uses: actions/upload-artifact@v2
169+
uses: actions/upload-artifact@v3
170170
with:
171171
name: sycl_lit_${{ inputs.build_artifact_suffix }}
172172
path: lit.tar.xz
@@ -226,7 +226,7 @@ jobs:
226226
sudo -E /opt/install_drivers.sh --all
227227
fi
228228
# FIXME cached_checkout fails here, but works everywhere else
229-
- uses: actions/checkout@v2
229+
- uses: actions/checkout@v3
230230
with:
231231
persist-credentials: false
232232
path: llvm
@@ -277,7 +277,7 @@ jobs:
277277
fi
278278
# FIXME cached_checkout fails here, but works everywhere else
279279
# TODO: figure out if we remove this action
280-
- uses: actions/checkout@v2
280+
- uses: actions/checkout@v3
281281
with:
282282
path: llvm
283283
# TODO should this action be packed into container as well?

.github/workflows/sycl_macos_build_and_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: Pack toolchain
6767
run: tar -cJf llvm_sycl.tar.xz -C $GITHUB_WORKSPACE/build/install .
6868
- name: Upload toolchain
69-
uses: actions/upload-artifact@v2
69+
uses: actions/upload-artifact@v3
7070
with:
7171
name: sycl_macos_${{ inputs.build_artifact_suffix }}
7272
path: llvm_sycl.tar.xz

.github/workflows/sycl_nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
runs-on: ubuntu-latest
4848
needs: ubuntu2004_build_test
4949
steps:
50-
- uses: actions/checkout@v2
51-
- uses: actions/download-artifact@v2
50+
- uses: actions/checkout@v3
51+
- uses: actions/download-artifact@v3
5252
with:
5353
name: sycl_linux_default
5454
path: devops/

.github/workflows/sycl_post_commit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ jobs:
4444
runs-on: ubuntu-20.04
4545
if: github.repository == 'intel/llvm'
4646
steps:
47-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v3
4848
with:
4949
path: src
5050
- name: Install Ubuntu deps
5151
run: sudo apt install -y ninja-build ccache
5252
- name: Setup Cache
53-
uses: actions/cache@v2
53+
uses: actions/cache@v3
5454
id: cache
5555
with:
5656
path: ${{ github.workspace }}/cache
@@ -104,7 +104,7 @@ jobs:
104104
- name: Pack
105105
run: tar -czvf llvm_sycl.tar.gz -C $GITHUB_WORKSPACE/build/install .
106106
- name: Upload artifacts
107-
uses: actions/upload-artifact@v1
107+
uses: actions/upload-artifact@v3
108108
with:
109109
name: sycl_linux_${{ matrix.config }}
110110
path: llvm_sycl.tar.gz

.github/workflows/sycl_precommit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
steps:
3030
- name: 'PR commits + 1'
3131
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v3
3333
with:
3434
ref: ${{ github.event.pull_request.head.sha }}
3535
persist-credentials: false

.github/workflows/sycl_update_gpu_driver.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
if: github.repository == 'intel/llvm'
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414
- name: Update dependencies file
1515
run: |
1616
version="$(python3 devops/scripts/update_drivers.py linux)"

.github/workflows/sycl_windows_build_and_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
git config --global core.autocrlf false
2424
echo "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
2525
echo "SCCACHE_DIR=D:\github\_work\cache\${{ inputs.build_cache_suffix }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v3
2727
with:
2828
path: src
2929
fetch-depth: 1
@@ -78,7 +78,7 @@ jobs:
7878
shell: bash
7979
run: cmake --build build --target deploy-sycl-toolchain
8080
- name: Upload toolchain
81-
uses: actions/upload-artifact@v2
81+
uses: actions/upload-artifact@v3
8282
with:
8383
name: sycl_windows_default
8484
path: install/**/*

.github/workflows/sync-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
if: github.repository == 'intel/llvm'
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1212
with:
1313
# persist-credentials: false allows us to use our own credentials for
1414
# pushing to the repository. Otherwise, the default github actions token

clang/include/clang/Basic/Attr.td

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,11 +1302,13 @@ def SYCLType: InheritableAttr {
13021302
["accessor", "local_accessor", "spec_constant",
13031303
"specialization_id", "kernel_handler", "buffer_location",
13041304
"no_alias", "accessor_property_list", "group",
1305-
"private_memory", "aspect"],
1305+
"private_memory", "aspect", "annotated_ptr", "annotated_arg",
1306+
"stream", "sampler"],
13061307
["accessor", "local_accessor", "spec_constant",
13071308
"specialization_id", "kernel_handler", "buffer_location",
13081309
"no_alias", "accessor_property_list", "group",
1309-
"private_memory", "aspect"]>];
1310+
"private_memory", "aspect", "annotated_ptr", "annotated_arg",
1311+
"stream", "sampler"]>];
13101312
// Only used internally by SYCL implementation
13111313
let Documentation = [InternalOnly];
13121314
}
@@ -1603,6 +1605,20 @@ def SYCLAddIRAttrCommonMembers : SYCLAddIRAttrMemberCodeHolder<[{
16031605
if (ValueQType->isIntegralOrEnumerationType() ||
16041606
ValueQType->isFloatingType())
16051607
return Value.getAsString(Context, ValueQType);
1608+
if (ValueQType->isArrayType() &&
1609+
(ValueQType->getArrayElementTypeNoTypeQual()->isCharType() ||
1610+
ValueQType->getArrayElementTypeNoTypeQual()
1611+
->isIntegralOrEnumerationType())) {
1612+
SmallString<10> StrBuffer;
1613+
for (unsigned I = 0; I < Value.getArraySize(); ++I) {
1614+
const APValue &ArrayElem = Value.getArrayInitializedElt(I);
1615+
char C = static_cast<char>(ArrayElem.getInt().getExtValue());
1616+
if (C == 0)
1617+
break;
1618+
StrBuffer += C;
1619+
}
1620+
return std::string(StrBuffer);
1621+
}
16061622
return None;
16071623
}
16081624

@@ -1628,6 +1644,33 @@ def SYCLAddIRAttrCommonMembers : SYCLAddIRAttrMemberCodeHolder<[{
16281644
ValueE->getType()->isSignedIntegerType());
16291645
return std::string(IntegerStrBuffer);
16301646
}
1647+
if (const auto *InitListE = dyn_cast<InitListExpr>(ValueE)) {
1648+
if (InitListE->isStringLiteralInit()) {
1649+
const Expr *StringInitE = InitListE->getInit(0)->IgnoreParenImpCasts();
1650+
return getValidAttributeValueAsString(StringInitE, Context);
1651+
}
1652+
1653+
SmallString<10> StrBuffer;
1654+
for (const auto *InitE : InitListE->inits()) {
1655+
const Expr *InitNoImpCastE = InitE->IgnoreParenImpCasts();
1656+
char C = 0;
1657+
if (const auto *CharacterVal =
1658+
dyn_cast<CharacterLiteral>(InitNoImpCastE))
1659+
C = static_cast<char>(CharacterVal->getValue());
1660+
else if (const auto *IntegerVal =
1661+
dyn_cast<IntegerLiteral>(InitNoImpCastE))
1662+
C = static_cast<char>(IntegerVal->getValue().getSExtValue());
1663+
else
1664+
return None;
1665+
1666+
// Null terminator will end the string reading.
1667+
if (C == 0)
1668+
break;
1669+
1670+
StrBuffer += C;
1671+
}
1672+
return std::string(StrBuffer);
1673+
}
16311674

16321675
const auto *ValueCE = dyn_cast<ConstantExpr>(ValueE);
16331676
if (!ValueCE)
@@ -3427,6 +3470,7 @@ def WorkGroupSizeHint : InheritableAttr {
34273470
}
34283471
}];
34293472
let Documentation = [WorkGroupSizeHintAttrDocs];
3473+
let SupportsNonconformingLambdaSyntax = 1;
34303474
}
34313475

34323476
def InitPriority : InheritableAttr, TargetSpecificAttr<TargetSupportsInitPriority> {

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10390,8 +10390,8 @@ def warn_opencl_generic_address_space_arg : Warning<
1039010390
"passing non-generic address space pointer to %0"
1039110391
" may cause dynamic conversion affecting performance">,
1039210392
InGroup<Conversion>, DefaultIgnore;
10393-
def err_bad_union_kernel_param_members : Error<
10394-
"%0 cannot be used inside a union kernel parameter">;
10393+
def err_bad_kernel_param_data_members : Error<
10394+
"%0 cannot be a data member of a %select{union|struct}1 kernel parameter">;
1039510395

1039610396
// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
1039710397
def err_opencl_builtin_pipe_first_arg : Error<
@@ -11887,6 +11887,9 @@ def err_sycl_add_ir_attribute_invalid_value : Error<
1188711887
def err_sycl_add_ir_attribute_invalid_filter : Error<
1188811888
"initializer list in the first argument of %0 must contain only string "
1188911889
"literals">;
11890+
def warn_sycl_old_and_new_kernel_attributes : Warning<
11891+
"kernel has both attribute %0 and kernel properties; conflicting properties "
11892+
"are ignored">, InGroup<IgnoredAttributes>;
1189011893

1189111894
// errors of expect.with.probability
1189211895
def err_probability_not_constant_float : Error<

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ LANGOPT(IntelFPGA , 1, 0, "Perform ahead-of-time compilation for FPGA")
279279
LANGOPT(SYCLAllowFuncPtr , 1, 0, "Allow function pointers in SYCL device code")
280280
LANGOPT(SYCLStdLayoutKernelParams, 1, 0, "Enable standard layout requirement for SYCL kernel parameters")
281281
LANGOPT(SYCLUnnamedLambda , 1, 0, "Allow unnamed lambda SYCL kernels")
282+
LANGOPT(SYCLForceInlineKernelLambda , 1, 0, "Force inline SYCL kernel lambdas in entry point")
282283
LANGOPT(SYCLESIMDForceStatelessMem, 1, 0, "Make accessors use USM memory in ESIMD kernels")
283284
ENUM_LANGOPT(SYCLVersion , SYCLMajorVersion, 2, SYCL_None, "Version of the SYCL standard used")
284285
LANGOPT(DeclareSPIRVBuiltins, 1, 0, "Declare SPIR-V builtin functions")

clang/include/clang/Driver/Driver.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,11 @@ class Driver {
797797
/// targets.
798798
mutable llvm::StringMap<StringRef> SYCLUniqueIDList;
799799

800+
/// Vector of Macros that need to be added to the Host compilation in a
801+
/// SYCL based offloading scenario. These macros are gathered during
802+
/// construction of the device compilations.
803+
mutable std::vector<std::string> SYCLTargetMacroArgs;
804+
800805
/// Return the typical executable name for the specified driver \p Mode.
801806
static const char *getExecutableForDriverMode(DriverMode Mode);
802807

@@ -867,6 +872,17 @@ class Driver {
867872
void createAppendedFooterInput(Action *&Input, Compilation &C,
868873
const llvm::opt::ArgList &Args) const;
869874

875+
/// addSYCLTargetMacroArg - Add the given macro to the vector of args to be
876+
/// added to the host compilation step.
877+
void addSYCLTargetMacroArg(const llvm::opt::ArgList &Args,
878+
StringRef Macro) const {
879+
SYCLTargetMacroArgs.push_back(Args.MakeArgString(Macro));
880+
}
881+
/// getSYCLTargetMacroArgs - return the previously gathered macro target args.
882+
llvm::ArrayRef<std::string> getSYCLTargetMacroArgs() const {
883+
return SYCLTargetMacroArgs;
884+
}
885+
870886
/// setSYCLUniqueID - set the Unique ID that is used for all FE invocations
871887
/// when performing compilations for SYCL.
872888
void addSYCLUniqueID(StringRef UniqueID, StringRef FileName) const {

clang/include/clang/Driver/Options.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,6 +2942,12 @@ defm sycl_unnamed_lambda
29422942
" >= clang::LangOptions::SYCLMajorVersion::SYCL_2020")>,
29432943
PosFlag<SetTrue, [], "Allow">, NegFlag<SetFalse, [], "Disallow">,
29442944
BothFlags<[CC1Option, CoreOption], " unnamed SYCL lambda kernels">>;
2945+
defm sycl_force_inline_kernel_lambda
2946+
: BoolFOption<
2947+
"sycl-force-inline-kernel-lambda", LangOpts<"SYCLForceInlineKernelLambda">,
2948+
DefaultTrue,
2949+
PosFlag<SetTrue, [], "Allow">, NegFlag<SetFalse, [], "Disallow">,
2950+
BothFlags<[CC1Option, CoreOption], " force inline SYCL kernels lambda in entry point">>;
29452951
def fsycl_help_EQ : Joined<["-"], "fsycl-help=">,
29462952
Flags<[NoXarchOption, CoreOption]>, HelpText<"Emit help information from the "
29472953
"related offline compilation tool. Valid values: all, fpga, gen, x86_64.">,

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10984,6 +10984,7 @@ class Sema final {
1098410984
SYCLIntelMaxWorkGroupSizeAttr *
1098510985
MergeSYCLIntelMaxWorkGroupSizeAttr(Decl *D,
1098610986
const SYCLIntelMaxWorkGroupSizeAttr &A);
10987+
void CheckSYCLAddIRAttributesFunctionAttrConflicts(Decl *D);
1098710988
SYCLAddIRAttributesFunctionAttr *MergeSYCLAddIRAttributesFunctionAttr(
1098810989
Decl *D, const SYCLAddIRAttributesFunctionAttr &A);
1098910990
void AddSYCLAddIRAttributesFunctionAttr(Decl *D,

clang/lib/CodeGen/CodeGenTypes.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,30 @@ void CodeGenTypes::addRecordTypeName(const RecordDecl *RD,
8080
OS << "i" << TTy->getIntegerBitWidth();
8181
break;
8282
}
83-
} else if (TTy->isBFloatTy())
83+
} else if (TTy->isHalfTy()) {
84+
OS << "half";
85+
} else if (TTy->isFloatTy()) {
86+
OS << "float";
87+
} else if (TTy->isDoubleTy()) {
88+
OS << "double";
89+
} else if (TTy->isBFloatTy()) {
8490
OS << "bfloat16";
85-
else if (TTy->isStructTy()) {
91+
} else if (TTy->isStructTy()) {
8692
StringRef LlvmTyName = TTy->getStructName();
87-
// Emit half/bfloat16 for sycl[::*]::{half,bfloat16}
93+
// Emit half/bfloat16/tf32 for sycl[::*]::{half,bfloat16,tf32}
8894
if (LlvmTyName.startswith("class.sycl::") ||
8995
LlvmTyName.startswith("class.__sycl_internal::"))
9096
LlvmTyName = LlvmTyName.rsplit("::").second;
97+
if (LlvmTyName != "half" && LlvmTyName != "bfloat16" &&
98+
LlvmTyName != "tf32")
99+
llvm_unreachable("Wrong matrix base type!");
91100
OS << LlvmTyName;
92-
} else
93-
TTy->print(OS, false, true);
94-
} else if (TemplateArg.getKind() == TemplateArgument::Integral)
101+
} else {
102+
llvm_unreachable("Wrong matrix base type!");
103+
}
104+
} else if (TemplateArg.getKind() == TemplateArgument::Integral) {
95105
OS << TemplateArg.getAsIntegral();
106+
}
96107
}
97108
Ty->setName(OS.str());
98109
return;

0 commit comments

Comments
 (0)