Skip to content

Commit 7177dca

Browse files
committed
Merge branch 'sycl' into cperkins-kernel_compiler-sycl-cache
2 parents 19c1f08 + 4797d65 commit 7177dca

File tree

376 files changed

+6795
-2304
lines changed

Some content is hidden

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

376 files changed

+6795
-2304
lines changed

.github/workflows/sycl-linux-precommit.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,22 @@ jobs:
8383
- name: Intel
8484
runner: '["Linux", "gen12"]'
8585
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
86-
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
86+
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
8787
target_devices: level_zero:gpu;opencl:gpu;opencl:cpu
8888
reset_intel_gpu: true
8989
extra_lit_opts: --param gpu-intel-gen12=True
9090
- name: E2E tests on Intel Arc A-Series Graphics
9191
runner: '["Linux", "arc"]'
9292
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
93-
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
93+
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
9494
target_devices: level_zero:gpu;opencl:gpu
9595
reset_intel_gpu: true
9696
extra_lit_opts: --param matrix-xmx8=True --param gpu-intel-dg2=True
9797
env: '{"LIT_FILTER":${{ needs.determine_arc_tests.outputs.arc_tests }} }'
9898
- name: E2E tests with dev igc on Intel Arc A-Series Graphics
9999
runner: '["Linux", "arc"]'
100100
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:devigc
101-
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
101+
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
102102
target_devices: level_zero:gpu;opencl:gpu
103103
reset_intel_gpu: true
104104
extra_lit_opts: --param matrix-xmx8=True --param gpu-intel-dg2=True
@@ -117,11 +117,11 @@ jobs:
117117
env: ${{ matrix.env || '{}' }}
118118

119119
# Do not install drivers on AMD and CUDA runners.
120-
install_igc_driver: |
120+
install_igc_driver: >-
121121
${{ !contains(matrix.target_devices, 'ext_oneapi_cuda') &&
122122
!contains(matrix.target_devices, 'ext_oneapi_hip') &&
123123
contains(needs.detect_changes.outputs.filters, 'drivers') }}
124-
install_dev_igc_driver: |
124+
install_dev_igc_driver: >-
125125
${{ !contains(matrix.target_devices, 'ext_oneapi_cuda') &&
126126
!contains(matrix.target_devices, 'ext_oneapi_hip') &&
127127
matrix.use_igc_dev && contains(needs.detect_changes.outputs.filters, 'devigccfg') ||

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ permissions:
151151

152152
jobs:
153153
run:
154-
if: inputs.skip_run == 'false'
154+
if: github.event_name == 'workflow_dispatch' || inputs.skip_run == 'false'
155155
name: ${{ inputs.name }}
156156
runs-on: ${{ fromJSON(inputs.runner) }}
157157
container:

.github/workflows/sycl-nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Intel L0 GPU
5454
runner: '["Linux", "gen12"]'
5555
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
56-
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
56+
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
5757
target_devices: level_zero:gpu
5858
reset_intel_gpu: true
5959
tests_selector: e2e
@@ -62,7 +62,7 @@ jobs:
6262
- name: Intel OCL GPU
6363
runner: '["Linux", "gen12"]'
6464
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
65-
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
65+
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
6666
target_devices: opencl:gpu
6767
reset_intel_gpu: true
6868
tests_selector: e2e

.github/workflows/sycl-post-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
name: ${{ matrix.name }}
8888
runner: ${{ matrix. runner }}
8989
image: ${{ matrix.image || 'ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest' }}
90-
image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN' }}
90+
image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }}
9191
target_devices: ${{ matrix.target_devices || 'level_zero:gpu' }}
9292
reset_intel_gpu: ${{ matrix.reset_intel_gpu }}
9393

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@ jobs:
8686
# Run E2E tests.
8787
export LIT_OPTS="-v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests ${{ inputs.extra_lit_opts }}"
8888
cmake --build build-e2e --target check-sycl-e2e
89+
- name: Detect hung tests
90+
shell: powershell
91+
run: |
92+
$exitCode = 0
93+
$hungTests = Get-Process | Where-Object { ($_.Path -match "llvm\\install") -or ($_.Path -match "llvm\\build-e2e") }
94+
$hungTests | Foreach-Object {
95+
$exitCode = 1
96+
echo "Test $($_.Path) hung!"
97+
Stop-Process -Force $_
98+
}
99+
exit $exitCode
89100
- name: Cleanup
90101
shell: cmd
91102
if: always()

