Skip to content

Commit

Permalink
Add support for hipstdpar
Browse files Browse the repository at this point in the history
  • Loading branch information
gsitaram authored and gonzalobg committed Aug 14, 2024
1 parent 62a5051 commit 6f0c2a1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/std/model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ register_flag_optional(STDIMPL
"DATA20"
)

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)
register_definitions(${STDIMPL})
if (${STDIMPL} STREQUAL "DATA17")
Expand Down Expand Up @@ -79,4 +93,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()

0 comments on commit 6f0c2a1

Please sign in to comment.