Skip to content

Commit 4320075

Browse files
author
Sergey Kanaev
committed
Merge remote-tracking branch 'public/sycl' into clear-ext-func-cache-on-context-release
2 parents d212fe7 + 979bf95 commit 4320075

Some content is hidden

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

47 files changed

+2703
-1125
lines changed

buildbot/dependency.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ ocl_cpu_rt_ver_win=2021.13.11.0.23
77
# https://github.com/intel/compute-runtime/releases/tag/21.46.21636
88
ocl_gpu_rt_ver=21.46.21636
99
# Same GPU driver supports Level Zero and OpenCL
10-
# https://downloadmirror.intel.com/685037/igfx_win_101.1069.zip
11-
ocl_gpu_rt_ver_win=30.0.101.1069
10+
# https://downloadmirror.intel.com/691496/igfx_win_101.1191.zip
11+
ocl_gpu_rt_ver_win=101.1191
1212
intel_sycl_ver=build
1313

1414
# TBB binaries can be built from sources following instructions under
@@ -25,13 +25,13 @@ ocl_fpga_emu_ver=2021.13.11.0.23
2525
ocl_fpga_emu_ver_win=2021.13.11.0.23
2626
fpga_ver=20211014_000004
2727
fpga_ver_win=20211014_000004
28-
ocloc_ver_win=27.20.100.9168
28+
ocloc_ver_win=101.1191
2929

3030
[DRIVER VERSIONS]
3131
cpu_driver_lin=2021.13.11.0.23
3232
cpu_driver_win=2021.13.11.0.23
3333
gpu_driver_lin=21.46.21636
34-
gpu_driver_win=30.0.101.1069
34+
gpu_driver_win=101.1191
3535
fpga_driver_lin=2021.13.11.0.23
3636
fpga_driver_win=2021.13.11.0.23
3737
# NVidia CUDA driver

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9021,7 +9021,7 @@ void SPIRVTranslator::ConstructJob(Compilation &C, const JobAction &JA,
90219021
std::string DefaultExtArg =
90229022
",+SPV_EXT_shader_atomic_float_add,+SPV_EXT_shader_atomic_float_min_max"
90239023
",+SPV_KHR_no_integer_wrap_decoration,+SPV_KHR_float_controls"
9024-
",+SPV_KHR_expect_assume";
9024+
",+SPV_KHR_expect_assume,+SPV_KHR_linkonce_odr";
90259025
std::string INTELExtArg =
90269026
",+SPV_INTEL_subgroups,+SPV_INTEL_media_block_io"
90279027
",+SPV_INTEL_device_side_avc_motion_estimation"

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -47,41 +47,6 @@ void SYCLInstallationDetector::print(llvm::raw_ostream &OS) const {
4747
}
4848
}
4949