clang/include/clang/Basic/LangOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ LANGOPT(SYCLAllowFuncPtr , 1, 0, "Allow function pointers in SYCL device code")
307307
LANGOPT(SYCLStdLayoutKernelParams, 1, 0, "Enable standard layout requirement for SYCL kernel parameters")
308308
LANGOPT(SYCLUnnamedLambda , 1, 0, "Allow unnamed lambda SYCL kernels")
309309
LANGOPT(SYCLForceInlineKernelLambda , 1, 0, "Force inline SYCL kernel lambdas in entry point")
310-
LANGOPT(SYCLAllowAllFeaturesInConstexpr, 1, 0, "Allow all C++ features in SYCL device code in manifestly constant-evaluated expressions")
311310
LANGOPT(SYCLESIMDForceStatelessMem, 1, 0, "Make accessors use USM memory in ESIMD kernels")
312311
LANGOPT(SYCLESIMDBuildHostCode, 1, 1, "Build the host implementation of ESIMD functions")
313312
ENUM_LANGOPT(SYCLVersion , SYCLMajorVersion, 2, SYCL_None, "Version of the SYCL standard used")

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8628,11 +8628,6 @@ def fsycl_is_native_cpu : Flag<["-"], "fsycl-is-native-cpu">,
86288628
HelpText<"Perform device compilation for Native CPU.">,
86298629
Visibility<[CC1Option]>,
86308630
MarshallingInfoFlag<LangOpts<"SYCLIsNativeCPU">>;
8631-
defm sycl_allow_all_features_in_constexpr
8632-
: BoolFOption<
8633-
"sycl-allow-all-features-in-constexpr", LangOpts<"SYCLAllowAllFeaturesInConstexpr">,
8634-
DefaultFalse,
8635-
PosFlag<SetTrue, [], [CC1Option], "Allow all C++ features in SYCL device code in manifestly constant-evaluated expressions">, NegFlag<SetFalse>>;
86368631

86378632
} // let Visibility = [CC1Option]
86388633

clang/lib/Driver/Driver.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6350,7 +6350,7 @@ class OffloadingActionBuilder final {
63506350
if (GpuInitHasErrors)
63516351
return true;
63526352

6353-
int I = 0;
6353+
int GenIndex = 0;
63546354
// Fill SYCLTargetInfoList
63556355
for (auto &TT : SYCLTripleList) {
63566356
auto TCIt = llvm::find_if(
@@ -6363,10 +6363,21 @@ class OffloadingActionBuilder final {
63636363
// is the target device.
63646364
if (TT.isSPIR() &&
63656365
TT.getSubArch() == llvm::Triple::SPIRSubArch_gen) {
6366-
StringRef Device(GpuArchList[I].second);
6366+
// Multiple spir64_gen targets are allowed to be used via the
6367+
// -fsycl-targets=spir64_gen and -fsycl-targets=intel_gpu_*
6368+
// specifiers. Using an index through the known GpuArchList
6369+
// values, increment through them accordingly to allow for
6370+
// the multiple settings as well as preventing re-use.
6371+
while (TT != GpuArchList[GenIndex].first &&
6372+
GenIndex < GpuArchList.size())
6373+
++GenIndex;
6374+
if (GpuArchList[GenIndex].first != TT)
6375+
// No match.
6376+
continue;
6377+
StringRef Device(GpuArchList[GenIndex].second);
63676378
SYCLTargetInfoList.emplace_back(
63686379
*TCIt, Device.empty() ? nullptr : Device.data());
6369-
++I;
6380+
++GenIndex;
63706381
continue;
63716382
}
63726383
SYCLTargetInfoList.emplace_back(*TCIt, nullptr);
@@ -6380,7 +6391,6 @@ class OffloadingActionBuilder final {
63806391
}
63816392
assert(OffloadArch && "Failed to find matching arch.");
63826393
SYCLTargetInfoList.emplace_back(*TCIt, OffloadArch);
6383-
++I;
63846394
}
63856395
}
63866396
}
@@ -6776,13 +6786,10 @@ class OffloadingActionBuilder final {
67766786
// Do not use unbundler if the Host does not depend on device action.
67776787
// Now that we have unbundled the object, when doing -fsycl-link we
67786788
// want to continue the host link with the input object.
6779-
// For unbundling of an FPGA AOCX binary, we want to link with the original
6780-
// FPGA device archive.
67816789
if ((OffloadKind == Action::OFK_None && CanUseBundler) ||
67826790
(Args.hasArg(options::OPT_fsycl_link_EQ) && !HasFPGATarget) ||
67836791
(HasFPGATarget && ((Args.hasArg(options::OPT_fsycl_link_EQ) &&
6784-
HostAction->getType() == types::TY_Object) ||
6785-
HostAction->getType() == types::TY_FPGA_AOCX)))
6792+
HostAction->getType() == types::TY_Object))))
67866793
if (auto *UA = dyn_cast<OffloadUnbundlingJobAction>(HostAction))
67876794
HostAction = UA->getInputs().back();
67886795

