Skip to content

Commit

Permalink
[SYCL] Add missing supported AMDGPU architectures to SYCL
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeWeb committed Oct 16, 2024
1 parent 5f6af0b commit 5d7468d
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 5 deletions.
6 changes: 6 additions & 0 deletions clang/lib/Driver/ToolChains/SYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,9 @@ StringRef SYCL::gen::resolveGenDevice(StringRef DeviceName) {
.Case("amd_gpu_gfx700", "gfx700")
.Case("amd_gpu_gfx701", "gfx701")
.Case("amd_gpu_gfx702", "gfx702")
.Case("amd_gpu_gfx703", "gfx703")
.Case("amd_gpu_gfx704", "gfx704")
.Case("amd_gpu_gfx705", "gfx705")
.Case("amd_gpu_gfx801", "gfx801")
.Case("amd_gpu_gfx802", "gfx802")
.Case("amd_gpu_gfx803", "gfx803")
Expand Down Expand Up @@ -1294,6 +1297,9 @@ SmallString<64> SYCL::gen::getGenDeviceMacro(StringRef DeviceName) {
.Case("gfx700", "AMD_GPU_GFX700")
.Case("gfx701", "AMD_GPU_GFX701")
.Case("gfx702", "AMD_GPU_GFX702")
.Case("gfx703", "AMD_GPU_GFX703")
.Case("gfx704", "AMD_GPU_GFX704")
.Case("gfx705", "AMD_GPU_GFX705")
.Case("gfx801", "AMD_GPU_GFX801")
.Case("gfx802", "AMD_GPU_GFX802")
.Case("gfx803", "AMD_GPU_GFX803")
Expand Down
18 changes: 18 additions & 0 deletions clang/test/Driver/sycl-device-traits-macros-amdgcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx702 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx703 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx704 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx705 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx801 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-DEVICE-TRIPLE
Expand Down Expand Up @@ -120,6 +129,15 @@
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx702 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx703 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx704 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx705 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx801 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK-SYCL-AMDGCN-AMD-AMDHSA-OFFLOAD-ARCH
Expand Down
9 changes: 9 additions & 0 deletions clang/test/Driver/sycl-oneapi-gpu-amdgpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx702 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx702 -DMAC_STR=GFX702
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx703 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx702 -DMAC_STR=GFX703
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx704 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx702 -DMAC_STR=GFX704
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx705 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx702 -DMAC_STR=GFX705
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx801 \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx801 -DMAC_STR=GFX801
Expand Down
3 changes: 3 additions & 0 deletions llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ def : HipTargetInfo<"amd_gpu_gfx906", !listconcat(HipMinAspects, AllUSMAspects),
def : HipTargetInfo<"amd_gpu_gfx700", HipMinAspects, HipSubgroupSizesGCN2>;
def : HipTargetInfo<"amd_gpu_gfx701", HipMinAspects, HipSubgroupSizesGCN2>;
def : HipTargetInfo<"amd_gpu_gfx702", HipMinAspects, HipSubgroupSizesGCN2>;
def : HipTargetInfo<"amd_gpu_gfx703", HipMinAspects, HipSubgroupSizesGCN2>;
def : HipTargetInfo<"amd_gpu_gfx704", HipMinAspects, HipSubgroupSizesGCN2>;
def : HipTargetInfo<"amd_gpu_gfx705", HipMinAspects, HipSubgroupSizesGCN2>;
def : HipTargetInfo<"amd_gpu_gfx801", HipMinAspects, HipSubgroupSizesGCN3>;
def : HipTargetInfo<"amd_gpu_gfx802", HipMinAspects, HipSubgroupSizesGCN3>;
def : HipTargetInfo<"amd_gpu_gfx803", HipMinAspects, HipSubgroupSizesGCN3>;
Expand Down
13 changes: 8 additions & 5 deletions sycl/doc/UsersManual.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ and not recommended to use in production environment.
* amd_gpu_gfx700 - AMD GCN GFX7 (Sea Islands (CI)) architecture
* amd_gpu_gfx701 - AMD GCN GFX7 (Sea Islands (CI)) architecture
* amd_gpu_gfx702 - AMD GCN GFX7 (Sea Islands (CI)) architecture
* amd_gpu_gfx703 - AMD GCN GFX7 (Sea Islands (CI)) architecture
* amd_gpu_gfx704 - AMD GCN GFX7 (Sea Islands (CI)) architecture
* amd_gpu_gfx705 - AMD GCN GFX7 (Sea Islands (CI)) architecture
* amd_gpu_gfx801 - AMD GCN GFX8 (Volcanic Islands (VI)) architecture
* amd_gpu_gfx802 - AMD GCN GFX8 (Volcanic Islands (VI)) architecture
* amd_gpu_gfx803 - AMD GCN GFX8 (Volcanic Islands (VI)) architecture
Expand All @@ -104,13 +107,13 @@ and not recommended to use in production environment.
* amd_gpu_gfx902 - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx904 - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx906 - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx908 - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx908 - AMD GCN GFX9 (CDNA1) architecture
* amd_gpu_gfx909 - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx90a - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx90a - AMD GCN GFX9 (CDNA2) architecture
* amd_gpu_gfx90c - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx940 - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx941 - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx942 - AMD GCN GFX9 (Vega) architecture
* amd_gpu_gfx940 - AMD GCN GFX9 (CDNA3) architecture
* amd_gpu_gfx941 - AMD GCN GFX9 (CDNA3) architecture
* amd_gpu_gfx942 - AMD GCN GFX9 (CDNA3) architecture
* amd_gpu_gfx1010 - AMD GCN GFX10.1 (RDNA 1) architecture
* amd_gpu_gfx1011 - AMD GCN GFX10.1 (RDNA 1) architecture
* amd_gpu_gfx1012 - AMD GCN GFX10.1 (RDNA 1) architecture
Expand Down
6 changes: 6 additions & 0 deletions sycl/doc/design/DeviceIf.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ recognizes:
* `amd_gpu_gfx700`
* `amd_gpu_gfx701`
* `amd_gpu_gfx702`
* `amd_gpu_gfx703`
* `amd_gpu_gfx704`
* `amd_gpu_gfx705`
* `amd_gpu_gfx801`
* `amd_gpu_gfx802`
* `amd_gpu_gfx803`
Expand Down Expand Up @@ -187,6 +190,9 @@ one of the following corresponding C++ macro names:
* `__SYCL_TARGET_AMD_GPU_GFX700__`
* `__SYCL_TARGET_AMD_GPU_GFX701__`
* `__SYCL_TARGET_AMD_GPU_GFX702__`
* `__SYCL_TARGET_AMD_GPU_GFX703__`
* `__SYCL_TARGET_AMD_GPU_GFX704__`
* `__SYCL_TARGET_AMD_GPU_GFX705__`
* `__SYCL_TARGET_AMD_GPU_GFX801__`
* `__SYCL_TARGET_AMD_GPU_GFX802__`
* `__SYCL_TARGET_AMD_GPU_GFX803__`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,9 @@ a|
amd_gpu_gfx700
amd_gpu_gfx701
amd_gpu_gfx702
amd_gpu_gfx703
amd_gpu_gfx704
amd_gpu_gfx705
----
|-
|AMD GCN 2.0 architecture.
Expand Down
3 changes: 3 additions & 0 deletions sycl/include/sycl/ext/oneapi/experimental/architectures.def
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ __SYCL_ARCHITECTURE(nvidia_gpu_sm_90a, 0x01000000000090a0)
__SYCL_ARCHITECTURE(amd_gpu_gfx700, 0x0200000000070000)
__SYCL_ARCHITECTURE(amd_gpu_gfx701, 0x0200000000070100)
__SYCL_ARCHITECTURE(amd_gpu_gfx702, 0x0200000000070200)
__SYCL_ARCHITECTURE(amd_gpu_gfx703, 0x0200000000070300)
__SYCL_ARCHITECTURE(amd_gpu_gfx704, 0x0200000000070400)
__SYCL_ARCHITECTURE(amd_gpu_gfx705, 0x0200000000070500)
__SYCL_ARCHITECTURE(amd_gpu_gfx801, 0x0200000000080100)
__SYCL_ARCHITECTURE(amd_gpu_gfx802, 0x0200000000080200)
__SYCL_ARCHITECTURE(amd_gpu_gfx803, 0x0200000000080300)
Expand Down
21 changes: 21 additions & 0 deletions sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ static constexpr ext::oneapi::experimental::architecture
#ifndef __SYCL_TARGET_AMD_GPU_GFX702__
#define __SYCL_TARGET_AMD_GPU_GFX702__ 0
#endif
#ifndef __SYCL_TARGET_AMD_GPU_GFX703__
#define __SYCL_TARGET_AMD_GPU_GFX703__ 0
#endif
#ifndef __SYCL_TARGET_AMD_GPU_GFX704__
#define __SYCL_TARGET_AMD_GPU_GFX704__ 0
#endif
#ifndef __SYCL_TARGET_AMD_GPU_GFX705__
#define __SYCL_TARGET_AMD_GPU_GFX705__ 0
#endif
#ifndef __SYCL_TARGET_AMD_GPU_GFX801__
#define __SYCL_TARGET_AMD_GPU_GFX801__ 0
#endif
Expand Down Expand Up @@ -360,6 +369,9 @@ static constexpr bool is_allowable_aot_mode =
(__SYCL_TARGET_AMD_GPU_GFX700__ == 1) ||
(__SYCL_TARGET_AMD_GPU_GFX701__ == 1) ||
(__SYCL_TARGET_AMD_GPU_GFX702__ == 1) ||
(__SYCL_TARGET_AMD_GPU_GFX703__ == 1) ||
(__SYCL_TARGET_AMD_GPU_GFX704__ == 1) ||
(__SYCL_TARGET_AMD_GPU_GFX705__ == 1) ||
(__SYCL_TARGET_AMD_GPU_GFX801__ == 1) ||
(__SYCL_TARGET_AMD_GPU_GFX802__ == 1) ||
(__SYCL_TARGET_AMD_GPU_GFX803__ == 1) ||
Expand Down Expand Up @@ -538,6 +550,15 @@ get_current_architecture_aot() {
#if __SYCL_TARGET_AMD_GPU_GFX702__
return ext::oneapi::experimental::architecture::amd_gpu_gfx702;
#endif
#if __SYCL_TARGET_AMD_GPU_GFX703__
return ext::oneapi::experimental::architecture::amd_gpu_gfx703;
#endif
#if __SYCL_TARGET_AMD_GPU_GFX704__
return ext::oneapi::experimental::architecture::amd_gpu_gfx704;
#endif
#if __SYCL_TARGET_AMD_GPU_GFX705__
return ext::oneapi::experimental::architecture::amd_gpu_gfx705;
#endif
#if __SYCL_TARGET_AMD_GPU_GFX801__
return ext::oneapi::experimental::architecture::amd_gpu_gfx801;
#endif
Expand Down
3 changes: 3 additions & 0 deletions sycl/source/detail/device_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,9 @@ constexpr std::pair<const char *, oneapi_exp_arch> NvidiaAmdGPUArchitectures[] =
{"9.0", oneapi_exp_arch::nvidia_gpu_sm_90},
{"gfx701", oneapi_exp_arch::amd_gpu_gfx701},
{"gfx702", oneapi_exp_arch::amd_gpu_gfx702},
{"gfx703", oneapi_exp_arch::amd_gpu_gfx703},
{"gfx704", oneapi_exp_arch::amd_gpu_gfx704},
{"gfx705", oneapi_exp_arch::amd_gpu_gfx705},
{"gfx801", oneapi_exp_arch::amd_gpu_gfx801},
{"gfx802", oneapi_exp_arch::amd_gpu_gfx802},
{"gfx803", oneapi_exp_arch::amd_gpu_gfx803},
Expand Down

0 comments on commit 5d7468d

Please sign in to comment.