Skip to content

Commit 332e5fe

Browse files
committed
Merge branch 'sycl' of https://github.com/intel/llvm into missing-acc-funcs
2 parents 03cf168 + 084f34c commit 332e5fe

File tree

193 files changed

+4415
-4478
lines changed

Some content is hidden

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

193 files changed

+4415
-4478
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ sycl/include/sycl/ext/intel/esimd.hpp @intel/dpcpp-esimd-reviewers
6060
sycl/doc/extensions/experimental/sycl_ext_intel_esimd/ @intel/dpcpp-esimd-reviewers
6161
llvm/lib/SYCLLowerIR/CMakeLists.txt @intel/dpcpp-tools-reviewers @intel/dpcpp-esimd-reviewers
6262

63+
# invoke_simd
64+
sycl/include/sycl/ext/oneapi/experimental/invoke_simd.hpp @rolandschulz @kbobrovs
65+
sycl/include/std/experimental/simd.hpp @rolandschulz @kbobrovs
66+
6367
# DevOps configs
6468
.github/workflows/ @intel/dpcpp-devops-reviewers
6569
buildbot/ @intel/dpcpp-devops-reviewers

.github/workflows/sycl_resolve_test_matrix.yml renamed to .github/workflows/sycl_gen_test_matrix.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,21 @@ on:
2424
type: string
2525
required: false
2626
default: ${{ github.run_id }}-${{ github.run_attempt }}
27+
ref:
28+
description: "Commit to use for checkout or github.sha by default"
29+
type: string
30+
required: false
31+
default: ${{ github.sha }}
2732
outputs:
2833
lts_matrix:
2934
description: "Generated Matrix"
30-
value: ${{ jobs.resolve_matrix.outputs.lts_matrix }}
35+
value: ${{ jobs.test_matrix.outputs.lts_matrix }}
3136
lts_aws_matrix:
3237
description: "Generated Matrix AWS subset"
33-
value: ${{ jobs.resolve_matrix.outputs.lts_aws_matrix }}
38+
value: ${{ jobs.test_matrix.outputs.lts_aws_matrix }}
3439
jobs:
35-
resolve_matrix:
36-
name: Resolve Test Matrix
40+
test_matrix:
41+
name: Generate Test Matrix
3742
runs-on: ubuntu-latest
3843
outputs:
3944
lts_matrix: ${{ steps.work.outputs.lts_matrix }}
@@ -42,11 +47,11 @@ jobs:
4247
- name: Download scripts and configs
4348
shell: bash
4449
run: |
45-
wget raw.githubusercontent.com/intel/llvm/${{ github.sha }}/devops/scripts/generate_test_matrix.js
46-
wget raw.githubusercontent.com/intel/llvm/${{ github.sha }}/devops/test_configs.json
50+
wget raw.githubusercontent.com/intel/llvm/${{ inputs.ref }}/devops/scripts/generate_test_matrix.js
51+
wget raw.githubusercontent.com/intel/llvm/${{ inputs.ref }}/devops/test_configs.json
4752
wget raw.githubusercontent.com/intel/llvm/sycl/devops/dependencies.json
4853
mv dependencies.json dependencies.sycl.json
49-
wget raw.githubusercontent.com/intel/llvm/${{ github.sha }}/devops/dependencies.json
54+
wget raw.githubusercontent.com/intel/llvm/${{ inputs.ref }}/devops/dependencies.json
5055
- id: work
5156
uses: actions/github-script@v6
5257
name: Generate matrix

.github/workflows/sycl_nightly.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ on:
1010
- '.github/workflows/sycl_nightly.yml'
1111

1212
jobs:
13-
resolve_matrix:
14-
name: Resolve Test Matrix
15-
uses: ./.github/workflows/sycl_resolve_test_matrix.yml
13+
test_matrix:
14+
name: Generate Test Matrix
15+
uses: ./.github/workflows/sycl_gen_test_matrix.yml
1616
with:
1717
lts_config: "ocl_gen9;ocl_x64"
1818

1919
ubuntu2004_build_test:
2020
if: github.repository == 'intel/llvm'
2121
uses: ./.github/workflows/sycl_linux_build_and_test.yml
22-
needs: resolve_matrix
22+
needs: test_matrix
2323
secrets: inherit
2424
with:
2525
build_cache_root: "/__w/"
@@ -29,7 +29,7 @@ jobs:
2929
ubuntu2004_opaque_pointers_build_test:
3030
if: github.repository == 'intel/llvm'
3131
uses: ./.github/workflows/sycl_linux_build_and_test.yml
32-
needs: resolve_matrix
32+
needs: test_matrix
3333
secrets: inherit
3434
with:
3535
build_cache_root: "/__w/"

