Skip to content

Commit 0b4b2cf

Browse files
committed
Merge branch 'sycl' into move_esimd_split
2 parents 59c4286 + 11e92b2 commit 0b4b2cf

File tree

245 files changed

+3052
-1736
lines changed

Some content is hidden

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

245 files changed

+3052
-1736
lines changed

.github/workflows/sycl-detect-changes.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ jobs:
6464
- devops/scripts/install_drivers.sh
6565
devigccfg:
6666
- devops/dependencies-igc-dev.json
67+
benchmarks:
68+
- 'devops/scripts/benchmarks/**'
6769
perf-tests:
6870
- sycl/test-e2e/PerformanceTests/**
6971
esimd:

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,28 @@ jobs:
167167
skip_run: ${{matrix.use_igc_dev && contains(github.event.pull_request.labels.*.name, 'ci-no-devigc') || 'false'}}
168168
env: ${{ matrix.env || (contains(needs.detect_changes.outputs.filters, 'esimd') && '{}' || '{"LIT_FILTER_OUT":"ESIMD/"}') }}
169169

170+
test_benchmark_scripts:
171+
needs: [build, detect_changes]
172+
if: |
173+
always() && !cancelled()
174+
&& needs.build.outputs.build_conclusion == 'success'
175+
&& contains(needs.detect_changes.outputs.filters, 'benchmarks')
176+
uses: ./.github/workflows/sycl-linux-run-tests.yml
177+
with:
178+
name: Benchmark suite precommit testing
179+
runner: '["PVC_PERF"]'
180+
image: ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest
181+
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
182+
target_devices: 'level_zero:gpu'
183+
tests_selector: benchmarks
184+
benchmark_upload_results: false
185+
benchmark_preset: 'Minimal'
186+
benchmark_dry_run: true
187+
repo_ref: ${{ github.sha }}
188+
sycl_toolchain_artifact: sycl_linux_default
189+
sycl_toolchain_archive: ${{ needs.build.outputs.artifact_archive_name }}
190+
sycl_toolchain_decompress_command: ${{ needs.build.outputs.artifact_decompress_command }}
191+
170192
test-perf:
171193
needs: [build, detect_changes]
172194
if: |

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ on:
132132
type: string
133133
default: 'Minimal'
134134
required: False
135+
benchmark_dry_run:
136+
description: |
137+
Whether or not to fail the workflow upon a regression.
138+
type: string
139+
default: 'false'
140+
required: False
135141

136142
workflow_dispatch:
137143
inputs:
@@ -335,6 +341,7 @@ jobs:
335341
upload_results: ${{ inputs.benchmark_upload_results }}
336342
save_name: ${{ inputs.benchmark_save_name }}
337343
preset: ${{ inputs.benchmark_preset }}
344+
dry_run: ${{ inputs.benchmark_dry_run }}
338345
env:
339346
RUNNER_TAG: ${{ inputs.runner }}
340347
GITHUB_TOKEN: ${{ secrets.LLVM_SYCL_BENCHMARK_TOKEN }}

clang/lib/Driver/Driver.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7748,9 +7748,17 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
77487748
return HostAction;
77497749
}
77507750

7751+
// For SYCL offloading with -fsycl-host-compiler enabled, we do not have the
7752+
// ability to embed the packaged file.
7753+
bool SYCLBundleFile = C.isOffloadingHostKind(Action::OFK_SYCL) &&
7754+
Args.hasArg(options::OPT_fsycl_host_compiler_EQ) &&
7755+
isa<AssembleJobAction>(HostAction);
7756+
77517757
// Don't build offloading actions if we do not have a compile action. If
7752-
// preprocessing only ignore embedding.
7753-
if (!(isa<CompileJobAction>(HostAction) ||
7758+
// preprocessing only ignore embedding. When needing to do bundling for
7759+
// SYCL, allow the building of offloading actions to add the device side to
7760+
// the bundle.
7761+
if (!(isa<CompileJobAction>(HostAction) || SYCLBundleFile ||
77547762
getFinalPhase(Args) == phases::Preprocess))
77557763
return HostAction;
77567764

@@ -7888,6 +7896,17 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
78887896
tools::SYCL::populateSYCLDeviceTraitsMacrosArgs(C, Args, TCAndArchs);
78897897
}
78907898

7899+
// Now that we have all of the offload actions populated, we special case
7900+
// SYCL -fsycl-host-compiler to perform a bundling action instead of a
7901+
// packaging action.
7902+
if (SYCLBundleFile) {
7903+
ActionList BundlingActions(OffloadActions);
7904+
BundlingActions.push_back(HostAction);
7905+
Action *BundlingAction =
7906+
C.MakeAction<OffloadBundlingJobAction>(BundlingActions);
7907+
return BundlingAction;
7908+
}
7909+
78917910
// HIP code in device-only non-RDC mode will bundle the output if it invoked
78927911
// the linker.
78937912
bool ShouldBundleHIP =
@@ -7933,6 +7952,11 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
79337952
DDep.add(*LinkAction, *C.getSingleOffloadToolChain<Action::OFK_Host>(),
79347953
nullptr, C.getActiveOffloadKinds());
79357954
return C.MakeAction<OffloadAction>(DDep, types::TY_Nothing);
7955+
} else if (C.isOffloadingHostKind(Action::OFK_SYCL) &&
7956+
Args.hasArg(options::OPT_fsycl_host_compiler_EQ)) {
7957+
// -fsycl-host-compiler will create a bundled object instead of an
7958+
// embedded packaged object. Effectively avoid doing the packaging.
7959+
return HostAction;
79367960
} else {
79377961
// Package all the offloading actions into a single output that can be
79387962
// embedded in the host and linked.

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5428,19 +5428,13 @@ static void ProcessVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
54285428
// Add SYCL dependent library
54295429
if (Args.hasArg(options::OPT_fsycl) &&
54305430
!Args.hasArg(options::OPT_nolibsycl)) {
5431-
if (RTOptionID == options::OPT__SLASH_MDd) {
5432-
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
5433-
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION
5434-
"-previewd");
5435-
else
5436-
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION "d");
5437-
} else {
5438-
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
5439-
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION
5440-
"-preview");
5441-
else
5442-
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION);
5443-
}
5431+
SmallString<128> SYCLLibName("sycl" SYCL_MAJOR_VERSION);
5432+
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
5433+
SYCLLibName += "-preview";
5434+
if (RTOptionID == options::OPT__SLASH_MDd)
5435+
SYCLLibName += "d";
5436+
CmdArgs.push_back(
5437+
Args.MakeArgString(Twine("--dependent-lib=") + SYCLLibName));
54445438
CmdArgs.push_back("--dependent-lib=sycl-devicelib-host");
54455439
}
54465440
}
@@ -7044,11 +7038,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
70447038
// Add the sycld debug library when --dependent-lib=msvcrtd is used from
70457039
// the command line. This is to allow for CMake based builds using the
70467040
// Linux based driver on Windows to correctly pull in the expected debug
7047-
// library.
7041+
// library. Do not add when -fms-runtime-lib is used, as that pulls in the
7042+
// libraries separately.
70487043
if (Args.hasArg(options::OPT_fsycl) && !Args.hasArg(options::OPT_nolibsycl) &&
70497044
!D.IsCLMode()) {
70507045
if (TC.getTriple().isWindowsMSVCEnvironment()) {
7051-
if (isDependentLibAdded(Args, "msvcrtd")) {
7046+
if (isDependentLibAdded(Args, "msvcrtd") &&
7047+
!Args.hasArg(options::OPT_fms_runtime_lib_EQ)) {
70527048
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
70537049
CmdArgs.push_back("--dependent-lib=sycl" SYCL_MAJOR_VERSION
70547050
"-previewd");

clang/lib/Driver/ToolChains/Cuda.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,20 @@ void CudaToolChain::AddIAMCUIncludeArgs(const ArgList &Args,
11621162
HostTC.AddIAMCUIncludeArgs(Args, CC1Args);
11631163
}
11641164

1165+
llvm::SmallVector<ToolChain::BitCodeLibraryInfo, 12>
1166+
CudaToolChain::getDeviceLibs(
1167+
const llvm::opt::ArgList &DriverArgs,
1168+
const Action::OffloadKind DeviceOffloadingKind) const {
1169+
StringRef GpuArch = DriverArgs.getLastArgValue(options::OPT_march_EQ);
1170+
std::string LibDeviceFile = CudaInstallation.getLibDeviceFile(GpuArch);
1171+
if (LibDeviceFile.empty()) {
1172+
getDriver().Diag(diag::err_drv_no_cuda_libdevice) << GpuArch;
1173+
return {};
1174+
}
1175+
1176+
return {BitCodeLibraryInfo{LibDeviceFile}};
1177+
}
1178+
11651179
SanitizerMask CudaToolChain::getSupportedSanitizers() const {
11661180
// The CudaToolChain only supports sanitizers in the sense that it allows
11671181
// sanitizer arguments on the command line if they are supported by the host

clang/lib/Driver/ToolChains/Cuda.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ class LLVM_LIBRARY_VISIBILITY CudaToolChain : public NVPTXToolChain {
248248
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
249249
llvm::opt::ArgStringList &CC1Args) const override;
250250

251+
llvm::SmallVector<BitCodeLibraryInfo, 12>
252+
getDeviceLibs(const llvm::opt::ArgList &Args,
253+
const Action::OffloadKind DeviceOffloadingKind) const override;
254+
251255
SanitizerMask getSupportedSanitizers() const override;
252256

253257
VersionTuple

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,12 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
9999
Args.hasArg(options::OPT_fsycl_host_compiler_EQ)) {
100100
CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") +
101101
TC.getDriver().Dir + "/../lib"));
102-
// When msvcrtd is added via --dependent-lib, we add the sycld
103-
// equivalent. Do not add the -defaultlib as it conflicts.
104-
if (!isDependentLibAdded(Args, "msvcrtd")) {
102+
// When msvcrtd is added via --dependent-lib or -fms-runtime-lib=dll_dbg we
103+
// add the sycld equivalent. Do not add the -defaultlib as it conflicts.
104+
StringRef RuntimeVal;
105+
if (const Arg *A = Args.getLastArg(options::OPT_fms_runtime_lib_EQ))
106+
RuntimeVal = A->getValue();
107+
if (!isDependentLibAdded(Args, "msvcrtd") && RuntimeVal != "dll_dbg") {
105108
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
106109
CmdArgs.push_back("-defaultlib:sycl" SYCL_MAJOR_VERSION "-preview.lib");
107110
else
File renamed without changes.

0 commit comments

Comments
 (0)