Skip to content

feat(hipkernelprovider): rocKE AOT kpack packaging & arch split#6427

Draft
BrianHarrisonAMD wants to merge 5 commits into
mainfrom
users/bharriso/rocke-kpack-deps
Draft

feat(hipkernelprovider): rocKE AOT kpack packaging & arch split#6427
BrianHarrisonAMD wants to merge 5 commits into
mainfrom
users/bharriso/rocke-kpack-deps

Conversation

@BrianHarrisonAMD

@BrianHarrisonAMD BrianHarrisonAMD commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

TheRock-side enablement for the rocKE AOT + kpack feature (AICK-1616). Three coupled areas, all inert until a rocm-libraries consumer produces the bundles:

  1. Build deps: add rocm-kpack and amd-comgr to the hipkernelprovider BUILD_DEPS (the producer packs with rocm_kpack and compiles HSACO via libamd_comgr), plus rocm-kpack in RUNTIME_DEPS and a -DROCKE_KPACK_PYTHON_DIR source cache var. comgr is resolved by find_library on the rocke side.
  2. Wheel packaging: register kpack in rocm_sdk/_dist_info.py and add kpack's directory to the Windows dlopen search path in both wheel load tests (libraries_test.py and devel_test.py) when loading a hipdnn plugin.
  3. Per-arch split: flip hipkernelprovider to type = "target-specific" with split_databases = ["hipkernelprovider"], capture the per-arch bundle tree in the artifact TOML, and add hipkernelprovider to device_artifact_filter.

Install layout

rocKE per-arch bundles install next to the engine plugin at
lib/hipdnn_plugins/engines/hip_kernel_provider/rocke/<arch>/
(rocke_client_<arch>.kpack + .json sidecar + kernel-selection heuristics).
The host plugin .so is arch-neutral and stays generic; the per-arch tree splits
per-arch via the rocm-systems hipkernelprovider kpack handler.

Cross-repo sequence

  1. rocm-systems feat(kpack): add hipkernelprovider per-arch split handler (AICK-1616) rocm-systems#8347: the hipkernelprovider kpack split handler.
  2. TheRock (this PR): topology + artifact TOML + packaging + build deps.
  3. rocm-libraries feat(hip-kernel-provider): rocKE AOT producer + kpack packaging (AICK-1473) rocm-libraries#9207: the rocKE AOT producer.

Hard ordering constraint: KPACK_SPLIT_ARTIFACTS defaults on, so the split runs
for hipkernelprovider and shells out --split-databases hipkernelprovider
against TheRock's pinned rocm-systems. This PR must bump the rocm-systems
gitlink to include #8347 before merge, otherwise the split invokes an unknown
handler and fails. Safe with rocKE disabled (no bundles): the split yields
generic-only with no empty per-arch artifacts (verified end-to-end).

Risk Assessment

Medium. The topology flip makes the split run for hipkernelprovider. Verified
safe when rocKE is disabled (generic-only) and when enabled (per-arch routing),
but it hard-requires the rocm-systems handler in the pinned gitlink. Do not merge
before #8347 lands and the gitlink is bumped. Build deps and wheel packaging are
additive and inert until a consumer produces bundles.