@@ -7433,14 +7440,12 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
74337440

74347441
// For an FPGA archive, we add the unbundling step above to take care of
74357442
// the device side, but also unbundle here to extract the host side
7436-
bool EarlyLink = false;
7437-
if (const Arg *A = Args.getLastArg(options::OPT_fsycl_link_EQ))
7438-
EarlyLink = A->getValue() == StringRef("early");
74397443
for (auto &LI : LinkerInputs) {
74407444
Action *UnbundlerInput = nullptr;
74417445
auto wrapObject = [&] {
7442-
if (EarlyLink && Args.hasArg(options::OPT_fintelfpga)) {
7443-
// Only wrap the object with -fsycl-link=early
7446+
if (Args.hasArg(options::OPT_fsycl_link_EQ) &&
7447+
Args.hasArg(options::OPT_fintelfpga)) {
7448+
// Wrap the object when creating an FPGA AOCX or AOCR binary.
74447449
auto *BC = C.MakeAction<OffloadWrapperJobAction>(LI, types::TY_LLVM_BC);
74457450
auto *ASM = C.MakeAction<BackendJobAction>(BC, types::TY_PP_Asm);
74467451
auto *OBJ = C.MakeAction<AssembleJobAction>(ASM, types::TY_Object);

clang/lib/Driver/ToolChains/Cuda.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,15 @@ void CudaToolChain::addClangTargetOptions(
946946

947947
if (DriverArgs.hasArg(options::OPT_fsycl_fp32_prec_sqrt))
948948
CC1Args.push_back("-fcuda-prec-sqrt");
949+
950+
bool FastRelaxedMath = DriverArgs.hasFlag(
951+
options::OPT_ffast_math, options::OPT_fno_fast_math, false);
952+
bool UnsafeMathOpt =
953+
DriverArgs.hasFlag(options::OPT_funsafe_math_optimizations,
954+
options::OPT_fno_unsafe_math_optimizations, false);
955+
if (FastRelaxedMath || UnsafeMathOpt)
956+
CC1Args.append({"-mllvm", "--nvptx-prec-divf32=0", "-mllvm",
957+
"--nvptx-prec-sqrtf32=0"});
949958
} else {
950959
CC1Args.append(
951960
{"-fcuda-is-device", "-mllvm", "-enable-memcpyopt-without-libcalls"});

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ const char *SYCL::Linker::constructLLVMLinkCommand(
579579
auto isSYCLDeviceLib = [&](const InputInfo &II) {
580580
const ToolChain *HostTC = C.getSingleOffloadToolChain<Action::OFK_Host>();
581581
const bool IsNVPTX = this->getToolChain().getTriple().isNVPTX();
582+
const bool IsAMDGCN = this->getToolChain().getTriple().isAMDGCN();
582583
const bool IsFPGA = this->getToolChain().getTriple().isSPIR() &&
583584
this->getToolChain().getTriple().getSubArch() ==
584585
llvm::Triple::SPIRSubArch_fpga;
@@ -598,6 +599,9 @@ const char *SYCL::Linker::constructLLVMLinkCommand(
598599
// NativeCPU links against libclc (libspirv)
599600
if (IsSYCLNativeCPU && InputFilename.contains("libspirv"))
600601
return true;
602+
// AMDGCN links against our libdevice (devicelib)
603+
if (IsAMDGCN && InputFilename.starts_with("devicelib-"))
604+
return true;
601605
// NVPTX links against our libclc (libspirv), our libdevice (devicelib),
602606
// and the CUDA libdevice
603607
if (IsNVPTX && (InputFilename.starts_with("devicelib-") ||

0 commit comments

Comments
 (0)