.github/workflows/sycl_post_commit.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ on:
1212

1313
jobs:
1414
# This job generates matrix of tests for LLVM Test Suite
15-
resolve_matrix:
16-
name: Resolve Test Matrix
17-
uses: ./.github/workflows/sycl_resolve_test_matrix.yml
15+
test_matrix:
16+
name: Generate Test Matrix
17+
uses: ./.github/workflows/sycl_gen_test_matrix.yml
1818
with:
1919
lts_config: "l0_gen9"
2020
linux_default:
2121
name: Linux Default
22-
needs: resolve_matrix
22+
needs: test_matrix
2323
uses: ./.github/workflows/sycl_linux_build_and_test.yml
2424
secrets: inherit
2525
with:
2626
build_cache_root: "/__w/llvm"
2727
build_artifact_suffix: "post_commit"
28-
lts_matrix: ${{ needs.resolve_matrix.outputs.lts_matrix }}
29-
lts_aws_matrix: ${{ needs.resolve_matrix.outputs.lts_aws_matrix }}
28+
lts_matrix: ${{ needs.test_matrix.outputs.lts_matrix }}
29+
lts_aws_matrix: ${{ needs.test_matrix.outputs.lts_aws_matrix }}
3030
linux_no_assert:
3131
name: Linux (no assert)
3232
uses: ./.github/workflows/sycl_linux_build_and_test.yml

.github/workflows/sycl_precommit.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,18 @@ jobs:
3838
uses: ./devops/actions/clang-format
3939

4040
# This job generates matrix of tests for LLVM Test Suite
41-
resolve_matrix:
42-
name: Resolve Test Matrix
43-
uses: ./.github/workflows/sycl_resolve_test_matrix.yml
41+
test_matrix:
42+
name: Generate Test Matrix
43+
uses: ./.github/workflows/sycl_gen_test_matrix.yml
4444
with:
45+
ref: ${{ github.event.pull_request.head.sha }}
4546
lts_config: "hip_amdgpu;ocl_x64;ocl_gen9;l0_gen9;esimd_emu;cuda"
4647

4748
linux_default:
4849
name: Linux
4950
# Only build and test patches, that have passed all linter checks, because
5051
# the next commit is likely to be a follow-up on that job.
51-
needs: [lint, resolve_matrix]
52+
needs: [lint, test_matrix]
5253
if: always() && (success() || contains(github.event.pull_request.labels.*.name, 'ignore-lint'))
5354
uses: ./.github/workflows/sycl_linux_build_and_test.yml
5455
secrets: inherit
@@ -58,5 +59,5 @@ jobs:
5859
build_cache_size: "8G"
5960
build_artifact_suffix: "default"
6061
build_cache_suffix: "default"
61-
lts_matrix: ${{ needs.resolve_matrix.outputs.lts_matrix }}
62-
lts_aws_matrix: ${{ needs.resolve_matrix.outputs.lts_aws_matrix }}
62+
lts_matrix: ${{ needs.test_matrix.outputs.lts_matrix }}
63+
lts_aws_matrix: ${{ needs.test_matrix.outputs.lts_aws_matrix }}

buildbot/configure.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def do_configure(args):
4444
sycl_enable_xpti_tracing = 'ON'
4545
xpti_enable_werror = 'OFF'
4646

47+
# lld is needed on Windows or for the HIP plugin on AMD
48+
if platform.system() == 'Windows' or (args.hip and args.hip_platform == 'AMD'):
49+
llvm_enable_projects += ';lld'
50+
4751
# replace not append, so ARM ^ X86
4852
if args.arm:
4953
llvm_targets_to_build = 'ARM;AArch64'
@@ -65,8 +69,6 @@ def do_configure(args):
6569
llvm_targets_to_build += ';AMDGPU'
6670
libclc_targets_to_build += libclc_amd_target_names
6771

68-
# The HIP plugin for AMD uses lld for linking
69-
llvm_enable_projects += ';lld'
7072
elif args.hip_platform == 'NVIDIA' and not args.cuda:
7173
llvm_targets_to_build += ';NVPTX'
7274
libclc_targets_to_build += libclc_nvidia_target_names

