Conversation
This patch adds support for HIP multi-arch builds and adds `amdgcnspirv` as an explicit Kokkos architecture target. What is done: - Adds `Kokkos_ARCH_AMD_GCNSPIRV` / `KOKKOS_ARCH_AMD_GCNSPIRV`. - Allows selecting multiple AMD GPU targets in CMake and propagates them to HIP offload flags. - Updates exported package checks so downstream `GPU_TARGETS` can be a subset of the enabled Kokkos HIP architectures. - Switches HIP warp-size-dependent host logic to runtime values from `hipDeviceProp_t`. - Moves HIP arch capability checks (including XNACK-related behavior) to runtime detection. - Updates HIP tests and adds `TestHIP_RuntimeArch.cpp` coverage. Result: - Multi-arch HIP builds now supported - `amdgcnspirv` is recognized end-to-end. - Performance comparison vs the prior compile-time path shows no meaningful regression (largest observed changes were low single-digit percentages). For this PR, the runtime HIP architecture path performs essentially the same as the compile-time path on MI300A. - STREAM: mixed small changes, best +0.95% (`Set`), worst -1.46% (`Add`) - Reduction: effectively unchanged (-0.65% and -0.06%) - Launch latency: +0.08% (`V=1`) and +1.13% (`V=30000`) Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Trévis Morvany <63788850+tretre91@users.noreply.github.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Trévis Morvany <63788850+tretre91@users.noreply.github.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
tretre91
left a comment
There was a problem hiding this comment.
There are some integer comparison warnings in the CI related to HIPTraits::WarpSize() https://cloud1.cees.ornl.gov/jenkins-ci/job/Kokkos/job/PR-9384/4/stages/
| if(KOKKOS_HIP_ARCHITECTURES) | ||
| list(LENGTH KOKKOS_HIP_ARCHITECTURES KOKKOS_HIP_ARCH_COUNT_FOR_OPENACC) | ||
| if(KOKKOS_HIP_ARCH_COUNT_FOR_OPENACC GREATER 1) | ||
| message( | ||
| FATAL_ERROR | ||
| "Kokkos_ENABLE_OPENACC currently supports only one AMD GPU architecture, but got ${KOKKOS_HIP_ARCHITECTURES}." | ||
| ) | ||
| endif() | ||
| endif() |
There was a problem hiding this comment.
Does SYCL support multiple archs? If not we should add the same check with KOKKOS_ENABLE_SYCL
There was a problem hiding this comment.
Since multiple intel archs are not supported, I would assume the same for multiple AMD archs
macro(CHECK_MULTIPLE_INTEL_ARCH)
if(KOKKOS_ARCH_INTEL_GPU)
message(FATAL_ERROR "Specifying multiple Intel GPU architectures is not allowed!")
endif()
set(KOKKOS_ARCH_INTEL_GPU ON)
endmacro()@masterleinad can you confirm ?
There was a problem hiding this comment.
Yes, we haven't allowed multiple GPU or CPU architectures for any backend.
good catch. Fixing that now... |
Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Trévis Morvany <63788850+tretre91@users.noreply.github.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
| } | ||
| block_size >>= 1; | ||
| } while (block_size >= HIPTraits::WarpSize); | ||
| } while (block_size >= static_cast<unsigned>(HIPTraits::WarpSize())); |
There was a problem hiding this comment.
Why were we not getting warnings before?
There was a problem hiding this comment.
Probably because it was replaced with a compile-time constant that did not have a type, just a value?
Co-authored-by: Damien L-G <dalg24+github@gmail.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Damien L-G <dalg24+github@gmail.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Damien L-G <dalg24+github@gmail.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Signed-off-by: Kevin Huck <kevin.huck@gmail.com>
dalg24
left a comment
There was a problem hiding this comment.
(unfinished review but sending it now because I don't want to sit on these for too long)
Co-authored-by: Damien L-G <dalg24+github@gmail.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Damien L-G <dalg24+github@gmail.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Damien L-G <dalg24+github@gmail.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Damien L-G <dalg24+github@gmail.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Damien L-G <dalg24+github@gmail.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
Co-authored-by: Trévis Morvany <63788850+tretre91@users.noreply.github.com> Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
…as well as amdgcnspirv special case. Signed-off-by: Kevin Huck <Kevin.Huck@amd.com>
tretre91
left a comment
There was a problem hiding this comment.
Other than the comment below and a comment from Damien about mixing west-east const, LGTM
| if(KOKKOS_HIP_ARCHITECTURES) | ||
| list(LENGTH KOKKOS_HIP_ARCHITECTURES KOKKOS_HIP_ARCH_COUNT_FOR_OPENACC) | ||
| if(KOKKOS_HIP_ARCH_COUNT_FOR_OPENACC GREATER 1) | ||
| message( | ||
| FATAL_ERROR | ||
| "Kokkos_ENABLE_OPENACC currently supports only one AMD GPU architecture, but got ${KOKKOS_HIP_ARCHITECTURES}." | ||
| ) | ||
| endif() | ||
| endif() |
There was a problem hiding this comment.
Since multiple intel archs are not supported, I would assume the same for multiple AMD archs
macro(CHECK_MULTIPLE_INTEL_ARCH)
if(KOKKOS_ARCH_INTEL_GPU)
message(FATAL_ERROR "Specifying multiple Intel GPU architectures is not allowed!")
endif()
set(KOKKOS_ARCH_INTEL_GPU ON)
endmacro()@masterleinad can you confirm ?
|
You should also rebase to get some fixes for the CI failures |
This patch adds support for HIP multi-arch builds and adds
amdgcnspirvas an explicit Kokkos architecture target.What is done:
Kokkos_ARCH_AMD_GCNSPIRV/KOKKOS_ARCH_AMD_GCNSPIRV.GPU_TARGETScan be a subset of the enabled Kokkos HIP architectures.hipDeviceProp_t.TestHIP_RuntimeArch.cppcoverage.Result:
amdgcnspirvis recognized end-to-end.For this PR, the runtime HIP architecture path with multi-arch support was tested to perform essentially the same as the compile-time path on MI300A (within system noise).
Set), worst -1.46% (Add)V=1) and +1.13% (V=30000)Related issues / PRs
none.
Changelog Entry
HIP configurations now support the HIP offload target architecture
-DKokkos_ARCH_AMD_GCNSPIRVwhich provides runtime support for any architectureHIP configurations now support multiple offload targets in the same configuration/build.
There is now one gfx942 binary target - there is runtime branching for APU-vs-descrete-GPU behavior using HIP properties rather than separate compile-time specialization for MI300A vs MI300X, although the existing Kokkos arch CMake options are still honored.