Skip to content

[ci] Deprecate hipcc: use amdclang++ as default compiler#20

Open
david-salinas wants to merge 13 commits into
amd-developfrom
users/dsalinas/deprecate-hipcc
Open

[ci] Deprecate hipcc: use amdclang++ as default compiler#20
david-salinas wants to merge 13 commits into
amd-developfrom
users/dsalinas/deprecate-hipcc

Conversation

@david-salinas

@david-salinas david-salinas commented May 8, 2026

Copy link
Copy Markdown
Collaborator

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

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@david-salinas david-salinas marked this pull request as draft May 8, 2026 17:22
@david-salinas david-salinas force-pushed the users/dsalinas/deprecate-hipcc branch from ffd7b4d to 94b24f1 Compare May 13, 2026 22:13
david-salinas and others added 3 commits May 17, 2026 14:55
…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>
@david-salinas david-salinas force-pushed the users/dsalinas/deprecate-hipcc branch from 94b24f1 to e7c63ea Compare May 17, 2026 19:55
@david-salinas david-salinas marked this pull request as ready for review June 24, 2026 15:16
@david-salinas david-salinas requested a review from lamb-j June 24, 2026 15:16
Comment thread ci/build_common.sh Outdated
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++`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we use amdclang as the CUDA compiler?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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>
@david-salinas

Copy link
Copy Markdown
Collaborator Author

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.

skganesan008 added a commit to ROCm/TheRock that referenced this pull request Jun 29, 2026
Pin-only SMP bump for one-off CI validation of ROCm/libhipcxx#20.
david-salinas and others added 4 commits June 30, 2026 12:35
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>
skganesan008 added a commit to ROCm/TheRock that referenced this pull request Jun 30, 2026
Pin-only SMP bump for one-off CI validation of ROCm/libhipcxx#20.
david-salinas and others added 2 commits July 1, 2026 10:01
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>
skganesan008 added a commit to ROCm/TheRock that referenced this pull request Jul 1, 2026
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")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we even be setting CUDA_COMPILER for hipRTC?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread .upstream-tests/test/CMakeLists.txt Outdated
Comment on lines +113 to +115
# 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shorten/remove this comment; no need to have historical references to hipcc

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok.

Comment on lines +192 to +193
# hipcc used to add the HIP runtime library automatically; with amdclang++
# we must link it explicitly.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'd remove this comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok

@lamb-j lamb-j left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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!

@david-salinas david-salinas requested a review from lamb-j July 8, 2026 15:53
david-salinas and others added 2 commits July 13, 2026 15:32
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants