Skip to content

Commit bc97e6f

Browse files
Merge branch 'sycl' into steffen/stream_property_lists
2 parents b4a58e9 + 160e45d commit bc97e6f

File tree

131 files changed

+4105
-1016
lines changed

Some content is hidden

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

131 files changed

+4105
-1016
lines changed

.github/workflows/clang-format.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/sycl_precommit.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: SYCL
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- sycl
7+
8+
jobs:
9+
lint:
10+
# TODO use nightly builds of SYCL to get clang-format
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Get clang-format first
14+
run: sudo apt-get install -yqq clang-format
15+
16+
- uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 2
19+
20+
- name: Run clang-format
21+
uses: ./devops/actions/clang-format
22+
23+
linux_default:
24+
name: Default Linux
25+
# Only build and test patches, that have passed all linter checks, because
26+
# the next commit is likely to be a follow-up on that job.
27+
needs: lint
28+
if: always() && (success() || contains(github.event.pull_request.labels.*.name, 'ignore-lint'))
29+
uses: intel/llvm/.github/workflows/sycl_linux_build_and_test.yml@sycl
30+
with:
31+
build_runs_on: "sycl-precommit-linux"
32+
build_cache_root: "/__w/"
33+
build_cache_size: "8G"
34+
build_artifact_suffix: "default"
35+
build_cache_suffix: "default"
36+

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=2021.12.9.0.24
44
# https://github.com/intel/llvm/releases/download/2021-WW40/win-oclcpuexp-2021.12.9.0.24_rel.zip
55
ocl_cpu_rt_ver_win=2021.12.9.0.24
66
# Same GPU driver supports Level Zero and OpenCL
7-
# https://github.com/intel/compute-runtime/releases/tag/21.37.20939
8-
ocl_gpu_rt_ver=21.37.20939
7+
# https://github.com/intel/compute-runtime/releases/tag/21.44.21506
8+
ocl_gpu_rt_ver=21.44.21506
99
# Same GPU driver supports Level Zero and OpenCL
1010
# https://downloadmirror.intel.com/677976/igfx_win_100.9955.zip
1111
ocl_gpu_rt_ver_win=30.0.100.9955
@@ -30,7 +30,7 @@ ocloc_ver_win=27.20.100.9168
3030
[DRIVER VERSIONS]
3131
cpu_driver_lin=2021.12.9.0.24
3232
cpu_driver_win=2021.12.9.0.24
33-
gpu_driver_lin=21.37.20939
33+
gpu_driver_lin=21.44.21506
3434
gpu_driver_win=30.0.100.9955
3535
fpga_driver_lin=2021.12.9.0.24
3636
fpga_driver_win=2021.12.9.0.24

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11451,7 +11451,8 @@ def err_invalid_std_type_in_sycl_kernel : Error<"%0 is an invalid kernel name, "
1145111451
"%q1 is declared in the 'std' namespace ">;
1145211452

