[ci] Deprecate hipcc: use amdclang++ as default compiler#20
[ci] Deprecate hipcc: use amdclang++ as default compiler#20david-salinas wants to merge 13 commits into
Conversation
ffd7b4d to
94b24f1
Compare
…mon.sh Replace the hipcc fallback defaults for HOST_COMPILER and CUDA_COMPILER with amdclang++. hipcc is deprecated in favor of calling amdclang++ directly with explicit --hip-path and --hip-device-lib-path flags. Callers that set $CXX or $CUDACXX are unaffected.
With amdclang++ used directly (not hipcc), the bare `hiprtc` link dependency has no library search path and fails with: ld.lld: error: unable to find library -lhiprtc Switch to find_package(hiprtc CONFIG) and link hiprtc::hiprtc, which carries the full library path via IMPORTED_LOCATION. Also switch find_package(HIP) to find_package(hip CONFIG) for consistency. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
…X_FLAGS CMAKE_CXX_FLAGS=-x hip gets passed to the linker step too, causing amdclang++ to try to parse ELF object files as HIP source: error: expected unqualified-id (reading ELF magic bytes) Move -x hip to target_compile_options on the version_check target so it only applies during compilation, not linking. Remove it from the global cmake_opts passed to the sub-project configure step. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
94b24f1 to
e7c63ea
Compare
| HOST_COMPILER=${CXX:-amdclang++} # $CXX if set, otherwise `amdclang++` | ||
| CXX_STANDARD=17 | ||
| CUDA_COMPILER=${CUDACXX:-hipcc} # $CUDACXX if set, otherwise `nvcc` | ||
| CUDA_COMPILER=${CUDACXX:-amdclang++} # $CUDACXX if set, otherwise `amdclang++` |
There was a problem hiding this comment.
Can we use amdclang as the CUDA compiler?
There was a problem hiding this comment.
ok yeah, we need to replicate the logic in hipcc to call amdclang++ or nvcc depending on the HIP_PLATFORM value. I'll get a patch to fix this, and see if there are other cases in theRock were we need to do that too.
…ng++/nvcc Replace the hardcoded HIP_HIPCC_EXECUTABLE reference in the upstream test CMakeLists.txt with direct compiler selection that mirrors hipcc's own platform detection logic: - HIP_PLATFORM=nvidia or HIP_PLATFORM=nvcc -> use nvcc - Everything else (including unset, the AMD default) -> use amdclang++ via CMAKE_CXX_COMPILER Also update ci/build_common.sh to apply the same HIP_PLATFORM-based logic when defaulting CUDA_COMPILER, replacing the unconditional amdclang++ default. Set CMAKE_CUDA_COMPILER_ID to "Clang" for the AMD path (was "HIPCC") so that compiler warning flag logic downstream behaves correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
I'm working with Sivakumar from CI to do a one-off CI run of these changes for libhipcxx: https://github.com/ROCm/llvm-project/actions/runs/28262379561/job/83747072584 I'll update when we have a full/clean run. |
Pin-only SMP bump for one-off CI validation of ROCm/libhipcxx#20.
Setting it to "Clang" routes into the Clang/CUDA branch of the test infrastructure CMakeLists which unconditionally appends -lcudart to linker flags. On AMD-only CI there is no CUDA runtime, so the link fails. Keep "HIPCC" so the HIP-specific flags branch is taken instead. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
CMAKE_CUDA_COMPILER_ID "HIPCC" was a misnomer in two places: - AMD amdclang++ path: rename to "AMDCLANG" to reflect the actual compiler - HIPRTC path: rename to "HIPRTC" to reflect the hiprtcc binary Update the flag branch check to match both new IDs so both paths continue to get HIP include dirs without pulling in -lcudart. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
NVRTC/HIPRTC indicate which runtime to link against, not which compiler to use. Previously, hipcc inferred the compiler from HIP_PLATFORM; now we do it explicitly in CMake. - LIBCUDACXX_TEST_WITH_NVRTC -> NVCC - LIBHIPCXX_TEST_WITH_HIPRTC -> AMDCLANG (AMD runtime = AMD compiler) CMAKE_CUDA_COMPILER_ID now has exactly two values: "NVCC" or "AMDCLANG". Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
Consistent with the offline NVIDIA path and the existing "NVIDIA" branch in the linker flags section. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
Pin-only SMP bump for one-off CI validation of ROCm/libhipcxx#20.
hipcc previously added the HIP runtime library automatically. With amdclang++ invoked directly, we must link it explicitly. Derive the library path from the hip::amdhip64 imported target so it works regardless of install prefix. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
Two fixes needed when building with amdclang++ directly: 1. cmake/test/CMakeLists.txt: propagate CMAKE_PREFIX_PATH into the sub-cmake invocations used by the test_export tests so they can find hipConfig.cmake. 2. cmake/test/test_export/CMakeLists.txt: add -x hip to version_check so libhipcxx headers that use __host__/__device__ compile correctly without going through hipcc. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
Pin-only SMP bump for one-off CI validation of ROCm/libhipcxx#20.
| set(CMAKE_CUDA_COMPILER_ID "HIPCC") | ||
| # HIPRTC is the AMD runtime; use the same HIP_PLATFORM-based compiler | ||
| # selection as the offline compilation path below. | ||
| set(CMAKE_CUDA_COMPILER_ID "AMDCLANG") |
There was a problem hiding this comment.
Should we even be setting CUDA_COMPILER for hipRTC?
There was a problem hiding this comment.
We do have cursory support for CUDA compiler support in the HIPRT. Normally hipcc would invoke nvcc based on HIP_PLATFORM=nvidia, or amdclang if HIP_PLATFORM=amd. Because we're removing calls to hipcc, we need to mimic that behaviour in the cmake files.
| # Select compiler based on HIP_PLATFORM env var, mirroring hipcc's own | ||
| # platform detection logic. HIP_PLATFORM=nvidia uses nvcc; everything | ||
| # else (including the default unset case) uses amdclang++ directly. |
There was a problem hiding this comment.
Shorten/remove this comment; no need to have historical references to hipcc
| # hipcc used to add the HIP runtime library automatically; with amdclang++ | ||
| # we must link it explicitly. |
lamb-j
left a comment
There was a problem hiding this comment.
Overall looks good. I'm wondering how needed all of the tie-ins to CUDA/nvcc are
Obv we need one of the libhipcxx reviewers to weigh in.
Thanks for putting this together!
On Windows the import library (.lib) is in lib/ while the DLL is in bin/. Using LOCATION gives the DLL path (bin/), so the linker can't find amdhip64.lib. Use IMPORTED_IMPLIB instead to get the .lib path directly, falling back to LOCATION on Linux. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
…B variants IMPORTED_IMPLIB is not set; CMake uses config-specific variants like IMPORTED_IMPLIB_RELEASE. Try all variants; if none are set, derive lib/ from the DLL location in bin/ by going up one directory level. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
Description
The HIPCC Tool will be deprecated, and eventually removed in an upcoming release. Users will be directed to use amdclang++ instead and will be given a migration guide.
closes
Jira: https://amd-hub.atlassian.net/browse/ROCM-8370
Replace the hipcc fallback defaults for HOST_COMPILER and CUDA_COMPILER with amdclang++. hipcc is deprecated in favor of calling amdclang++ directly with explicit --hip-path and --hip-device-lib-path flags.
Callers that set $CXX or $CUDACXX are unaffected.
Checklist