Skip to content

Commit 6f924e7

Browse files
committed
Merge remote-tracking branch 'upstream/sycl' into urlog
2 parents 4272297 + ecc9d15 commit 6f924e7

File tree

186 files changed

+4629
-2738
lines changed

Some content is hidden

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

186 files changed

+4629
-2738
lines changed

.github/workflows/sycl-windows-build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ jobs:
8686
- name: Detect hung tests
8787
if: always()
8888
shell: powershell
89-
continue-on-error: true
9089
run: |
9190
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/intel/llvm/refs/heads/sycl/devops/scripts/windows_detect_hung_tests.ps1" -OutFile "windows_detect_hung_tests.ps1"
9291
powershell.exe -File windows_detect_hung_tests.ps1

.github/workflows/sycl-windows-run-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ jobs:
101101
- name: Detect hung tests
102102
if: always()
103103
shell: powershell
104-
continue-on-error: true
105104
run: |
106105
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/intel/llvm/refs/heads/sycl/devops/scripts/windows_detect_hung_tests.ps1" -OutFile "windows_detect_hung_tests.ps1"
107106
powershell.exe -File windows_detect_hung_tests.ps1
@@ -181,7 +180,7 @@ jobs:
181180
if: inputs.tests_selector == 'e2e'
182181
shell: bash {0}
183182
env:
184-
LIT_OPTS: -v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests --param print_features=True --param test-mode=${{ inputs.e2e_testing_mode }} ${{ inputs.extra_lit_opts }}
183+
LIT_OPTS: -v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time ${{ inputs.e2e_testing_mode == 'run-only' && 1200 || 3600 }} --time-tests --param print_features=True --param test-mode=${{ inputs.e2e_testing_mode }} ${{ inputs.extra_lit_opts }}
185184
run: |
186185
# Run E2E tests.
187186
if [[ ${{inputs.compiler}} == 'icx' ]]; then

buildbot/configure.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ def do_configure(args, passthrough_args):
7878
sycl_enabled_backends.append("level_zero")
7979
sycl_enabled_backends.append("level_zero_v2")
8080

81-
# lld is needed on Windows or for the HIP adapter on AMD
82-
if platform.system() == "Windows" or (args.hip and args.hip_platform == "AMD"):
83-
llvm_enable_projects += ";lld"
84-
8581
libclc_enabled = args.cuda or args.hip or args.native_cpu
8682
if libclc_enabled:
8783
llvm_enable_projects += ";libclc"
@@ -171,6 +167,10 @@ def do_configure(args, passthrough_args):
171167
if args.disable_preview_lib:
172168
sycl_preview_lib = "OFF"
173169

170+
# lld is needed on Windows or when building AMDGPU
171+
if platform.system() == "Windows" or "AMDGPU" in llvm_targets_to_build:
172+
llvm_enable_projects += ";lld"
173+
174174
install_dir = os.path.join(abs_obj_dir, "install")
175175

