diff --git a/src/std-data/model.cmake b/src/std-data/model.cmake index e9e70998..0bee0af4 100644 --- a/src/std-data/model.cmake +++ b/src/std-data/model.cmake @@ -35,6 +35,21 @@ register_flag_optional(USE_ONEDPL This requires the DPC++ compiler (other SYCL compilers are untested), required SYCL flags are added automatically." "OFF") +register_flag_optional(AMDGPU_TARGET_OFFLOAD + "Enable offloading support (via the non-standard `-stdpar`) for + Clang/LLVM. The values are AMDGPU processors (https://www.llvm.org/docs/AMDGPUUsage.html#processors) + which will be passed in via `--offload-arch=` argument. + + Example values are: + gfx906 - Compile for Vega20 GPUs + gfx908 - Compile for CDNA1 GPUs + gfx90a - Compile for CDNA2 GPUs + gfx942 - Compile for CDNA3 GPUs + gfx1030 - Compile for RDNA2 NV21 GPUs + gfx1100 - Compile for RDNA3 NV31 GPUs" + "") + + macro(setup) set(CMAKE_CXX_STANDARD 17) if (NVHPC_OFFLOAD) @@ -50,4 +65,13 @@ macro(setup) register_definitions(USE_ONEDPL) register_link_library(oneDPL) endif () + if (AMDGPU_TARGET_OFFLOAD) + set(AMDGPU_TARGET_OFFLOAD_FLAGS --hipstdpar --offload-arch=${AMDGPU_TARGET_OFFLOAD}) + if (NOT AMDGPU_TARGET_OFFLOAD MATCHES "^gfx9") + list(APPEND AMDGPU_TARGET_OFFLOAD_FLAGS --hipstdpar-interpose-alloc) + endif () + + register_append_cxx_flags(ANY ${AMDGPU_TARGET_OFFLOAD_FLAGS}) + register_append_link_flags(--hipstdpar) + endif () endmacro() diff --git a/src/std-indices/model.cmake b/src/std-indices/model.cmake index 60ef575f..94eaf7c7 100644 --- a/src/std-indices/model.cmake +++ b/src/std-indices/model.cmake @@ -35,6 +35,22 @@ register_flag_optional(USE_ONEDPL This requires the DPC++ compiler (other SYCL compilers are untested), required SYCL flags are added automatically." "OFF") +register_flag_optional(AMDGPU_TARGET_OFFLOAD + "Enable offloading support (via the non-standard `-stdpar`) for + Clang/LLVM. The values are AMDGPU processors (https://www.llvm.org/docs/AMDGPUUsage.html#processors) + which will be passed in via `--offload-arch=` argument. + + Example values are: + gfx906 - Compile for Vega20 GPUs + gfx908 - Compile for CDNA1 GPUs + gfx90a - Compile for CDNA2 GPUs + gfx942 - Compile for CDNA3 GPUs + gfx1030 - Compile for RDNA2 NV21 GPUs + gfx1100 - Compile for RDNA3 NV31 GPUs" + "") + + + macro(setup) set(CMAKE_CXX_STANDARD 17) if (NVHPC_OFFLOAD) @@ -50,4 +66,13 @@ macro(setup) register_definitions(USE_ONEDPL) register_link_library(oneDPL) endif () + if (AMDGPU_TARGET_OFFLOAD) + set(AMDGPU_TARGET_OFFLOAD_FLAGS --hipstdpar --offload-arch=${AMDGPU_TARGET_OFFLOAD}) + if (NOT AMDGPU_TARGET_OFFLOAD MATCHES "^gfx9") + list(APPEND AMDGPU_TARGET_OFFLOAD_FLAGS --hipstdpar-interpose-alloc) + endif () + + register_append_cxx_flags(ANY ${AMDGPU_TARGET_OFFLOAD_FLAGS}) + register_append_link_flags(--hipstdpar) + endif () endmacro()