Testing Summary

  • build_topology_test.py passes; BUILD_TOPOLOGY.toml and
    artifact-hipkernelprovider.toml parse and expose the target-specific type,
    split_databases, and the **/hip_kernel_provider/rocke/** include.
  • CMake argument-routing check on the hipkernelprovider declare block:
    rocm-kpack/amd-comgr land in deps, -DROCKE_KPACK_PYTHON_DIR resolves.
  • Packaging templates: _dist_info.py registers kpack without collision; both
    dlopen tests add the kpack directory.
  • Paired multi-arch dry-run (gfx94x + gfx950) validates build, split, install,
    and provider tests end-to-end.

Testing Checklist

  • Topology + artifact TOML parse and build_topology_test.py
  • CMake declare-block arg routing (deps + ROCKE_KPACK_PYTHON_DIR)
  • Packaging templates (_dist_info + dlopen search-path in both tests)
  • Multi-arch dry-run: build + per-arch split + install + provider tests (pending)
  • PR CI

Technical Changes

  • ml-libs/CMakeLists.txt (hipkernelprovider): add rocm-kpack + amd-comgr to BUILD_DEPS, rocm-kpack to RUNTIME_DEPS, and -DROCKE_KPACK_PYTHON_DIR.
  • ml-libs/artifact-hipkernelprovider.toml: the default lib component only captures shared libs, so add an explicit include = ["**/hip_kernel_provider/rocke/**"] so the per-arch bundles land in the runtime artifact.
  • BUILD_TOPOLOGY.toml: hipkernelprovider to target-specific + split_databases = ["hipkernelprovider"], with a comment on why it is not arch-neutral.
  • build_tools/build_python_packages.py: add hipkernelprovider to device_artifact_filter (it was already in libraries_artifact_filter).
  • rocm_sdk/_dist_info.py + libraries_test.py + devel_test.py: kpack registration and the cross-wheel dlopen search-path fix.

JIRA ID : AICK-1616

@therock-pr-bot

therock-pr-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 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.

@therock-pr-bot

therock-pr-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

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

@BrianHarrisonAMD BrianHarrisonAMD force-pushed the users/bharriso/rocke-kpack-deps branch from a919909 to c4fd82e Compare July 8, 2026 19:58
@BrianHarrisonAMD BrianHarrisonAMD self-assigned this Jul 9, 2026
@BrianHarrisonAMD BrianHarrisonAMD force-pushed the users/bharriso/rocke-kpack-deps branch from c4fd82e to 9f9aacd Compare July 9, 2026 14:28
The rocke AOT producer packs kernels with rocm_kpack and compiles HSACO via
libamd_comgr at build time. Declare both as build deps of the hipkernelprovider
subproject so they are staged and found: rocm_kpack via ROCKE_KPACK_PYTHON_DIR,
amd-comgr via find_library in rocke_aot.cmake. rocm-kpack is also a runtime dep
(the plugin links the kpack reader); amd-comgr is build-time only.
@BrianHarrisonAMD BrianHarrisonAMD force-pushed the users/bharriso/rocke-kpack-deps branch from 9f9aacd to 527be15 Compare July 9, 2026 14:30
The rocke engine's plugin depends on the kpack runtime, which ships in the core
wheel while the plugin ships in the libraries wheel. On Windows the loader has no
rpath to reach across wheels, so the wheel dlopen tests must add kpack's
directory to the DLL search path when loading a hipdnn plugin.

- Register kpack in rocm_sdk/_dist_info.py so find_libraries locates the
  core-wheel lib (rocm_kpack*.dll on Windows).
- Extend the Windows plugin-load branch in BOTH duplicated dlopen tests
  (libraries_test.py and devel_test.py) to add the kpack directory via
  find_libraries. Generic to any plugin.

Inert until a plugin actually links kpack; verified via a companion
rocm-libraries dry-run.
@BrianHarrisonAMD BrianHarrisonAMD force-pushed the users/bharriso/rocke-kpack-deps branch from 527be15 to baf96f9 Compare July 9, 2026 14:31
BrianHarrisonAMD added a commit that referenced this pull request Jul 9, 2026
Flip HIPKERNELPROVIDER_ENABLE_ROCKE ON and point the rocm-libraries gitlink at
users/bharriso/aick-1471-dryrun-libs (#9207 AOT producer+kpack merged with #9115
enable-rocKE-build + provider-mode test/packaging fixes). #9115 is what makes the
rocKE build/test/package cleanly in provider mode; without it the enabled build
fails. Revert this commit before merging #6427.
BrianHarrisonAMD added a commit that referenced this pull request Jul 9, 2026
Flip HIPKERNELPROVIDER_ENABLE_ROCKE ON and point the rocm-libraries gitlink at
users/bharriso/aick-1471-dryrun-libs (#9207 AOT producer+kpack with the comgr
libclang-cpp LD_LIBRARY_PATH fix, merged with #9115 enable-rocKE-build +
provider-mode test/packaging fixes). Revert before merging #6427.
The rocKE engine ships per-arch AOT bundles (kpack + JSON sidecar + kernel-
selection heuristics) under the engine plugin dir at
lib/hipdnn_plugins/engines/hip_kernel_provider/rocke/<arch>/. These are
ISA-specific, not arch-neutral, so the hipkernelprovider artifact is split
per-arch. Three coupled changes:

- artifact-hipkernelprovider.toml: the default lib component only captures
  shared libraries (*.so/*.dll), so the .kpack/.json/heuristics tree would be
  dropped from the artifact. Add an explicit include of
  **/hip_kernel_provider/rocke/** so the per-arch bundles land in the runtime
  artifact.
- BUILD_TOPOLOGY.toml: flip hipkernelprovider to type = "target-specific" with
  split_databases = ["hipkernelprovider"] so TheRock splits each arch's bundle
  into that arch's artifact via the rocm-systems "hipkernelprovider" kpack
  handler.
- build_python_packages.py: add hipkernelprovider to device_artifact_filter so
  the per-ISA device wheels pick up the arch-tagged bundles in kpack-split mode
  (it was already in libraries_artifact_filter for the arch-neutral/legacy path).

Requires the rocm-systems hipkernelprovider kpack handler, so TheRock's
rocm-systems gitlink must include it before this merges.
@BrianHarrisonAMD BrianHarrisonAMD force-pushed the users/bharriso/rocke-kpack-deps branch from fa7d34f to e6000d9 Compare July 9, 2026 19:42
@BrianHarrisonAMD BrianHarrisonAMD changed the title build(hipkernelprovider): declare rocm-kpack build-time deps TheRock support for rocKE AOT kpack: deps, packaging, per-arch split (AICK-1471) Jul 9, 2026
@BrianHarrisonAMD BrianHarrisonAMD changed the title TheRock support for rocKE AOT kpack: deps, packaging, per-arch split (AICK-1471) TheRock support for rocKE AOT kpack: deps, packaging, per-arch split (AICK-1616) Jul 9, 2026
@BrianHarrisonAMD BrianHarrisonAMD changed the title TheRock support for rocKE AOT kpack: deps, packaging, per-arch split (AICK-1616) feat(hipkernelprovider): rocKE AOT kpack packaging and per-arch split (AICK-1616) Jul 9, 2026
@BrianHarrisonAMD BrianHarrisonAMD changed the title feat(hipkernelprovider): rocKE AOT kpack packaging and per-arch split (AICK-1616) feat(hipkernelprovider): rocKE AOT kpack packaging & arch split Jul 9, 2026
@BrianHarrisonAMD BrianHarrisonAMD force-pushed the users/bharriso/rocke-kpack-deps branch from 36c3870 to ccc6550 Compare July 10, 2026 15:32
…es/arch_content

rocKE's per-arch AOT bundles moved out of engines/hip_kernel_provider/rocke/
(which collided with the hip_kernel_provider plugin file and broke plugin
loading) to a generic per-arch container engines/arch_content/<engine>/<arch>/.
The lib component includes only that container now; it splits per-arch via
split_databases = ["hipkernelprovider"], and future engines (aiter, asm) drop
under arch_content/<engine>/ with no changes.

The earlier include of **/hip_kernel_provider/rocke/** (added with the split)
also pulled the rocKE Python SDK into the runtime lib artifact as a side effect.
The SDK is dev/test content -- already captured by the [test] component -- so
drop it from lib: the runtime artifact now carries only the .so plugins and the
per-arch kpacks.

JIRA ID : AICK-1471
@BrianHarrisonAMD BrianHarrisonAMD force-pushed the users/bharriso/rocke-kpack-deps branch from ccc6550 to b709fdc Compare July 10, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: TODO

Development

Successfully merging this pull request may close these issues.

1 participant