← Back to Pull requests

refactor(hkp): replace hipcc with clang++ --offload-device-only #14827

Closed
unknown closed this pull request without merging on Nov 24, 2026 01:40 UTC
View on GitHub
unknown unknown commented on Nov 01, 2026 04:15 UTC
Author

Replace all hipcc invocations in hip-kernel-provider with direct clang++ calls using --offload-device-only -x hip, plus explicit --hip-path and --hip-device-lib-path flags.

Key changes:
- hip_compile.py: hipcc --genco → clang++ --offload-device-only -x hip
- toolchain.py: read HIP version from files instead of hipcc --version
- pipeline.py: thread hip_compiler/hip_path/device_lib_path through all compilation call sites
- CMakeLists.txt, HkpPackaging.cmake, HkpPackagingProbes.cmake: resolve compiler from CMAKE_HIP_COMPILER, derive paths from hip package
- CLI: --hipcc → --hip-compiler
- All tests/probes: hipcc fixture → hip_compiler + hip_path + device_lib_path

Motivation

<!-- Explain the purpose of this PR and the goals it aims to achieve. -->
The ROCm toolchain is migrating away from the hipcc/hipconfig wrappers in favor of direct clang++/amdclang++ invocations. hipcc added a layer of indirection that obscured compiler flags and made toolchain resolution harder to reason about in CMake. By calling the compiler directly with --offload-device-only -x hip, we remove the dependency on hipcc/hipconfig, align with how TheRock's build system resolves the HIP toolchain (via CMAKE_HIP_COMPILER), and gain explicit control over --hip-path and --hip-device-lib-path so the build works correctly in non-standard install layouts.

Technical Details

<!-- Explain the changes along with any relevant GitHub links. -->
Compilation (hip_compile.py): Replaced hipcc --genco with clang++ --offload-device-only -x hip. Added explicit -O3 default to match hipcc's implicit behavior when no -O* flag is authored. --hip-path and --hip-device-lib-path are conditionally appended when provided.

Version detection (toolchain.py): Replaced hipcc --version subprocess call with file-based version reading. Parses HIP_VERSION_MAJOR/MINOR/PATCH from share/hip/version (KEY=VALUE format) or include/hip/hip_version.h (#define format), keyed on hip_path instead of hipcc. Provenance field renamed from
hipcc_version to hip_version.

Pipeline threading (pipeline.py): hip_compiler, hip_path, and device_lib_path are threaded through run_pipeline() → per-arch compilation → compile_hip_variant(). The old single hipcc parameter is replaced by the three-parameter set at every call site.

CMake (CMakeLists.txt, HkpPackaging.cmake, HkpPackagingProbes.cmake): Compiler resolution uses CMAKE_HIP_COMPILER (falling back to CMAKE_CXX_COMPILER). hip_DIR is used to derive --hip-path, and the compiler's sibling amdgcn/bitcode directory provides --hip-device-lib-path. The Flash2 variant build
and the hkp_pack invocations both use the new flags. HKP_HIPCC replaced by plain (non-cache) variables HKP_HIP_COMPILER, HKP_HIP_PATH, and HKP_DEVICE_LIB_PATH, set via PARENT_SCOPE in hkp_require_ingestor_toolchain().

CLI (hkp_pack.py): --hipcc replaced by --hip-compiler; --hip-path and --hip-device-lib-path added as new arguments. All in-repo callers are migrated; no backward-compatible alias is provided.

Tests: hipcc pytest fixture renamed to hip_compiler in conftest.py, with new hip_path and device_lib_path session fixtures sourced from environment variables. All ~47 test files updated to use the new fixture names and thread the path parameters through helper functions.

Test Plan

<!-- Explain any relevant testing done to verify this PR. -->
- Ran the full hkp descriptor-packaging test suite locally:
HIPKERNELPROVIDER_ROCM_KPACK_DIR=.../rocm-systems/shared/kpack/python python3 -m pytest tests/ -m quick -v
856 passed, 7 skipped, 39 failed (pre-existing broken local cmake wrapper unrelated to this PR)
- Verified pytest collection succeeds for all test files (no fixture resolution errors)
- CI "HipDNN Linux Superbuild" check: full build completes (2010 steps), 299 hkp-pack-quick tests pass, remaining tests deselected (require GPU hardware)
- Pre-commit checks pass (black, trailing whitespace, cmake-lint))

Test Result

<!-- Briefly summarize test outcomes. -->
All 299 GPU-independent hkp-pack-quick tests pass in CI. 856 quick-marked tests pass locally. No regressions in the superbuild.

Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.

  • ](https://github.com/ROCm/rocm-libraries/pull/14818)

    Diff: 551 lines (+413 / -138) across 6 files Reviewer: david-salinas Review duration: 32965m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.48) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 551 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.378
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #14827"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48.1% (MEDIUM) · Higher = larger blast radius
    48.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.8% · Safe to merge
    20.8%