1145311453
def err_sycl_kernel_incorrectly_named : Error<
11454-
"%select{%1 should be globally visible"
11454+
"%select{%1 is invalid; kernel name should be forward declarable "
11455+
"at namespace scope"
1145511456
"|unscoped enum %1 requires fixed underlying type"
1145611457
"|unnamed type %1 is invalid; provide a kernel name, or use "
1145711458
"'-fsycl-unnamed-lambda' to enable unnamed kernel lambdas"

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ def offload_arch_EQ : Joined<["--"], "offload-arch=">, Flags<[NoXarchOption]>,
937937
"device architecture followed by target ID features delimited by a colon. Each target ID feature "
938938
"is a pre-defined string followed by a plus or minus sign (e.g. gfx908:xnack+:sramecc-). May be "
939939
"specified more than once.">;
940-
def cuda_gpu_arch_EQ : Joined<["--"], "cuda-gpu-arch=">, Flags<[NoXarchOption]>,
940+
def cuda_gpu_arch_EQ : Joined<["--"], "cuda-gpu-arch=">, Flags<[NoXarchOption, CoreOption]>,
941941
Alias<offload_arch_EQ>;
942942
def hip_link : Flag<["--"], "hip-link">,
943943
HelpText<"Link clang-offload-bundler bundles for HIP">;
@@ -954,7 +954,7 @@ def no_cuda_version_check : Flag<["--"], "no-cuda-version-check">,
954954
HelpText<"Don't error out if the detected version of the CUDA install is "
955955
"too low for the requested CUDA gpu architecture.">;
956956
def no_cuda_noopt_device_debug : Flag<["--"], "no-cuda-noopt-device-debug">;
957-
def cuda_path_EQ : Joined<["--"], "cuda-path=">, Group<i_Group>,
957+
def cuda_path_EQ : Joined<["--"], "cuda-path=">, Flags<[CoreOption]>, Group<i_Group>,
958958
HelpText<"CUDA installation path">;
959959
def cuda_path_ignore_env : Flag<["--"], "cuda-path-ignore-env">, Group<i_Group>,
960960
HelpText<"Ignore environment variables to detect CUDA installation">;
@@ -2691,7 +2691,7 @@ def fsycl_help : Flag<["-"], "fsycl-help">, Alias<fsycl_help_EQ>,
26912691
"from all of the offline compilation tools">;
26922692
def fsycl_libspirv_path_EQ : Joined<["-"], "fsycl-libspirv-path=">,
26932693
Flags<[CC1Option, CoreOption]>, HelpText<"Path to libspirv library">;
2694-
def fno_sycl_libspirv : Flag<["-"], "fno-sycl-libspirv">, HelpText<"Disable check for libspirv">;
2694+
def fno_sycl_libspirv : Flag<["-"], "fno-sycl-libspirv">, Flags<[CoreOption]>, HelpText<"Disable check for libspirv">;
26952695
def fsycl_host_compiler_EQ : Joined<["-"], "fsycl-host-compiler=">,
26962696
Flags<[CoreOption]>, HelpText<"Specify C++ compiler binary to perform host "
26972697
"compilation with during SYCL offload compiles.">;
@@ -3843,7 +3843,7 @@ def nogpuinc : Flag<["-"], "nogpuinc">, HelpText<"Do not add include paths for C
38433843
def : Flag<["-"], "nocudainc">, Alias<nogpuinc>;
38443844
def nogpulib : Flag<["-"], "nogpulib">,
38453845
HelpText<"Do not link device library for CUDA/HIP device compilation">;
3846-
def : Flag<["-"], "nocudalib">, Alias<nogpulib>;
3846+
def : Flag<["-"], "nocudalib">, Flags<[CoreOption]>, Alias<nogpulib>;
38473847
def nodefaultlibs : Flag<["-"], "nodefaultlibs">;
38483848
def nofixprebinding : Flag<["-"], "nofixprebinding">;
38493849
def nolibc : Flag<["-"], "nolibc">;

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10593,9 +10593,7 @@ class Sema final {
1059310593
Expr *E);
1059410594

1059510595
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type);
10596-
bool checkAllowedSYCLInitializer(VarDecl *VD,
10597-
bool CheckValueDependent = false);
10598-
10596+
bool checkAllowedSYCLInitializer(VarDecl *VD);
1059910597
//===--------------------------------------------------------------------===//
1060010598
// C++ Coroutines TS
1060110599
//

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
15401540
StartFunction(GD, ResTy, Fn, FnInfo, Args, Loc, BodyRange.getBegin());
15411541

15421542
SyclOptReportHandler &SyclOptReport = CGM.getDiags().getSYCLOptReport();
1543-
if (SyclOptReport.HasOptReportInfo(FD)) {
1543+
if (Fn && SyclOptReport.HasOptReportInfo(FD)) {
15441544
llvm::OptimizationRemarkEmitter ORE(Fn);
15451545
for (auto ORI : llvm::enumerate(SyclOptReport.GetInfo(FD))) {
15461546
llvm::DiagnosticLocation DL =

clang/lib/Driver/Driver.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4113,7 +4113,10 @@ class OffloadingActionBuilder final {
41134113
Args.getLastArg(options::OPT__SLASH_EP, options::OPT__SLASH_P) ||
41144114
Args.getLastArg(options::OPT_M, options::OPT_MM);
41154115
if (IsPreprocessOnly) {
4116-
for (Action *&A : SYCLDeviceActions) {
4116+
for (auto TargetActionInfo :
4117+
llvm::zip(SYCLDeviceActions, SYCLTargetInfoList)) {
4118+
Action *&A = std::get<0>(TargetActionInfo);
4119+
auto &TargetInfo = std::get<1>(TargetActionInfo);
41174120
A = C.getDriver().ConstructPhaseAction(C, Args, CurPhase, A,
41184121
AssociatedOffloadKind);
41194122
if (SYCLDeviceOnly)
@@ -4122,7 +4125,7 @@ class OffloadingActionBuilder final {
41224125
// header.
41234126
Action *CompileAction =
41244127
C.MakeAction<CompileJobAction>(A, types::TY_Nothing);
4125-
DA.add(*CompileAction, *ToolChains.front(), nullptr,
4128+
DA.add(*CompileAction, *TargetInfo.TC, TargetInfo.BoundArch,
41264129
Action::OFK_SYCL);
41274130
}
41284131
return SYCLDeviceOnly ? ABRT_Ignore_Host : ABRT_Success;
@@ -4147,6 +4150,8 @@ class OffloadingActionBuilder final {
41474150
continue;
41484151
}
41494152
}
4153+
if (Args.hasArg(options::OPT_fsyntax_only))
4154+
OutputType = types::TY_Nothing;
41504155
A = C.MakeAction<CompileJobAction>(A, OutputType);
41514156
DeviceCompilerInput = A;
41524157
}
@@ -4875,11 +4880,14 @@ class OffloadingActionBuilder final {
48754880
bool SYCLfpgaTriple = false;
48764881
bool ShouldAddDefaultTriple = true;
48774882
bool GpuInitHasErrors = false;
4878-
if (SYCLTargets || SYCLAddTargets) {
4879-
if (SYCLTargets) {
4883+
bool HasSYCLTargetsOption =
4884+
SYCLAddTargets || SYCLTargets || SYCLLinkTargets;
4885+
if (HasSYCLTargetsOption) {
4886+
if (SYCLTargets || SYCLLinkTargets) {
4887+
Arg *SYCLTargetsValues = SYCLTargets ? SYCLTargets : SYCLLinkTargets;
48804888
// Fill SYCLTripleList
48814889
llvm::StringMap<StringRef> FoundNormalizedTriples;
4882-
for (const char *Val : SYCLTargets->getValues()) {
4890+
for (const char *Val : SYCLTargetsValues->getValues()) {
48834891
llvm::Triple TT(C.getDriver().MakeSYCLDeviceTriple(Val));
48844892
std::string NormalizedName = TT.normalize();
48854893

clang/lib/Driver/ToolChain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ llvm::opt::DerivedArgList *ToolChain::TranslateOffloadTargetArgs(
12191219
A->getOption().matches(options::OPT_Xsycl_frontend);
12201220
if (A->getOption().matches(options::OPT_Xsycl_frontend_EQ)) {
12211221
// Passing device args: -Xsycl-target-frontend=<triple> -opt=val.
1222-
if (A->getValue(0) == getTripleString())
1222+
if (getDriver().MakeSYCLDeviceTriple(A->getValue(0)) == getTriple())
12231223
Index = Args.getBaseArgs().MakeIndex(A->getValue(1));
12241224
else
12251225
continue;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8886,7 +8886,8 @@ void SPIRVTranslator::ConstructJob(Compilation &C, const JobAction &JA,
88868886
// Don't enable several freshly added extensions on FPGA H/W
88878887
ExtArg += ",+SPV_INTEL_token_type"
88888888
",+SPV_INTEL_bfloat16_conversion"
8889-
",+SPV_INTEL_joint_matrix";
8889+
",+SPV_INTEL_joint_matrix"
8890+
",+SPV_INTEL_hw_thread_queries";
88908891
TranslatorArgs.push_back(TCArgs.MakeArgString(ExtArg));
88918892
}
88928893
for (auto I : Inputs) {
@@ -9036,8 +9037,9 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
90369037
addArgs(CmdArgs, TCArgs, {"-split=auto"});
90379038
else { // Device code split is off
90389039
}
9039-
} else {
9040-
// auto is the default split mode
9040+
} else if (getToolChain().getTriple().getArchName() != "spir64_fpga") {
9041+
// for FPGA targets, off is the default split mode,
9042+
// otherwise auto is the default split mode
90419043
addArgs(CmdArgs, TCArgs, {"-split=auto"});
90429044
}
90439045

clang/lib/Sema/SemaExpr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
249249
// Disallow const statics and globals that are not zero-initialized
250250
// or constant-initialized.
251251
else if (IsRuntimeEvaluated && IsConst && VD->hasGlobalStorage() &&
252-
!VD->isConstexpr() &&
253-
!checkAllowedSYCLInitializer(VD, /*CheckValueDependent =*/true))
252+
!VD->isConstexpr() && !checkAllowedSYCLInitializer(VD))
254253
SYCLDiagIfDeviceCode(*Locs.begin(), diag::err_sycl_restrict)
255254
<< Sema::KernelConstStaticVariable;
256255
} else if (auto *FDecl = dyn_cast<FunctionDecl>(D)) {

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,13 +3508,12 @@ class SYCLKernelNameTypeVisitor
35083508
}
35093509
// Check if the declaration is completely defined within a
35103510
// function or class/struct.
3511-
35123511
if (Tag->isCompleteDefinition()) {
35133512
S.Diag(KernelInvocationFuncLoc,
35143513
diag::err_sycl_kernel_incorrectly_named)
3515-
<< /* kernel name should be globally visible */ 0
3516-
<< KernelNameType;
3517-
3514+
<< /* kernel name should be forward declarable at namespace
3515+
scope */
3516+
0 << KernelNameType;
35183517
IsInvalid = true;
35193518
} else {
35203519
S.Diag(KernelInvocationFuncLoc, diag::warn_sycl_implicit_decl);
@@ -4132,15 +4131,15 @@ void Sema::finalizeSYCLDelayedAnalysis(const FunctionDecl *Caller,
41324131
}
41334132
}
41344133

4135-
bool Sema::checkAllowedSYCLInitializer(VarDecl *VD, bool CheckValueDependent) {
4134+
bool Sema::checkAllowedSYCLInitializer(VarDecl *VD) {
41364135
assert(getLangOpts().SYCLIsDevice &&
41374136
"Should only be called during SYCL compilation");
41384137

41394138
if (VD->isInvalidDecl() || !VD->hasInit() || !VD->hasGlobalStorage())
41404139
return true;
41414140

41424141
const Expr *Init = VD->getInit();
4143-
bool ValueDependent = CheckValueDependent && Init->isValueDependent();
4142+
bool ValueDependent = Init->isValueDependent();
41444143
bool isConstantInit =
41454144
Init && !ValueDependent && Init->isConstantInitializer(Context, false);
41464145
if (!VD->isConstexpr() && Init && !ValueDependent && !isConstantInit)

clang/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ if( NOT CLANG_BUILT_STANDALONE )
111111
list(APPEND CLANG_TEST_DEPS
112112
llvm-config
113113
FileCheck count not
114+
append-file
114115
llc
115116
llvm-ar
116117
llvm-as

clang/test/Driver/sycl-instrumentation.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
/// 1. A SPIR-V-based environment must be targetted
55
/// 2. The corresponding Driver option must be enabled explicitly
66

7-
// RUN: %clangxx -fsycl -fsycl-instrument-device-code --sysroot=%S/Inputs/SYCL -fsycl-targets=spir64 -### %s 2>&1 \
7+
/// FIXME: Force linux targets to allow for the libraries to be found. Dummy
8+
/// inputs for --sysroot should be updated to work better for Windows.
9+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-instrument-device-code --sysroot=%S/Inputs/SYCL -fsycl-targets=spir64 -### %s 2>&1 \
810
// RUN: | FileCheck -check-prefixes=CHECK-SPIRV,CHECK-HOST %s
911
/// -fno-sycl-device-lib mustn't affect the linkage of ITT libraries
10-
// RUN: %clangxx -fsycl -fsycl-instrument-device-code --sysroot=%S/Inputs/SYCL -fno-sycl-device-lib=all -fsycl-targets=spir64 -### %s 2>&1 \
12+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-instrument-device-code --sysroot=%S/Inputs/SYCL -fno-sycl-device-lib=all -fsycl-targets=spir64 -### %s 2>&1 \
1113
// RUN: | FileCheck -check-prefixes=CHECK-SPIRV %s
1214

1315
// CHECK-SPIRV: "-cc1"{{.*}} "-fsycl-is-device"{{.*}} "-fsycl-instrument-device-code"

0 commit comments

Comments
 (0)