buildbot/dependency.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ ocl_cpu_rt_ver=2022.14.8.0.04
44
# https://github.com/intel/llvm/releases/download/2022-WW33/win-oclcpuexp-2022.14.8.0.04_rel.zip
55
ocl_cpu_rt_ver_win=2022.14.8.0.04
66
# Same GPU driver supports Level Zero and OpenCL
7-
# https://github.com/intel/compute-runtime/releases/tag/22.31.23852
8-
ocl_gpu_rt_ver=22.31.23852
7+
# https://github.com/intel/compute-runtime/releases/tag/22.35.24055
8+
ocl_gpu_rt_ver=22.35.24055
99
# Same GPU driver supports Level Zero and OpenCL
1010
# https://downloadmirror.intel.com/723911/igfx_win_101.1404.zip
1111
ocl_gpu_rt_ver_win=101.1404
@@ -31,7 +31,7 @@ ocloc_ver_win=101.1404
3131
[DRIVER VERSIONS]
3232
cpu_driver_lin=2022.14.8.0.04
3333
cpu_driver_win=2022.14.8.0.04
34-
gpu_driver_lin=22.31.23852
34+
gpu_driver_lin=22.35.24055
3535
gpu_driver_win=101.1404
3636
fpga_driver_lin=2022.14.8.0.04
3737
fpga_driver_win=2022.14.8.0.04

clang/include/clang/Basic/Attr.td

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,23 @@ def SYCLSpecialClass: InheritableAttr {
12811281
let Documentation = [SYCLSpecialClassDocs];
12821282
}
12831283

1284+
def SYCLType: InheritableAttr {
1285+
let Spellings = [CXX11<"__sycl_detail__", "sycl_type">];
1286+
let Subjects = SubjectList<[CXXRecord, Enum], ErrorDiag>;
1287+
let LangOpts = [SYCLIsDevice, SYCLIsHost];
1288+
let Args = [EnumArgument<"Type", "SYCLType",
1289+
["accessor", "local_accessor", "spec_constant",
1290+
"specialization_id", "kernel_handler", "buffer_location",
1291+
"no_alias", "accessor_property_list", "group",
1292+
"private_memory", "aspect"],
1293+
["accessor", "local_accessor", "spec_constant",
1294+
"specialization_id", "kernel_handler", "buffer_location",
1295+
"no_alias", "accessor_property_list", "group",
1296+
"private_memory", "aspect"]>];
1297+
// Only used internally by SYCL implementation
1298+
let Documentation = [InternalOnly];
1299+
}
1300+
12841301
def SYCLDeviceHas : InheritableAttr {
12851302
let Spellings = [CXX11<"sycl", "device_has">];
12861303
let Subjects = SubjectList<[Function], ErrorDiag>;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4098,6 +4098,8 @@ def warn_transparent_union_attribute_zero_fields : Warning<
40984098
def warn_attribute_type_not_supported : Warning<
40994099
"%0 attribute argument not supported: %1">,
41004100
InGroup<IgnoredAttributes>;
4101+
def err_attribute_argument_not_supported : Error<
4102+
"%0 attribute argument %1 is not supported">;
41014103
def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
41024104
InGroup<IgnoredAttributes>;
41034105
def warn_attribute_protected_visibility :

clang/include/clang/Sema/Sema.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10858,6 +10858,9 @@ class Sema final {
1085810858
ReqdWorkGroupSizeAttr *
1085910859
MergeReqdWorkGroupSizeAttr(Decl *D, const ReqdWorkGroupSizeAttr &A);
1086010860

10861+
SYCLTypeAttr *MergeSYCLTypeAttr(Decl *D, const AttributeCommonInfo &CI,
10862+
SYCLTypeAttr::SYCLType TypeName);
10863+
1086110864
/// Only called on function definitions; if there is a MSVC #pragma optimize
1086210865
/// in scope, consider changing the function's attributes based on the
1086310866
/// optimization list passed to the pragma.
@@ -13546,12 +13549,16 @@ class Sema final {
1354613549
const CXXRecordDecl *RecTy = Ty->getAsCXXRecordDecl();
1354713550
if (!RecTy)
1354813551
return false;
13552+
13553+
if (RecTy->hasAttr<AttrTy>())
13554+
return true;
13555+
1354913556
if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RecTy)) {
1355013557
ClassTemplateDecl *Template = CTSD->getSpecializedTemplate();
1355113558
if (CXXRecordDecl *RD = Template->getTemplatedDecl())
1355213559
return RD->hasAttr<AttrTy>();
1355313560
}
13554-
return RecTy->hasAttr<AttrTy>();
13561+
return false;
1355513562
}
1355613563

