Skip to content

Commit 2fba015

Browse files
Add offload-arch support for SYCL.
1 parent 96bce40 commit 2fba015

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
11851185
llvm::StringMap<llvm::DenseSet<StringRef>> DerivedArchs;
11861186
llvm::StringMap<StringRef> FoundNormalizedTriples;
11871187
llvm::SmallVector<llvm::Triple, 4> UniqueSYCLTriplesVec;
1188+
// StringSet to contain SYCL target triples.
11881189
llvm::StringSet<> SYCLTriples;
11891190
if (HasSYCLTargetsOption) {
11901191
// At this point, we know we have a valid combination
@@ -1299,7 +1300,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
12991300
else if (HasValidSYCLRuntime &&
13001301
C.getInputArgs().hasArg(options::OPT_offload_arch_EQ) && !IsHIP &&
13011302
!IsCuda) {
1302-
// SYCL offloading to Intel CPUs and Intel GPUs with ``--offload-arch``
1303+
// SYCL offloading to AOT Targets with ``--offload-arch``
13031304
// is currently enabled only with ``--offload-new-driver`` option.
13041305
// Emit a diagnostic if ``--offload-arch`` is invoked without
13051306
// ``--offload-new driver`` option.
@@ -1371,8 +1372,6 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
13711372
llvm::Triple SYCLTargetTriple(MakeSYCLDeviceTriple(Val.getKey()));
13721373
std::string NormalizedName = SYCLTargetTriple.normalize();
13731374

1374-
1375-
13761375
// Make sure we don't have a duplicate triple.
13771376
auto Duplicate = FoundNormalizedTriples.find(NormalizedName);
13781377
if (Duplicate != FoundNormalizedTriples.end()) {

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ using namespace clang;
2828
using namespace llvm::opt;
2929

3030
// Struct that relates an AOT target value with
31-
// Intel CPUs and GPUs.
31+
// Intel CPUs, Intel GPUs, AMD and NVidia GPUs.
3232
struct StringToOffloadArchSYCLMap {
3333
const char *ArchName;
3434
SYCLSupportedOffloadArchs IntelArch;
@@ -151,7 +151,7 @@ static const StringToOffloadArchSYCLMap StringToArchNamesMap[] = {
151151
{"sm_90a", SYCLSupportedOffloadArchs::SM_90A}};
152152

153153
// Check if the user provided value for --offload-arch is a valid
154-
// Intel CPU or Intel GPU target.
154+
// SYCL supported AOT target.
155155
SYCLSupportedOffloadArchs
156156
clang::driver::StringToOffloadArchSYCL(llvm::StringRef ArchNameAsString) {
157157
auto result = std::find_if(

clang/lib/Driver/ToolChains/SYCL.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,20 @@ IsSYCLSupportedNVidiaGPUArch(SYCLSupportedOffloadArchs Arch) {
147147
Arch <= SYCLSupportedOffloadArchs::SM_90A;
148148
}
149149

150-
// Check if the given Arch value is a valid Intel CPU.
150+
// Check if the given Arch value is a valid SYCL supported Intel CPU.
151151
static inline bool IsSYCLSupportedIntelCPUArch(SYCLSupportedOffloadArchs Arch) {
152152
return Arch >= SYCLSupportedOffloadArchs::SKYLAKEAVX512 &&
153153
Arch < SYCLSupportedOffloadArchs::BDW;
154154
}
155155

156-
// Check if the given Arch value is a valid Intel GPU.
156+
// Check if the given Arch value is a valid SYCL supported Intel GPU.
157157
static inline bool IsSYCLSupportedIntelGPUArch(SYCLSupportedOffloadArchs Arch) {
158158
return Arch >= SYCLSupportedOffloadArchs::BDW &&
159159
Arch <= SYCLSupportedOffloadArchs::LNL_M;
160160
}
161161

162162
// Check if the user provided value for --offload-arch is a valid
163-
// Intel CPU or Intel GPU target.
163+
// SYCL supported AOT target.
164164
SYCLSupportedOffloadArchs
165165
StringToOffloadArchSYCL(llvm::StringRef ArchNameAsString);
166166

0 commit comments

Comments
 (0)