From 4452bc18304439fb188f474d04175c35608cf25d Mon Sep 17 00:00:00 2001 From: Georgi Mirazchiyski Date: Tue, 5 Nov 2024 11:58:29 +0000 Subject: [PATCH] [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. --- clang/lib/Driver/ToolChains/SYCL.cpp | 6 ++++++ .../sycl-device-traits-macros-amdgcn.cpp | 18 ++++++++++++++++ clang/test/Driver/sycl-oneapi-gpu-amdgpu.cpp | 9 ++++++++ .../llvm/SYCLLowerIR/DeviceConfigFile.td | 3 +++ sycl/doc/UsersManual.md | 13 +++++++----- sycl/doc/design/DeviceIf.md | 6 ++++++ ...cl_ext_oneapi_device_architecture.asciidoc | 3 +++ .../ext/oneapi/experimental/architectures.def | 3 +++ .../experimental/device_architecture.hpp | 21 +++++++++++++++++++ sycl/source/detail/device_info.hpp | 3 +++ 10 files changed, 80 insertions(+), 5 deletions(-) diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp b/clang/lib/Driver/ToolChains/SYCL.cpp index b333bb7b476d6..6435618ae7f6a 100644 --- a/clang/lib/Driver/ToolChains/SYCL.cpp +++ b/clang/lib/Driver/ToolChains/SYCL.cpp @@ -1328,6 +1328,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") @@ -1415,6 +1418,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") diff --git a/clang/test/Driver/sycl-device-traits-macros-amdgcn.cpp b/clang/test/Driver/sycl-device-traits-macros-amdgcn.cpp index 8dacdd21f9b20..f7b8ae550f6e9 100644 --- a/clang/test/Driver/sycl-device-traits-macros-amdgcn.cpp +++ b/clang/test/Driver/sycl-device-traits-macros-amdgcn.cpp @@ -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 @@ -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 diff --git a/clang/test/Driver/sycl-oneapi-gpu-amdgpu.cpp b/clang/test/Driver/sycl-oneapi-gpu-amdgpu.cpp index bdc108c6a0f55..e6c8530c53130 100644 --- a/clang/test/Driver/sycl-oneapi-gpu-amdgpu.cpp +++ b/clang/test/Driver/sycl-oneapi-gpu-amdgpu.cpp @@ -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=gfx703 -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=gfx704 -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=gfx705 -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 diff --git a/llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td b/llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td index 686c1de58a9fa..5fc1cf79a1caa 100644 --- a/llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td +++ b/llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td @@ -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>; diff --git a/sycl/doc/UsersManual.md b/sycl/doc/UsersManual.md index 3f184edc12def..efdf03249616c 100644 --- a/sycl/doc/UsersManual.md +++ b/sycl/doc/UsersManual.md @@ -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 @@ -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 diff --git a/sycl/doc/design/DeviceIf.md b/sycl/doc/design/DeviceIf.md index 5d26bdab639db..606ad0d3be728 100644 --- a/sycl/doc/design/DeviceIf.md +++ b/sycl/doc/design/DeviceIf.md @@ -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` @@ -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__` diff --git a/sycl/doc/extensions/experimental/sycl_ext_oneapi_device_architecture.asciidoc b/sycl/doc/extensions/experimental/sycl_ext_oneapi_device_architecture.asciidoc index f2ebcc5944462..e866613120366 100644 --- a/sycl/doc/extensions/experimental/sycl_ext_oneapi_device_architecture.asciidoc +++ b/sycl/doc/extensions/experimental/sycl_ext_oneapi_device_architecture.asciidoc @@ -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. diff --git a/sycl/include/sycl/ext/oneapi/experimental/architectures.def b/sycl/include/sycl/ext/oneapi/experimental/architectures.def index b8148f673814a..08ce75a370119 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/architectures.def +++ b/sycl/include/sycl/ext/oneapi/experimental/architectures.def @@ -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) diff --git a/sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp b/sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp index 9638ac91ac793..ab6c011413f11 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/device_architecture.hpp @@ -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 @@ -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) || @@ -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 diff --git a/sycl/source/detail/device_info.hpp b/sycl/source/detail/device_info.hpp index 6eedec5b4f404..2551e6c03b635 100644 --- a/sycl/source/detail/device_info.hpp +++ b/sycl/source/detail/device_info.hpp @@ -626,6 +626,9 @@ constexpr std::pair 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},