Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hipstdpar support to BabelStream #195

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add support for hipstdpar
gsitaram committed Apr 29, 2024

Unverified

No user is associated with the committer email.
commit 9d4cc72f8f93221d0ef4900ee26dd3c3634d5c10
24 changes: 24 additions & 0 deletions src/std-data/model.cmake
Original file line number Diff line number Diff line change
@@ -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(CLANG_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 (CLANG_OFFLOAD)
set(CLANG_FLAGS --hipstdpar --hipstdpar-path=${CLANG_STDPAR_PATH} --offload-arch=${CLANG_OFFLOAD})
if (NOT CLANG_OFFLOAD MATCHES "^gfx9")
list(APPEND CLANG_FLAGS --hipstdpar-interpose-alloc)
endif ()

register_append_cxx_flags(ANY ${CLANG_FLAGS})
register_append_link_flags(--hipstdpar)
endif ()
endmacro()
25 changes: 25 additions & 0 deletions src/std-indices/model.cmake
Original file line number Diff line number Diff line change
@@ -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(CLANG_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 (CLANG_OFFLOAD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not totally sold on the name of this definition as CLANG is not specific to AMD, but the CLANG_FLAGS set below are definitely specific. Can we rename this please to something appropriate?

Copy link
Author

@gsitaram gsitaram May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would replacing CLANG_OFFLOAD with AMDGPU_TARGET_OFFLOAD and CLANG_FLAGS with AMDGPU_TARGET_OFFLOAD_FLAGS be acceptable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tomdeakin, please confirm if the above suggestion would work or recommend something better. I can make the changes accordingly.

set(CLANG_FLAGS --hipstdpar --hipstdpar-path=${CLANG_STDPAR_PATH} --offload-arch=${CLANG_OFFLOAD})
if (NOT CLANG_OFFLOAD MATCHES "^gfx9")
list(APPEND CLANG_FLAGS --hipstdpar-interpose-alloc)
endif ()

register_append_cxx_flags(ANY ${CLANG_FLAGS})
register_append_link_flags(--hipstdpar)
endif ()
endmacro()