Skip to content

Commit 10816d2

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into newPM_reg_LowerWGLocalMemPass
2 parents 0382bf8 + 106882c commit 10816d2

40 files changed

+1924
-1108
lines changed

clang/lib/Basic/Targets/AMDGPU.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
328328
case OCLTK_Queue:
329329
case OCLTK_ReserveID:
330330
return LangAS::opencl_global;
331+
case OCLTK_Event:
332+
return LangAS::opencl_private;
331333

332334
default:
333335
return TargetInfo::getOpenCLTypeAddrSpace(TK);

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-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/SOURCES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
group/collectives.cl
3+
group/collectives_helpers.ll
14
atomic/loadstore_helpers.ll
25
cl_khr_int64_extended_atomics/minmax_helpers.ll
36
synchronization/barrier.cl
@@ -56,3 +59,4 @@ workitem/get_sub_group_id.cl
5659
workitem/get_sub_group_local_id.cl
5760
workitem/get_sub_group_size.cl
5861
misc/sub_group_shuffle.cl
62+
async/wait_group_events.cl
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include <spirv/spirv.h>
10+
11+
_CLC_DEF void _Z23__spirv_GroupWaitEventsjiP9ocl_event(unsigned int scope,
12+
int num_events,
13+
event_t __attribute__((address_space(0)))* event_list) {
14+
__spirv_ControlBarrier(scope, Workgroup, SequentiallyConsistent);
15+
}
16+
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+
}
22+

0 commit comments

Comments
 (0)