Skip to content

Commit 4452bc1

Browse files
authored
[SYCL] Add missing supported AMDGPU architectures to SYCL (#15723)
The three added `gfx7` architectures were previously omitted from the list of supported ones for SYCL targeting AMDGPU. There is no rational for them to be excluded rather than a potential mistake when all the rest were added, so this PR adds them in. All of these exactly match the LLVM AMDGPU support docs here: https://llvm.org/docs/AMDGPUUsage.html#processors. This also makes reusing the current `OffloadArch` enum in clang Driver easier with no concern of whether we have to filter these out for SYCL.
1 parent eded703 commit 4452bc1

File tree

10 files changed

+80
-5
lines changed

10 files changed

+80
-5
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,9 @@ StringRef SYCL::gen::resolveGenDevice(StringRef DeviceName) {
13281328
.Case("amd_gpu_gfx700", "gfx700")
13291329
.Case("amd_gpu_gfx701", "gfx701")
13301330
.Case("amd_gpu_gfx702", "gfx702")
1331+
.Case("amd_gpu_gfx703", "gfx703")
1332+
.Case("amd_gpu_gfx704", "gfx704")
1333+
.Case("amd_gpu_gfx705", "gfx705")
13311334
.Case("amd_gpu_gfx801", "gfx801")
13321335
.Case("amd_gpu_gfx802", "gfx802")
13331336
.Case("amd_gpu_gfx803", "gfx803")
@@ -1415,6 +1418,9 @@ SmallString<64> SYCL::gen::getGenDeviceMacro(StringRef DeviceName) {
14151418
.Case("gfx700", "AMD_GPU_GFX700")
14161419
.Case("gfx701", "AMD_GPU_GFX701")
14171420
.Case("gfx702", "AMD_GPU_GFX702")
1421+
.Case("gfx703", "AMD_GPU_GFX703")
1422+
.Case("gfx704", "AMD_GPU_GFX704")
1423+
.Case("gfx705", "AMD_GPU_GFX705")
14181424
.Case("gfx801", "AMD_GPU_GFX801")
14191425
.Case("gfx802", "AMD_GPU_GFX802")
14201426
.Case("gfx803", "AMD_GPU_GFX803")

clang/test/Driver/sycl-device-traits-macros-amdgcn.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx702 \
1010
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
1111
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
12+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx703 \
13+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
14+
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
15+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx704 \
16+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
17+
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
18+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx705 \
19+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
20+
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
1221
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx801 \
1322
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
1423
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
@@ -120,6 +129,15 @@
120129
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx702 \
121130
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
122131
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH
132+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx703 \
133+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
134+
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH
135+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx704 \
136+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
137+
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH
138+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx705 \
139+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
140+
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH
123141
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx801 \
124142
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
125143
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH

clang/test/Driver/sycl-oneapi-gpu-amdgpu.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx702 \
1010
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
1111
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx702 -DMAC_STR=GFX702
12+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx703 \
13+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
14+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx703 -DMAC_STR=GFX703
15+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx704 \
16+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
17+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx704 -DMAC_STR=GFX704
18+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx705 \
19+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
20+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx705 -DMAC_STR=GFX705
1221
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx801 \
1322
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
1423
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx801 -DMAC_STR=GFX801

llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ def : HipTargetInfo<"amd_gpu_gfx906", !listconcat(HipMinAspects, AllUSMAspects),
320320
def : HipTargetInfo<"amd_gpu_gfx700", HipMinAspects, HipSubgroupSizesGCN2>;
321321
def : HipTargetInfo<"amd_gpu_gfx701", HipMinAspects, HipSubgroupSizesGCN2>;
322322
def : HipTargetInfo<"amd_gpu_gfx702", HipMinAspects, HipSubgroupSizesGCN2>;
323+
def : HipTargetInfo<"amd_gpu_gfx703", HipMinAspects, HipSubgroupSizesGCN2>;
324+
def : HipTargetInfo<"amd_gpu_gfx704", HipMinAspects, HipSubgroupSizesGCN2>;
325+
def : HipTargetInfo<"amd_gpu_gfx705", HipMinAspects, HipSubgroupSizesGCN2>;
323326
def : HipTargetInfo<"amd_gpu_gfx801", HipMinAspects, HipSubgroupSizesGCN3>;
324327
def : HipTargetInfo<"amd_gpu_gfx802", HipMinAspects, HipSubgroupSizesGCN3>;
325328
def : HipTargetInfo<"amd_gpu_gfx803", HipMinAspects, HipSubgroupSizesGCN3>;

sycl/doc/UsersManual.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ and not recommended to use in production environment.
9595
* amd_gpu_gfx700 - AMD GCN GFX7 (Sea Islands (CI)) architecture
9696
* amd_gpu_gfx701 - AMD GCN GFX7 (Sea Islands (CI)) architecture
9797
* amd_gpu_gfx702 - AMD GCN GFX7 (Sea Islands (CI)) architecture
98+
* amd_gpu_gfx703 - AMD GCN GFX7 (Sea Islands (CI)) architecture
99+
* amd_gpu_gfx704 - AMD GCN GFX7 (Sea Islands (CI)) architecture
100+
* amd_gpu_gfx705 - AMD GCN GFX7 (Sea Islands (CI)) architecture
98101
* amd_gpu_gfx801 - AMD GCN GFX8 (Volcanic Islands (VI)) architecture
99102
* amd_gpu_gfx802 - AMD GCN GFX8 (Volcanic Islands (VI)) architecture
100103
* amd_gpu_gfx803 - AMD GCN GFX8 (Volcanic Islands (VI)) architecture
@@ -104,13 +107,13 @@ and not recommended to use in production environment.
104107
* amd_gpu_gfx902 - AMD GCN GFX9 (Vega) architecture
105108
* amd_gpu_gfx904 - AMD GCN GFX9 (Vega) architecture
106109
* amd_gpu_gfx906 - AMD GCN GFX9 (Vega) architecture
107-
* amd_gpu_gfx908 - AMD GCN GFX9 (Vega) architecture
110+
* amd_gpu_gfx908 - AMD GCN GFX9 (CDNA1) architecture
108111
* amd_gpu_gfx909 - AMD GCN GFX9 (Vega) architecture
109-
* amd_gpu_gfx90a - AMD GCN GFX9 (Vega) architecture
112+
* amd_gpu_gfx90a - AMD GCN GFX9 (CDNA2) architecture
110113
* amd_gpu_gfx90c - AMD GCN GFX9 (Vega) architecture
111-
* amd_gpu_gfx940 - AMD GCN GFX9 (Vega) architecture
112-
* amd_gpu_gfx941 - AMD GCN GFX9 (Vega) architecture
113-
* amd_gpu_gfx942 - AMD GCN GFX9 (Vega) architecture
114+
* amd_gpu_gfx940 - AMD GCN GFX9 (CDNA3) architecture
115+
* amd_gpu_gfx941 - AMD GCN GFX9 (CDNA3) architecture
116+
* amd_gpu_gfx942 - AMD GCN GFX9 (CDNA3) architecture
114117
* amd_gpu_gfx1010 - AMD GCN GFX10.1 (RDNA 1) architecture
115118
* amd_gpu_gfx1011 - AMD GCN GFX10.1 (RDNA 1) architecture
116119
* amd_gpu_gfx1012 - AMD GCN GFX10.1 (RDNA 1) architecture

sycl/doc/design/DeviceIf.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ recognizes:
8888
* `amd_gpu_gfx700`
8989
* `amd_gpu_gfx701`
9090
* `amd_gpu_gfx702`
91+
* `amd_gpu_gfx703`
92+
* `amd_gpu_gfx704`
93+
* `amd_gpu_gfx705`
9194
* `amd_gpu_gfx801`
9295
* `amd_gpu_gfx802`
9396
* `amd_gpu_gfx803`
@@ -187,6 +190,9 @@ one of the following corresponding C++ macro names:
187190
* `__SYCL_TARGET_AMD_GPU_GFX700__`
188191
* `__SYCL_TARGET_AMD_GPU_GFX701__`
189192
* `__SYCL_TARGET_AMD_GPU_GFX702__`
193+
* `__SYCL_TARGET_AMD_GPU_GFX703__`
194+
* `__SYCL_TARGET_AMD_GPU_GFX704__`
195+
* `__SYCL_TARGET_AMD_GPU_GFX705__`
190196
* `__SYCL_TARGET_AMD_GPU_GFX801__`
191197
* `__SYCL_TARGET_AMD_GPU_GFX802__`
192198
* `__SYCL_TARGET_AMD_GPU_GFX803__`

sycl/doc/extensions/experimental/sycl_ext_oneapi_device_architecture.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,9 @@ a|
551551
amd_gpu_gfx700
552552
amd_gpu_gfx701
553553
amd_gpu_gfx702
554+
amd_gpu_gfx703
555+
amd_gpu_gfx704
556+
amd_gpu_gfx705
554557
----
555558
|-
556559
|AMD GCN 2.0 architecture.

sycl/include/sycl/ext/oneapi/experimental/architectures.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ __SYCL_ARCHITECTURE(nvidia_gpu_sm_90a, 0x01000000000090a0)
114114
__SYCL_ARCHITECTURE(amd_gpu_gfx700, 0x0200000000070000)
115115
__SYCL_ARCHITECTURE(amd_gpu_gfx701, 0x0200000000070100)
116116
__SYCL_ARCHITECTURE(amd_gpu_gfx702, 0x0200000000070200)
117+
__SYCL_ARCHITECTURE(amd_gpu_gfx703, 0x0200000000070300)
118+
__SYCL_ARCHITECTURE(amd_gpu_gfx704, 0x0200000000070400)
119+
__SYCL_ARCHITECTURE(amd_gpu_gfx705, 0x0200000000070500)
117120
__SYCL_ARCHITECTURE(amd_gpu_gfx801, 0x0200000000080100)
118121
__SYCL_ARCHITECTURE(amd_gpu_gfx802, 0x0200000000080200)
119122
__SYCL_ARCHITECTURE(amd_gpu_gfx803, 0x0200000000080300)

sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ static constexpr ext::oneapi::experimental::architecture
203203
#ifndef __SYCL_TARGET_AMD_GPU_GFX702__
204204
#define __SYCL_TARGET_AMD_GPU_GFX702__ 0
205205
#endif
206+
#ifndef __SYCL_TARGET_AMD_GPU_GFX703__
207+
#define __SYCL_TARGET_AMD_GPU_GFX703__ 0
208+
#endif
209+
#ifndef __SYCL_TARGET_AMD_GPU_GFX704__
210+
#define __SYCL_TARGET_AMD_GPU_GFX704__ 0
211+
#endif
212+
#ifndef __SYCL_TARGET_AMD_GPU_GFX705__
213+
#define __SYCL_TARGET_AMD_GPU_GFX705__ 0
214+
#endif
206215
#ifndef __SYCL_TARGET_AMD_GPU_GFX801__
207216
#define __SYCL_TARGET_AMD_GPU_GFX801__ 0
208217
#endif
@@ -360,6 +369,9 @@ static constexpr bool is_allowable_aot_mode =
360369
(__SYCL_TARGET_AMD_GPU_GFX700__ == 1) ||
361370
(__SYCL_TARGET_AMD_GPU_GFX701__ == 1) ||
362371
(__SYCL_TARGET_AMD_GPU_GFX702__ == 1) ||
372+
(__SYCL_TARGET_AMD_GPU_GFX703__ == 1) ||
373+
(__SYCL_TARGET_AMD_GPU_GFX704__ == 1) ||
374+
(__SYCL_TARGET_AMD_GPU_GFX705__ == 1) ||
363375
(__SYCL_TARGET_AMD_GPU_GFX801__ == 1) ||
364376
(__SYCL_TARGET_AMD_GPU_GFX802__ == 1) ||
365377
(__SYCL_TARGET_AMD_GPU_GFX803__ == 1) ||
@@ -538,6 +550,15 @@ get_current_architecture_aot() {
538550
#if __SYCL_TARGET_AMD_GPU_GFX702__
539551
return ext::oneapi::experimental::architecture::amd_gpu_gfx702;
540552
#endif
553+
#if __SYCL_TARGET_AMD_GPU_GFX703__
554+
return ext::oneapi::experimental::architecture::amd_gpu_gfx703;
555+
#endif
556+
#if __SYCL_TARGET_AMD_GPU_GFX704__
557+
return ext::oneapi::experimental::architecture::amd_gpu_gfx704;
558+
#endif
559+
#if __SYCL_TARGET_AMD_GPU_GFX705__
560+
return ext::oneapi::experimental::architecture::amd_gpu_gfx705;
561+
#endif
541562
#if __SYCL_TARGET_AMD_GPU_GFX801__
542563
return ext::oneapi::experimental::architecture::amd_gpu_gfx801;
543564
#endif

sycl/source/detail/device_info.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,9 @@ constexpr std::pair<const char *, oneapi_exp_arch> NvidiaAmdGPUArchitectures[] =
626626
{"9.0", oneapi_exp_arch::nvidia_gpu_sm_90},
627627
{"gfx701", oneapi_exp_arch::amd_gpu_gfx701},
628628
{"gfx702", oneapi_exp_arch::amd_gpu_gfx702},
629+
{"gfx703", oneapi_exp_arch::amd_gpu_gfx703},
630+
{"gfx704", oneapi_exp_arch::amd_gpu_gfx704},
631+
{"gfx705", oneapi_exp_arch::amd_gpu_gfx705},
629632
{"gfx801", oneapi_exp_arch::amd_gpu_gfx801},
630633
{"gfx802", oneapi_exp_arch::amd_gpu_gfx802},
631634
{"gfx803", oneapi_exp_arch::amd_gpu_gfx803},

0 commit comments

Comments
 (0)