176176
cmake_cmd = [

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,9 +3154,10 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
31543154
GenerateIntrinsics =
31553155
ConstWithoutErrnoOrExceptions && ErrnoOverridenToFalseWithOpt;
31563156
}
3157-
if (GenerateIntrinsics &&
3158-
!(getLangOpts().SYCLIsDevice && (getTarget().getTriple().isNVPTX() ||
3159-
getTarget().getTriple().isAMDGCN()))) {
3157+
bool IsSYCLDeviceWithoutIntrinsics =
3158+
getLangOpts().SYCLIsDevice &&
3159+
(getTarget().getTriple().isNVPTX() || getTarget().getTriple().isAMDGCN());
3160+
if (GenerateIntrinsics && !IsSYCLDeviceWithoutIntrinsics) {
31603161
switch (BuiltinIDIfNoAsmLabel) {
31613162
case Builtin::BIacos:
31623163
case Builtin::BIacosf:
@@ -4256,7 +4257,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
42564257
case Builtin::BI__builtin_modf:
42574258
case Builtin::BI__builtin_modff:
42584259
case Builtin::BI__builtin_modfl:
4259-
if (Builder.getIsFPConstrained())
4260+
if (Builder.getIsFPConstrained() || IsSYCLDeviceWithoutIntrinsics)
42604261
break; // TODO: Emit constrained modf intrinsic once one exists.
42614262
return RValue::get(emitModfBuiltin(*this, E, Intrinsic::modf));
42624263
case Builtin::BI__builtin_isgreater:

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,15 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
603603
// For DG2, we just use libsycl-msan as placeholder.
604604
{"libsycl-msan", "internal"},
605605
{"libsycl-msan-pvc", "internal"}};
606-
const SYCLDeviceLibsList SYCLDeviceTsanLibs = {{"libsycl-tsan", "internal"}};
606+
const SYCLDeviceLibsList SYCLDeviceTsanLibs = {
607+
{"libsycl-tsan", "internal"},
608+
{"libsycl-tsan-cpu", "internal"},
609+
// Currently, we only provide aot tsan libdevice for PVC and CPU.
610+
// For DG2, we just use libsycl-tsan as placeholder.
611+
// TODO: replace "libsycl-tsan" with "libsycl-tsan-dg2" when DG2
612+
// AOT support is added.
613+
{"libsycl-tsan", "internal"},
614+
{"libsycl-tsan-pvc", "internal"}};
607615
#endif
608616

609617
const SYCLDeviceLibsList SYCLNativeCpuDeviceLibs = {
@@ -759,7 +767,7 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
759767
else if (SanitizeVal == "memory")
760768
addSingleLibrary(SYCLDeviceMsanLibs[sanitizer_lib_idx]);
761769
else if (SanitizeVal == "thread")
762-
addLibraries(SYCLDeviceTsanLibs);
770+
addSingleLibrary(SYCLDeviceTsanLibs[sanitizer_lib_idx]);
763771
#endif
764772

765773
if (isSYCLNativeCPU(TargetTriple))
@@ -883,6 +891,8 @@ static llvm::SmallVector<StringRef, 16> SYCLDeviceLibList{
883891
"msan-pvc",
884892
"msan-cpu",
885893
"tsan",
894+
"tsan-pvc",
895+
"tsan-cpu",
886896
#endif
887897
"imf",
888898
"imf-fp64",

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,18 +1535,25 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
15351535
if (LangOpts.GPURelocatableDeviceCode)
15361536
Builder.defineMacro("SYCL_EXTERNAL", "__attribute__((sycl_device))");
15371537

1538-
const llvm::Triple &DeviceTriple = TI.getTriple();
1539-
const llvm::Triple::SubArchType DeviceSubArch = DeviceTriple.getSubArch();
1540-
if (DeviceTriple.isNVPTX() || DeviceTriple.isAMDGPU() ||
1541-
(DeviceTriple.isSPIR() &&
1542-
DeviceSubArch != llvm::Triple::SPIRSubArch_fpga) ||
1538+
// This gets called twice, once with TI set to the host TargetInfo, once
1539+
// with TI set to the device TargetInfo.
1540+
const llvm::Triple &Triple = TI.getTriple();
1541+
const llvm::Triple::SubArchType SubArch = Triple.getSubArch();
1542+
if (Triple.isNVPTX() || Triple.isAMDGPU() ||
1543+
(Triple.isSPIR() && SubArch != llvm::Triple::SPIRSubArch_fpga) ||
15431544
LangOpts.SYCLIsNativeCPU)
15441545
Builder.defineMacro("SYCL_USE_NATIVE_FP_ATOMICS");
15451546
// Enable generation of USM address spaces for FPGA.
1546-
if (DeviceSubArch == llvm::Triple::SPIRSubArch_fpga) {
1547+
if (SubArch == llvm::Triple::SPIRSubArch_fpga) {
15471548
Builder.defineMacro("__ENABLE_USM_ADDR_SPACE__");
15481549
Builder.defineMacro("SYCL_DISABLE_FALLBACK_ASSERT");
15491550
}
1551+
1552+
if (Triple.isWindowsMSVCEnvironment()) {
1553+
// MSVC inline definitions of stdio functions should not be used for SYCL
1554+
// device code.
1555+
Builder.defineMacro("_NO_CRT_STDIO_INLINE");
1556+
}
15501557
} else if (LangOpts.SYCLIsHost && LangOpts.SYCLESIMDBuildHostCode) {
15511558
Builder.defineMacro("__ESIMD_BUILD_HOST_CODE");
15521559
}

clang/test/Driver/Inputs/SYCL/lib/libsycl-tsan-cpu.bc

Whitespace-only changes.

clang/test/Driver/Inputs/SYCL/lib/libsycl-tsan-pvc.bc

Whitespace-only changes.

clang/test/Driver/sycl-device-lib-old-model.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,3 +415,26 @@
415415
// SYCL_DEVICE_TSAN_MACRO-SAME: "USE_SYCL_DEVICE_TSAN"
416416
// SYCL_DEVICE_TSAN_MACRO: llvm-link{{.*}} "-only-needed"
417417
// SYCL_DEVICE_TSAN_MACRO-SAME: "{{.*}}libsycl-tsan.bc"
418+
419+
/// ###########################################################################
420+
/// test behavior of linking libsycl-tsan-pvc for PVC target AOT compilation when tsan flag is applied.
421+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc --no-offload-new-driver %s --sysroot=%S/Inputs/SYCL \
422+
// RUN: -Xarch_device -fsanitize=thread -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_TSAN_PVC
423+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device pvc" --no-offload-new-driver %s \
424+
// RUN: --sysroot=%S/Inputs/SYCL -Xarch_device -fsanitize=thread -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_TSAN_PVC
425+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" --no-offload-new-driver %s \
426+
// RUN: --sysroot=%S/Inputs/SYCL -Xarch_device -fsanitize=thread -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_TSAN_PVC
427+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device 12.60.7" --no-offload-new-driver %s \
428+
// RUN: --sysroot=%S/Inputs/SYCL -Xarch_device -fsanitize=thread -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_TSAN_PVC
429+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xs "-device 12.60.7" --no-offload-new-driver %s --sysroot=%S/Inputs/SYCL \
430+
// RUN: -Xarch_device -fsanitize=thread -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_TSAN_PVC
431+
// SYCL_DEVICE_LIB_TSAN_PVC: llvm-link{{.*}} "-only-needed" "{{.*}}libsycl-crt.bc"
432+
// SYCL_DEVICE_LIB_TSAN_PVC-SAME: "{{.*}}libsycl-tsan-pvc.bc"
433+
434+
435+
/// ###########################################################################
436+
/// test behavior of linking libsycl-tsan-cpu for CPU target AOT compilation when tsan flag is applied.
437+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 --no-offload-new-driver %s --sysroot=%S/Inputs/SYCL \
438+
// RUN: -Xarch_device -fsanitize=thread -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_TSAN_CPU
439+
// SYCL_DEVICE_LIB_TSAN_CPU: llvm-link{{.*}} "-only-needed" "{{.*}}libsycl-crt.bc"
440+
// SYCL_DEVICE_LIB_TSAN_CPU-SAME: "{{.*}}libsycl-tsan-cpu.bc"

clang/test/Driver/sycl-device-lib.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,15 @@
401401
// SYCL_DEVICE_TSAN_MACRO: "-cc1"
402402
// SYCL_DEVICE_TSAN_MACRO-SAME: "USE_SYCL_DEVICE_TSAN"
403403
// SYCL_DEVICE_TSAN_MACRO: libsycl-tsan.new.o
404+
405+
/// test behavior of tsan libdevice linking when -fsanitize=thread is available for AOT targets
406+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc --offload-new-driver %s --sysroot=%S/Inputs/SYCL \
407+
// RUN: -fsanitize=thread -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_TSAN_PVC
408+
// SYCL_DEVICE_LIB_TSAN_PVC: clang-linker-wrapper{{.*}} "-sycl-device-libraries
409+
// SYCL_DEVICE_LIB_TSAN_PVC-SAME: {{.*}}libsycl-tsan-pvc.new.o
410+
411+
/// test behavior of tsan libdevice linking when -fsanitize=thread is available for AOT targets
412+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 --offload-new-driver %s --sysroot=%S/Inputs/SYCL \
413+
// RUN: -fsanitize=thread -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_TSAN_CPU
414+
// SYCL_DEVICE_LIB_TSAN_CPU: clang-linker-wrapper{{.*}} "-sycl-device-libraries
415+
// SYCL_DEVICE_LIB_TSAN_CPU-SAME: {{.*}}libsycl-tsan-cpu.new.o

0 commit comments

Comments
 (0)