Skip to content

fix(hip-kernel-provider): resolve rocm_kpack hermetically, never fetch by default - #11150

Draft
BrianHarrisonAMD wants to merge 1 commit into
developfrom
users/bharriso/kpack-hermetic-resolution
Draft

fix(hip-kernel-provider): resolve rocm_kpack hermetically, never fetch by default#11150
BrianHarrisonAMD wants to merge 1 commit into
developfrom
users/bharriso/kpack-hermetic-resolution

Conversation

@BrianHarrisonAMD

@BrianHarrisonAMD BrianHarrisonAMD commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

The hip-kernel-provider build fetched rocm_kpack at CMake configure time from unpinned sources, with no way to opt out. Replaces the three fetch sites with one resolution module that reaches the network only when explicitly told to.

Closes #11149. Raised in review of #10489 (r3834047349, r3834111054).

Risk Assessment

Risk 2. Build-system only; no runtime code changes and no change to shipped artifact contents.

Where a build previously fetched to produce ASM SDPA .kpack, the default now produces none. Those archives are unused at runtime — the runtime loads loose .co via SdpaModuleCache/loadKernelModule — so no behavior changes. Builds that supply a kpack path, including TheRock, are unaffected. Descriptor packaging is behind HIPDNN_ENABLE_KERNEL_INGESTOR (default OFF) and keeps its existing hard failure.

ASIC Coverage

No ASIC impact. Build-time dependency resolution only; no kernel selection, dispatch, or codegen is touched. Standard PR CI is sufficient.

Testing Summary

Resolution matrix against cmake/KpackPython.cmake: unset (no fetch), canonical flag, deprecated alias, both set (canonical wins), invalid path (fatal), standalone layout, ALLOW_FETCH=ON (lands on the pinned SHA), alias changed on a warm build directory, and the dependency probe with kpack importable, absent, and present-but-broken.

Both CI jobs pack rather than skip: 164 .co files for gfx942 and 126 for gfx950, round-trip SHA256 verified.

Testing Checklist

  • Resolution matrix - cmake configure against cmake/KpackPython.cmake - Status: Passed
  • Pack end-to-end - pack.py --arch gfx942 - Status: Passed (164/164)
  • Pin holds against a warm venv - --force-reinstall plus commit assertion - Status: Passed
  • PR CI - GitHub PR checks - Status: Passed

Technical Changes

New cmake/KpackPython.cmake — one resolution point for both kpack consumers:

Variable Default Effect
HIPKERNELPROVIDER_KPACK_PYTHON_DIR empty Canonical path. Accepts the rocm-systems and standalone rocm-kpack layouts.
ROCKE_KPACK_PYTHON_DIR empty Deprecated alias; seeds the canonical entry so superprojects keep working until they migrate.
HIPKERNELPROVIDER_KPACK_ALLOW_FETCH OFF Fetches HIPKERNELPROVIDER_KPACK_GIT_REF when no local source is configured.

Unresolved returns empty and the caller sets policy. A configured path that does not contain rocm_kpack/kpack.py is fatal rather than a fetch fallback. The dependency probe imports the rocm_kpack modules pack.py uses, under the interpreter and PYTHONPATH the pack command runs with; it never installs.

asm_sdpa_engine/CMakeLists.txt — drops the git clone of rocm-systems develop and the configure-time pip install zstandard msgpack, which mutated the host environment from an unpinned index. Skips packing when kpack is unresolved, since the output is unused at runtime.

descriptor-packaging/cmake/HkpPackaging.cmake — delegates to the shared module; still fails hard, as it cannot pack without kpack.

hipdnn-superbuild-ci.yml — both jobs relied on the implicit fetch. They now install rocm-kpack at the pinned KPACK_REF into the build venv and pass its site-packages explicitly. --force-reinstall is required because rocm-kpack is version 0.1.0 at every commit, so pip would treat the pinned requirement as already satisfied in a warm venv; the installed commit is then asserted against KPACK_REF. A post-build step fails the job if no .kpack archives were produced.

Follow-ups

Tracked on #11149: make the ASM SDPA skip fatal once the runtime loads .kpack; migrate TheRock to the canonical flag and drop the alias; review rocke/CMakeLists.txt's venv pip installs.

Sourcing kpack from TheRock's pinned rocm-systems submodule was considered and rejected: this workflow builds against nightly wheels up to 14 days old that are not built from TheRock@main, so that commit is not the right correspondent. Both in-repo precedents for consuming rocm-systems in CI use explicit pins.

@therock-pr-bot

therock-pr-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass PR does not contain code files — Unit Test auto-passed
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled
🤖 therock-pr-bot ✅ Pass

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/kpack-hermetic-resolution branch 2 times, most recently from 6f13683 to c563ccb Compare August 21, 2026 23:52
@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/kpack-hermetic-resolution branch 2 times, most recently from b80e901 to c79efbe Compare August 22, 2026 00:05
@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/kpack-hermetic-resolution branch 2 times, most recently from ba0ed6d to 2717857 Compare August 22, 2026 02:27
…h by default

The build fetched rocm_kpack from the network at configure time, from unpinned
sources, with no opt-in. Flagged as a P0 defect in review of #10489.

TheRock passes -DROCKE_KPACK_PYTHON_DIR, which nothing here read, so the value
was dropped and the ASM SDPA engine cloned rocm-systems' floating develop
instead. CI run 32452718850 shows both halves: "Cloning into
'...rocm_systems_kpack'" alongside "Manually-specified variables were not used
by the project: ROCKE_KPACK_PYTHON_DIR".

Add cmake/KpackPython.cmake, one resolution point for every kpack consumer:
HIPKERNELPROVIDER_KPACK_PYTHON_DIR, then the deprecated ROCKE_KPACK_PYTHON_DIR,
then a pinned fetch if HIPKERNELPROVIDER_KPACK_ALLOW_FETCH is ON (default OFF),
else empty. The alias means no coordinated TheRock change is needed. A
configured-but-invalid path is fatal rather than a fallback to fetching.

Drop the configure-time `pip install zstandard msgpack`, which mutated the host
environment from an unpinned index; dependencies are now checked and named.
TheRock's requirements.txt already provides both.

Callers set their own policy: descriptor-packaging hard-fails, since it cannot
pack without rocm_kpack; the ASM SDPA step skips, since its .kpack output is
unused at runtime today (the runtime loads loose .co via SdpaModuleCache). Make
that skip fatal when Phase 2 lands.

Verified across the resolution matrix: unset (no fetch), canonical, legacy-only,
both set, invalid path (fatal), standalone layout, and ALLOW_FETCH=ON (pinned
SHA). End-to-end, pack.py packed 164 .co files for gfx942 with round-trip
SHA256 verification.

Issue: #11149
@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/kpack-hermetic-resolution branch from 2717857 to 7e47307 Compare August 22, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] hip-kernel-provider silently fetches rocm_kpack from unpinned sources (TheRock's ROCKE_KPACK_PYTHON_DIR is read by nothing)

1 participant