50-
const char *SYCL::Linker::constructLLVMSpirvCommand(
51-
Compilation &C, const JobAction &JA, const InputInfo &Output,
52-
StringRef OutputFilePrefix, bool ToBc, const char *InputFileName) const {
53-
// Construct llvm-spirv command.
54-
// The output is a bc file or vice versa depending on the -r option usage
55-
// llvm-spirv -r -o a_kernel.bc a_kernel.spv
56-
// llvm-spirv -o a_kernel.spv a_kernel.bc
57-
ArgStringList CmdArgs;
58-
const char *OutputFileName = nullptr;
59-
if (ToBc) {
60-
std::string TmpName =
61-
C.getDriver().GetTemporaryPath(OutputFilePrefix.str() + "-spirv", "bc");
62-
OutputFileName = C.addTempFile(C.getArgs().MakeArgString(TmpName));
63-
CmdArgs.push_back("-r");
64-
CmdArgs.push_back("-o");
65-
CmdArgs.push_back(OutputFileName);
66-
} else {
67-
CmdArgs.push_back("-spirv-max-version=1.4");
68-
CmdArgs.push_back("-spirv-ext=+all");
69-
CmdArgs.push_back("-spirv-debug-info-version=ocl-100");
70-
CmdArgs.push_back("-spirv-allow-extra-diexpressions");
71-
CmdArgs.push_back("-spirv-allow-unknown-intrinsics=llvm.genx.");
72-
CmdArgs.push_back("-o");
73-
CmdArgs.push_back(Output.getFilename());
74-
}
75-
CmdArgs.push_back(InputFileName);
76-
77-
SmallString<128> LLVMSpirvPath(C.getDriver().Dir);
78-
llvm::sys::path::append(LLVMSpirvPath, "llvm-spirv");
79-
const char *LLVMSpirv = C.getArgs().MakeArgString(LLVMSpirvPath);
80-
C.addCommand(std::make_unique<Command>(
81-
JA, *this, ResponseFileSupport::AtFileUTF8(), LLVMSpirv, CmdArgs, None));
82-
return OutputFileName;
83-
}
84-
8550
static void addFPGATimingDiagnostic(std::unique_ptr<Command> &Cmd,
8651
Compilation &C) {
8752
const char *Msg = C.getArgs().MakeArgString(
@@ -343,22 +308,11 @@ void SYCL::Linker::ConstructJob(Compilation &C, const JobAction &JA,
343308
return;
344309
}
345310

346-
// We want to use llvm-spirv linker to link spirv binaries before putting
347-
// them into the fat object.
348-
// Each command outputs different files.
349311
InputInfoList SpirvInputs;
350312
for (const auto &II : Inputs) {
351313
if (!II.isFilename())
352314
continue;
353-
if (!Args.getLastArgValue(options::OPT_fsycl_device_obj_EQ)
354-
.equals_insensitive("spirv"))
355-
SpirvInputs.push_back(II);
356-
else {
357-
const char *LLVMSpirvOutputFile = constructLLVMSpirvCommand(
358-
C, JA, Output, Prefix, true, II.getFilename());
359-
SpirvInputs.push_back(InputInfo(types::TY_LLVM_BC, LLVMSpirvOutputFile,
360-
LLVMSpirvOutputFile));
361-
}
315+
SpirvInputs.push_back(II);
362316
}
363317

364318
constructLLVMLinkCommand(C, JA, Output, Args, SubArchName, Prefix,

clang/lib/Driver/ToolChains/SYCL.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
5454
const char *LinkingOutput) const override;
5555

5656
private:
57-
/// \return llvm-spirv output file name.
58-
const char *constructLLVMSpirvCommand(Compilation &C, const JobAction &JA,
59-
const InputInfo &Output,
60-
llvm::StringRef OutputFilePrefix,
61-
bool isBc, const char *InputFile) const;
6257
/// \return llvm-link output file name.
6358
const char *constructLLVMLinkCommand(Compilation &C, const JobAction &JA,
6459
const InputInfo &Output,

clang/test/Driver/sycl-spirv-ext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// CHECK-DEFAULT-SAME:,+SPV_EXT_shader_atomic_float_add
3030
// CHECK-DEFAULT-SAME:,+SPV_EXT_shader_atomic_float_min_max
3131
// CHECK-DEFAULT-SAME:,+SPV_KHR_no_integer_wrap_decoration,+SPV_KHR_float_controls
32-
// CHECK-DEFAULT-SAME:,+SPV_KHR_expect_assume
32+
// CHECK-DEFAULT-SAME:,+SPV_KHR_expect_assume,+SPV_KHR_linkonce_odr
3333
// CHECK-DEFAULT-SAME:,+SPV_INTEL_subgroups,+SPV_INTEL_media_block_io
3434
// CHECK-DEFAULT-SAME:,+SPV_INTEL_device_side_avc_motion_estimation
3535
// CHECK-DEFAULT-SAME:,+SPV_INTEL_fpga_loop_controls,+SPV_INTEL_fpga_memory_attributes

clang/test/Driver/sycl-spirv-obj.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@
3434
// SPIRV_DEVICE_OBJ_PHASES: 10: backend, {9}, assembler, (host-sycl)
3535
// SPIRV_DEVICE_OBJ_PHASES: 11: assembler, {10}, object, (host-sycl)
3636
// SPIRV_DEVICE_OBJ_PHASES: 12: clang-offload-bundler, {4, 11}, object, (host-sycl)
37+
38+
/// Use of -fsycl-device-obj=spirv should not be effective during linking
39+
// RUN: touch %t.o
40+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-device-obj=spirv -### %t.o 2>&1 | \
41+
// RUN: FileCheck %s -check-prefixes=OPT_WARNING,LLVM_SPIRV_R
42+
// OPT_WARNING: warning: argument unused during compilation: '-fsycl-device-obj=spirv'
43+
// LLVM_SPIRV_R: spirv-to-ir-wrapper{{.*}}
44+
// LLVM_SPIRV_R-NOT: llvm-spirv{{.*}} "-r"

devops/scripts/install_build_tools.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ apt update && apt install -yqq \
1212
python3-pip \
1313
zstd \
1414
ocl-icd-libopencl1 \
15-
vim
15+
vim \
16+
libffi-dev \
17+
libva-dev \
18+
libtool
1619

1720
pip3 install psutil
1821

libclc/amdgcn-amdhsa/libspirv/async/wait_group_events.cl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ _CLC_DEF void _Z23__spirv_GroupWaitEventsjiP9ocl_event(unsigned int scope,
1414
__spirv_ControlBarrier(scope, Workgroup, SequentiallyConsistent);
1515
}
1616

17+
_CLC_OVERLOAD _CLC_DEF void __spirv_GroupWaitEvents(unsigned int scope,
18+
int num_events,
19+
event_t *event_list) {
20+
__spirv_ControlBarrier(scope, Workgroup, SequentiallyConsistent);
21+
}
1722

llvm/lib/SYCLLowerIR/MutatePrintfAddrspace.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ size_t setFuncCallsOntoCASPrintf(Function *F, Function *CASPrintfFunc,
186186
FunctionVecTy &FunctionsToDrop) {
187187
size_t MutatedCallsCount = 0;
188188
SmallVector<std::pair<CallInst *, Constant *>, 16> CallsToMutate;
189+
FunctionVecTy WrapperFunctionsToDrop;
189190
for (User *U : F->users()) {
190191
if (!isa<CallInst>(U))
191192
continue;
@@ -225,13 +226,14 @@ size_t setFuncCallsOntoCASPrintf(Function *F, Function *CASPrintfFunc,
225226
}
226227
// We're certain that the wrapper won't have any uses, since we've just
227228
// marked all its calls for replacement with __spirv_ocl_printf.
228-
FunctionsToDrop.emplace_back(WrapperFunc);
229-
// Similar certainty for the generic AS version of __spirv_ocl_printf
230-
// itself - we've determined it only gets called inside the
231-
// soon-to-be-removed wrapper.
232-
assert(F->hasOneUse() && "Unexpected __spirv_ocl_printf call outside of "
233-
"SYCL wrapper function");
234-
FunctionsToDrop.emplace_back(F);
229+
WrapperFunctionsToDrop.emplace_back(WrapperFunc);
230+
// __spirv_ocl_printf itself only gets called inside the
231+
// soon-to-be-removed wrappers and will be marked for removal once these
232+
// are removed. The builtin may only have n>1 uses in case it's variadic -
233+
// in that scenario, all wrapper instances will be referencing it.
234+
assert((F->hasOneUse() || F->isVarArg()) &&
235+
"Unexpected __spirv_ocl_printf call outside of "
236+
"SYCL wrapper function");
235237
} else {
236238
emitError(
237239
F, CI,
@@ -246,6 +248,8 @@ size_t setFuncCallsOntoCASPrintf(Function *F, Function *CASPrintfFunc,
246248
CASPrintfFunc);
247249
++MutatedCallsCount;
248250
}
251+
for (Function *WF : WrapperFunctionsToDrop)
252+
WF->eraseFromParent();
249253
if (F->hasNUses(0))
250254
FunctionsToDrop.emplace_back(F);
251255
return MutatedCallsCount;

0 commit comments

Comments
 (0)