1355713564
private:
@@ -13975,7 +13982,7 @@ class Sema final {
1397513982
KernelConstStaticVariable
1397613983
};
1397713984

13978-
bool isKnownGoodSYCLDecl(const Decl *D);
13985+
bool isDeclAllowedInSYCLDeviceCode(const Decl *D);
1397913986
void checkSYCLDeviceVarDecl(VarDecl *Var);
1398013987
void copySYCLKernelAttrs(const CXXRecordDecl *KernelObj);
1398113988
void ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc, MangleContext &MC);

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
16001600
StartFunction(GD, ResTy, Fn, FnInfo, Args, Loc, BodyRange.getBegin());
16011601
if (!getLangOpts().OptRecordFile.empty()) {
16021602
SyclOptReportHandler &SyclOptReport = CGM.getDiags().getSYCLOptReport();
1603-
if (Fn && SyclOptReport.HasOptReportInfo(FD)) {
1603+
if (SyclOptReport.HasOptReportInfo(FD)) {
16041604
llvm::OptimizationRemarkEmitter ORE(Fn);
16051605
for (auto ORI : llvm::enumerate(SyclOptReport.GetInfo(FD))) {
16061606
llvm::DiagnosticLocation DL =

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,12 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
131131
CmdArgs.push_back("-defaultlib:oldnames");
132132
}
133133

134-
if ((!C.getDriver().IsCLMode() && !Args.hasArg(options::OPT_nostdlib) &&
135-
Args.hasArg(options::OPT_fsycl) &&
134+
if ((!C.getDriver().IsCLMode() && Args.hasArg(options::OPT_fsycl) &&
136135
!Args.hasArg(options::OPT_nolibsycl)) ||
137136
Args.hasArg(options::OPT_fsycl_host_compiler_EQ)) {
138-
if (Args.hasArg(options::OPT__SLASH_MDd))
137+
CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") +
138+
TC.getDriver().Dir + "/../lib"));
139+
if (Args.hasArg(options::OPT_g_Flag))
139140
CmdArgs.push_back("-defaultlib:sycld.lib");
140141
else
141142
CmdArgs.push_back("-defaultlib:sycl.lib");

clang/lib/Sema/SemaChecking.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5967,8 +5967,8 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
59675967
CheckSYCLKernelCall(FD, Range, Args);
59685968

59695969
// Diagnose variadic calls in SYCL.
5970-
if (FD && FD ->isVariadic() && getLangOpts().SYCLIsDevice &&
5971-
!isUnevaluatedContext() && !isKnownGoodSYCLDecl(FD))
5970+
if (FD && FD->isVariadic() && getLangOpts().SYCLIsDevice &&
5971+
!isUnevaluatedContext() && !isDeclAllowedInSYCLDeviceCode(FD))
59725972
SYCLDiagIfDeviceCode(Loc, diag::err_sycl_restrict)
59735973
<< Sema::KernelCallVariadicFunction;
59745974
}

clang/lib/Sema/SemaDecl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,6 +2918,8 @@ static bool mergeDeclAttribute(Sema &S, NamedDecl *D,
29182918
NewAttr = S.MergeSYCLDeviceHasAttr(D, *A);
29192919
else if (const auto *A = dyn_cast<SYCLUsesAspectsAttr>(Attr))
29202920
NewAttr = S.MergeSYCLUsesAspectsAttr(D, *A);
2921+
else if (const auto *A = dyn_cast<SYCLTypeAttr>(Attr))
2922+
NewAttr = S.MergeSYCLTypeAttr(D, *A, A->getType());
29212923
else if (const auto *A = dyn_cast<SYCLIntelPipeIOAttr>(Attr))
29222924
NewAttr = S.MergeSYCLIntelPipeIOAttr(D, *A);
29232925
else if (const auto *A = dyn_cast<SYCLIntelMaxWorkGroupSizeAttr>(Attr))

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10426,46 +10426,15 @@ static void handleFunctionReturnThunksAttr(Sema &S, Decl *D,
1042610426
D->addAttr(FunctionReturnThunksAttr::Create(S.Context, Kind, AL));
1042710427
}
1042810428

10429-
static constexpr std::pair<Decl::Kind, StringRef>
10430-
MakeDeclContextDesc(Decl::Kind K, StringRef SR) {
10431-
return std::pair<Decl::Kind, StringRef>{K, SR};
10432-
}
10433-
10434-
// FIXME: Refactor Util class in SemaSYCL.cpp to avoid following
10435-
// code duplication.
1043610429
bool isDeviceAspectType(const QualType Ty) {
1043710430
const EnumType *ET = Ty->getAs<EnumType>();
1043810431
if (!ET)
1043910432
return false;
1044010433

10441-
std::array<std::pair<Decl::Kind, StringRef>, 3> Scopes = {
10442-
MakeDeclContextDesc(Decl::Kind::Namespace, "sycl"),
10443-
MakeDeclContextDesc(Decl::Kind::Namespace, "_V1"),
10444-
MakeDeclContextDesc(Decl::Kind::Enum, "aspect")};
10445-
10446-
const auto *Ctx = cast<DeclContext>(ET->getDecl());
10447-
StringRef Name = "";
10448-
10449-
for (const auto &Scope : llvm::reverse(Scopes)) {
10450-
Decl::Kind DK = Ctx->getDeclKind();
10451-
if (DK != Scope.first)
10452-
return false;
10434+
if (const auto *Attr = ET->getDecl()->getAttr<SYCLTypeAttr>())
10435+
return Attr->getType() == SYCLTypeAttr::aspect;
1045310436

10454-
switch (DK) {
10455-
case Decl::Kind::Enum:
10456-
Name = cast<EnumDecl>(Ctx)->getName();
10457-
break;
10458-
case Decl::Kind::Namespace:
10459-
Name = cast<NamespaceDecl>(Ctx)->getName();
10460-
break;
10461-
default:
10462-
llvm_unreachable("isDeviceAspectType: decl kind not supported");
10463-
}
10464-
if (Name != Scope.second)
10465-
return false;
10466-
Ctx = Ctx->getParent();
10467-
}
10468-
return Ctx->isTranslationUnit();
10437+
return false;
1046910438
}
1047010439

1047110440
SYCLDeviceHasAttr *Sema::MergeSYCLDeviceHasAttr(Decl *D,
@@ -10590,6 +10559,39 @@ static void handleSYCLKernelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
1059010559
handleSimpleAttribute<SYCLKernelAttr>(S, D, AL);
1059110560
}
1059210561

10562+
SYCLTypeAttr *Sema::MergeSYCLTypeAttr(Decl *D, const AttributeCommonInfo &CI,
10563+
SYCLTypeAttr::SYCLType TypeName) {
10564+
if (const auto *ExistingAttr = D->getAttr<SYCLTypeAttr>()) {
10565+
if (ExistingAttr->getType() != TypeName) {
10566+
Diag(ExistingAttr->getLoc(), diag::err_duplicate_attribute)
10567+
<< ExistingAttr;
10568+
Diag(CI.getLoc(), diag::note_previous_attribute);
10569+
}
10570+
// Do not add duplicate attribute
10571+
return nullptr;
10572+
}
10573+
return ::new (Context) SYCLTypeAttr(Context, CI, TypeName);
10574+
}
10575+
10576+
static void handleSYCLTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
10577+
if (!AL.isArgIdent(0)) {
10578+
S.Diag(AL.getLoc(), diag::err_attribute_argument_type)
10579+
<< AL << AANT_ArgumentIdentifier;
10580+
return;
10581+
}
10582+
10583+
IdentifierInfo *II = AL.getArgAsIdent(0)->Ident;
10584+
SYCLTypeAttr::SYCLType Type;
10585+
10586+
if (!SYCLTypeAttr::ConvertStrToSYCLType(II->getName(), Type)) {
10587+
S.Diag(AL.getLoc(), diag::err_attribute_argument_not_supported) << AL << II;
10588+
return;
10589+
}
10590+
10591+
if (SYCLTypeAttr *NewAttr = S.MergeSYCLTypeAttr(D, AL, Type))
10592+
D->addAttr(NewAttr);
10593+
}
10594+
1059310595
static void handleDestroyAttr(Sema &S, Decl *D, const ParsedAttr &A) {
1059410596
if (!cast<VarDecl>(D)->hasGlobalStorage()) {
1059510597
S.Diag(D->getLocation(), diag::err_destroy_attr_on_non_static_var)
@@ -11142,6 +11144,9 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
1114211144
case ParsedAttr::AT_SYCLSpecialClass:
1114311145
handleSimpleAttribute<SYCLSpecialClassAttr>(S, D, AL);
1114411146
break;
11147+
case ParsedAttr::AT_SYCLType:
11148+
handleSYCLTypeAttr(S, D, AL);
11149+
break;
1114511150
case ParsedAttr::AT_SYCLDevice:
1114611151
handleSYCLDeviceAttr(S, D, AL);
1114711152
break;

0 commit comments

Comments
 (0)