Skip to content

Commit 8c29ad5

Browse files
committed
Address a few review comments
- Use spirv32/spirv64 as default triple arch - clean up a number of comments - Fix file ordering inclusion to be alphabetical
1 parent 47cc846 commit 8c29ad5

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

clang/lib/Driver/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ add_clang_library(clangDriver
7777
ToolChains/RISCVToolchain.cpp
7878
ToolChains/Solaris.cpp
7979
ToolChains/SPIRV.cpp
80+
ToolChains/SYCL.cpp
8081
ToolChains/TCE.cpp
8182
ToolChains/VEToolchain.cpp
8283
ToolChains/WebAssembly.cpp
@@ -85,7 +86,6 @@ add_clang_library(clangDriver
8586
ToolChains/PPCFreeBSD.cpp
8687
ToolChains/InterfaceStubs.cpp
8788
ToolChains/ZOS.cpp
88-
ToolChains/SYCL.cpp
8989
Types.cpp
9090
XRayArgs.cpp
9191

clang/lib/Driver/Driver.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,10 @@ Driver::OpenMPRuntimeKind Driver::getOpenMPRuntime(const ArgList &Args) const {
769769
}
770770

771771
static const char *getDefaultSYCLArch(Compilation &C) {
772+
// If -fsycl is supplied we will assume SPIR-V
772773
if (C.getDefaultToolChain().getTriple().getArch() == llvm::Triple::x86)
773-
return "spir";
774-
return "spir64";
774+
return "spirv32";
775+
return "spirv64";
775776
}
776777

777778
static bool addSYCLDefaultTriple(Compilation &C,
@@ -1004,7 +1005,6 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
10041005
// SYCL
10051006
//
10061007
// We need to generate a SYCL toolchain if the user specified -fsycl.
1007-
// If -fsycl is supplied we will assume SPIR-V.
10081008
bool IsSYCL =
10091009
C.getInputArgs().hasFlag(options::OPT_fsycl, options::OPT_fno_sycl,
10101010
false);
@@ -1023,7 +1023,6 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
10231023

10241024
llvm::SmallVector<llvm::Triple, 4> UniqueSYCLTriplesVec;
10251025

1026-
// If -fsycl is supplied we will assume SPIR-V.
10271026
if (IsSYCL) {
10281027
addSYCLDefaultTriple(C, UniqueSYCLTriplesVec);
10291028

@@ -6635,7 +6634,6 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
66356634
break;
66366635
}
66376636
case Action::OFK_SYCL:
6638-
// TODO: Add additional Arch values for Ahead of Time support for SYCL.
66396637
switch (Target.getArch()) {
66406638
case llvm::Triple::spir:
66416639
case llvm::Triple::spir64:

clang/test/Driver/sycl-offload-jit.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
// RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu \
77
// RUN: -fsycl %s 2>&1 \
88
// RUN: | FileCheck -check-prefixes=CHK-PHASES %s
9-
// RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fsycl \
10-
// RUN: %s 2>&1 \
11-
// RUN: | FileCheck -check-prefixes=CHK-PHASES %s
129
// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl \
1310
// RUN: %s 2>&1 \
1411
// RUN: | FileCheck -check-prefixes=CHK-PHASES %s
@@ -19,7 +16,7 @@
1916
// CHK-PHASES: 4: preprocessor, {3}, c++-cpp-output, (device-sycl)
2017
// CHK-PHASES: 5: compiler, {4}, ir, (device-sycl)
2118
// CHK-PHASES: 6: backend, {5}, ir, (device-sycl)
22-
// CHK-PHASES: 7: offload, "device-sycl (spir64-unknown-unknown)" {6}, ir
19+
// CHK-PHASES: 7: offload, "device-sycl (spirv64-unknown-unknown)" {6}, ir
2320
// CHK-PHASES: 8: clang-offload-packager, {7}, image, (device-sycl)
2421
// CHK-PHASES: 9: offload, "host-sycl (x86_64{{.*}})" {2}, "device-sycl (x86_64{{.*}})" {8}, ir
2522
// CHK-PHASES: 10: backend, {9}, assembler, (host-sycl)
@@ -30,11 +27,11 @@
3027
/// well as clang-offload-packager inputs.
3128
// RUN: %clang -### -fsycl -c --target=x86_64-unknown-linux-gnu %s 2>&1 \
3229
// RUN: | FileCheck -check-prefix=CHK-DEVICE-TRIPLE %s
33-
// CHK-DEVICE-TRIPLE: clang{{.*}} "-triple" "spir64-unknown-unknown"
30+
// CHK-DEVICE-TRIPLE: clang{{.*}} "-triple" "spirv64-unknown-unknown"
3431
// CHK-DEVICE-TRIPLE-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
3532
// CHK-DEVICE-TRIPLE-SAME: "-fsycl-is-device"
3633
// CHK-DEVICE-TRIPLE-SAME: "-O2"
37-
// CHK-DEVICE-TRIPLE: clang-offload-packager{{.*}} "--image=file={{.*}}.bc,triple=spir64-unknown-unknown,arch=,kind=sycl"
34+
// CHK-DEVICE-TRIPLE: clang-offload-packager{{.*}} "--image=file={{.*}}.bc,triple=spirv64-unknown-unknown,arch=,kind=sycl"
3835

3936
/// Check -fsycl-is-device is passed when compiling for the device.
4037
/// Check -fsycl-is-host is passed when compiling for host.

llvm/include/llvm/TargetParser/Triple.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -831,11 +831,7 @@ class Triple {
831831
getArch() == Triple::spirv;
832832
}
833833

834-
// Tests whether the target is SPIR-V or SPIR. Currently, we use spir-based
835-
// target triples to represent JIT compilation targets for SYCL. We will
836-
// transition to using spir-v based target triples to represent JIT
837-
// compilation targets for SYCL very soon. This helper function is used
838-
// (instead of isSPIR) to ease that transition.
834+
// Tests whether the target is SPIR-V or SPIR.
839835
bool isSPIROrSPIRV() const { return isSPIR() || isSPIRV(); }
840836

841837
/// Tests whether the target is SPIR-V Logical

0 commit comments

Comments
 (0)