Skip to content

docs(hipdnn): RFC 0021 kernel slots (ALMIOPEN-2922) - #13839

Merged
BrianHarrisonAMD merged 6 commits into
developfrom
users/bharriso/rfc-kernel-slots
Oct 28, 2026
Merged

BrianHarrisonAMD merged 6 commits into
developfrom
users/bharriso/rfc-kernel-slots

Conversation

@BrianHarrisonAMD

@BrianHarrisonAMD BrianHarrisonAMD commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Proposes RFC 0021: one hipDNN engine runs several kernels in a fixed order, and each position (slot) selects its kernel independently. Split SDPA backward (prep, dK/dV, dQ) is the first intended user. The implementation is #13972, stacked on this PR.

JIRA ID : ALMIOPEN-2922

Risk Assessment

Risk 1: documentation only. No code, schema or build change.

Testing Summary

  • Docs only: pre-commit passes, and the PR checks pass.

Testing Checklist

  • pre-commit - pre-commit run --files projects/hipdnn/docs/rfcs/0021_KernelSlots.md projects/hipdnn/docs/rfcs/0017_UniversalKernelDescriptor.md - Status: Passed
  • PR CI - GitHub PR checks - Status: Passed

Technical Changes

  • New RFC 0021: an engine declares ordered slots, each with its own kernels, ranker and knobs. Engines without slots are unchanged.
  • Benchmarking times whole programs, varying one slot at a time instead of timing every combination.
  • Slots compose with multi-launch sources (RFC 0017 section 15.1): a slot may select a multi-launch kernel, launch sets are checked per slot, and each slot has its own dispatch descriptor. A slot's handler may also launch dependent kernels by symbol.
  • Versions are per file type: UED, KDP and UHD files that use slots are 1.1; a UKD is 1.1 when it carries sources, independent of slots.
  • Section 10 lists the public surface changes and how to adapt; section 8 states the producer packing policy; section 11 records deferred work, including saving a slotted plan (RFC 0009).
  • RFC 0017 points multi-kernel work to RFC 0021.

@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/rfc-kernel-slots branch from c5108a6 to a980757 Compare October 16, 2026 19:16
@BrianHarrisonAMD
BrianHarrisonAMD changed the base branch from users/jascampb/uhd-initial-runtime to users/jascampb/uhd-initial-tooling October 16, 2026 19:16
@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/rfc-kernel-slots branch 2 times, most recently from 471117c to 0f680f4 Compare October 19, 2026 23:09
@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/rfc-kernel-slots branch from 0f680f4 to 82b66f3 Compare October 21, 2026 23:20
GarbyGilbertAMD added a commit that referenced this pull request Oct 22, 2026
#14158)

## Summary

A kernel whose operation runs as a fixed sequence of kernels (for
example a split-KV segment kernel and its reduce kernel) had no
sanctioned way through the descriptor and ingestor path. This adds the
kernel-descriptor half of RFC 0017 §15.1: a UKD may carry a `sources`
map keyed by launch name in place of `kernel_source`, the packer and the
IngestorGenerator can produce it, and a native dispatch handler can
launch each stage through the existing kpack path.

JIRA ID : ALMIOPEN-2973

Launch order, workspace sizing and the hand-off between stages stay with
the pack's native dispatch handler. No generic launcher or
intermediate-buffer model is added. Descriptors without `sources` load,
pack and generate exactly as before.

Related: RFC 0017 §15.1, PR #13897 (the "companion kernel" change this
lets integrate through a smaller mechanism), RFC 0021 (PR #13839, kernel
slots), PR #13895 (rocKE kernels that motivate it).

## Risk Assessment

Risk 3 of 5. It adds a UKD 1.1 key, a defaulted virtual to the plugin
SDK's `IKernelDispatchHandler`, and touches the loader, state manager,
packer, generator and descriptor validator. Single-launch paths are
unchanged, and a runtime that predates the key skips a 1.1 file at its
version gate instead of loading it as a broken single-kernel descriptor.
The breadth, not any one change, is the reason it is not lower.

## ASIC Coverage

The change is architecture-independent plumbing: descriptor parsing,
catalog building, packaging and generation. It adds no kernel, no
support surface and no selection or default change. Passing PR CI is
sufficient; no ASIC-specific or multi-arch run is required.

The device-backed provider tests added here (two launches resolving out
of one loaded module, a wrong recorded signature refused before load)
passed.

## Testing Summary

- Loader: `sources` accepted from a file, an inline entry and the pack
scan path; malformed forms refused (both or neither of
`kernel_source`/`sources`, a single entry, a bad launch name, a
non-kpack entry, `sources` under version 1.0). One kernel under two
launch names loads.
- State manager: a kernel whose launch names differ from its pack's
handler is dropped before applicability and before it claims a metadata
tuple, in both directions and for equal counts under other names. A
kernel under two launch names is kept, and `launchKernelDefinition`
returns the same kernel for both.
- Provider: `launchKernelDefinition` and the refusal of a kernel that
still carries `sources`.
- Packer: claim check against the distinct kernels produced, swapped or
dropped launches and signatures that disagree with the object failing
verification, compile-once per variant, every reader of `kernel_source`
handling or refusing `sources`, per-launch consumer agreement, and three
closed refusals for authored `hip`/`hsaco`, `embedded_source` and
`kpack` entries. A same-kernel-twice bundle packs and passes `desk_check
--mode full`.
- Real-compiler pack: a loader-valid rocKE fixture (primary `decode`,
companion `merge`) and a same-kernel-twice fixture pack with the real
compiler on the login node (no GPU) and pass `desk_check --mode full`;
`hipdnn_validate_descriptors --expect-engine` on both packed trees exits
0.
- Probe: derive and assert for launches, including the symbol each
launch must have according to the compiler record.
- Generator: `launches` validation (equal launches accepted), identity,
factorise and diff round trips, generated stub and census test; configs
without `launches` generate as before. `verify_variant_sets` checks
every launch of a multi-launch descriptor, in structural mode on a
generated bundle and in full mode on the real-compiler pack.
- Descriptor validator: a multi-launch smoke root (one kernel under two
launch names too) loads and is kept; kernels of one pack that name
different launch sets are rejected.

## Testing Checklist

Host evidence is from the local branch on a login node; the
device-backed provider tests ran separately and passed. Branch base is
`develop` at `1ba4a93`.

- [x] Plugin SDK tests - `hipdnn_plugin_sdk_tests` - Status: Passed
(1233 passed)
- [x] hip-kernel-provider tests - `hip_kernel_provider_tests` - Status:
Passed (959 passed; host, no device)
- [x] CTest - `hip-kernel-provider` 23/23 and `tools` 7/7 - Status:
Passed
- [x] Packer suite - `pytest tests` in `descriptor-packaging` - Status:
Passed (940 passed, 57 skipped)
- [x] Probe tests - `pytest probes/tests` - Status: Passed (156 passed)
- [x] IngestorGenerator suite - `pytest tests` - Status: 1312 passed, 5
skipped, 6 failed. The 6 failures are `tests/test_packs_formatting.py`
and also fail at `develop` `1ba4a93`.
- [x] clang-tidy ON build - Status: Passed (exit 0)
- [x] Real-compiler pack and load - Status: Passed (two fixtures packed
with comgr, validator exit 0). This proves load and keep in the state
manager. It does not prove equality with a real handler's launch set
(the validator's stub copies the pack's own launch names), and it does
not prove module resolution from the packed archive on a device.
- [x] Device-backed provider tests - Status: Passed
- [ ] PR CI - hipDNN Superbuild CI - Status: Not run. It is the covering
CI for the C++ and tool changes. At the pinned TheRock ref the ingestor
flag is OFF, so that build does not compile this code until the pin
moves; TheRock main enables the flag by default after PR #9375.

## Technical Changes

- **Loader (`plugin_sdk`).** `KernelDescriptor` and `KernelDefinition`
gain `sources`. A UKD carries exactly one of `kernel_source` or
`sources`; `sources` needs UKD 1.1, at least two entries, a
lowercase-identifier launch name (`^[a-z][a-z0-9_]*$`) per entry and a
complete `kpack` source per entry. One kernel may appear under two
launch names, for a stage that runs one kernel twice with different
arguments. The loader accepts any `kpack` entry. `UKD_VERSION_MINOR` is
1.
- **Launch names declared by the handler.**
`IKernelDispatchHandler::launchNames()` (empty by default, so no
existing handler changes) names the launches a handler launches. It is
provisional until a `launches[]` dispatch descriptor exists. The state
manager drops a kernel whose launch-name set differs, with an error
naming both sets, so an accepted kernel is always launchable (RFC 0017
§8.6). The descriptor validator's stub handlers declare the names their
pack's kernels carry.
- **Provider.** `launchKernelDefinition(kernel, "merge")` returns the
definition of one launch for `buildIngestorKernelCode`, which refuses a
kernel that still carries `sources`.
- **Packer.** `hkp_pack` packs a `sources` map of `rocke` entries;
authored `hip`/`hsaco` entries are a next change, `embedded_source` is
never packed and `kpack` entries are not pack input (three closed
refusals). An entry takes its builder's primary kernel, or a companion
kernel with `role`. Entries with the same source, builder, spec and
target compile once and share a library, toc key and digest. For each
compile the distinct kernels the entries claim must equal the kernels it
produced, naming both lists on a mismatch. Packed symbols and signatures
are read from the compiled object. Evidence is recorded per launch;
verification binds each entry to its own evidence and to the kernels the
object exports.
- **Consumer agreement.** The UKD has one consumer metadata declaration.
Each declared field must be reported by at least one launch, and every
launch that reports it must match the metadata. A launch whose spec
lacks the attribute does not report it, and a field no launch reports
fails. Single-launch UKDs keep the strict rule.
- **Probe.** Derive and assert understand `sources`: expected launch
names with their roles, each launch's symbol against the compiler
record, each launch's signature against the archive blob.
- **IngestorGenerator.** A `rocke` `kernel_source` (or
`kernel_defaults`) may carry `launches`. The generator emits `sources`
and stamps 1.1 on that descriptor only. A launch `spec` is static, and
stating a metadata field at a value that differs from the variant is a
`ConfigError`. All kernels of an engine must name the same launch set,
because one handler declares one set. `verify_variant_sets` keys a
multi-launch descriptor by its launch names and per-launch (builder,
spec, role) and checks every launch.
- **Descriptor validator and tests.** A multi-launch smoke root and
CTest case, and a real-compiler pack test with loader-valid fixtures.
- **Docs.** RFC 0017 (§4, §7, §8.5, §8.6, §15.1, §15.4, §15.5, §17), the
packaging reference and the IngestorGenerator reference.

## Notes for reviewers

- Decisions (D1-D4):
- D1: kernel slots (RFC 0021, PR #13839) and `sources` are orthogonal
and both stay. A slot selects among UKDs; a UKD with `sources` is one
selection that launches several kernels of one multi-stage kernel.
Replacement wording for 0021 is drafted separately; RFC 0021 is not
edited here.
- D2: launch names are declared by the pack's native handler
(`launchNames()`) until the dispatch descriptor's `launches[]` program
exists.
- D3: one kernel may appear under two launch names. The loader still
requires at least two entries, lowercase-identifier launch names,
complete `kpack` entries, consumer agreement, compile-once dedup and the
same launch set for every kernel of a pack.
- D4: authored `sources` entries are `rocke` only here; `hip` and
`hsaco` entries are a next change (hsaco: ALMIOPEN-2921).
- The dispatch-descriptor half of §15.1 (`launches[]`, `intermediates`,
the cross-step checks) is deferred. The native handler launches the
entries.
- No host check proves equality between a pack's launch set and a real
handler's; the validator's stub copies the pack's own set.
- #13897 would need to split its prefill and decode packs, because a
variant with a different launch count belongs in its own pack, and move
from the KMD `merge_symbol`/`merge_signature` fields to `sources`. That
migration belongs to that PR.

---------

Co-authored-by: Brian Harrison <brian.harrison@amd.com>
Base automatically changed from users/jascampb/uhd-initial-tooling to develop October 23, 2026 04:24
@therock-pr-bot

therock-pr-bot Bot commented Oct 23, 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

therock-pr-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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

@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/rfc-kernel-slots branch from 82b66f3 to 1df8f3a Compare October 24, 2026 19:12
BradPepersAMD added a commit that referenced this pull request Oct 25, 2026
RFC 0021 §3 (kernel slots, draft #13839) names "one UKD whose code object holds
the dependent kernels, launched by symbol names its KMD records" as an accepted
alternative to RFC 0017 §15.1 `sources`, with a split-KV kernel and its
reduction as the example: FlyDSL's decode and RMSNorm backward objects. The
note now says so, and that a move to hsaco `sources` entries (#14215) is
optional.

JIRA ID: ALMIOPEN-2953

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/rfc-kernel-slots branch 3 times, most recently from c28e126 to 2f60cfd Compare October 25, 2026 22:27
dpeabody-amd added a commit that referenced this pull request Oct 26, 2026
…ew rocKE kernels; retire wmma_fmha_fwd (#13897)

ISSUE ID : AICK-1847

## Summary
Moves the RDNA SDPA hipDNN catalog onto the rocKE `wmma_fmha_fwd_v2`
prefill and `wmma_fmha_decode` split-KV decode kernels (#13895), then
removes the old single-wave `wmma_fmha_fwd` kernel that only this
catalog and the pinned SDPA reference cohort still used.

The split-KV decode launches two kernels (the decode and the merge of
its splits). It uses the multi-launch mechanism from #14158 (RFC 0017
§15.1): a `sources` map keyed by launch name, in one code object, with
the launches declared by the engine's native handler. One engine has one
launch set, so the catalog is now two engines.

## What changes
- **Engines.** `hipkernel:Gfx1151WmmaAttention` is the prefill (one
launch, `kernel_source`). New `hipkernel:Gfx1151WmmaAttentionDecode` is
the decode: each kernel carries `sources` with a `decode` launch and the
`merge` companion kernel, and the handler's `launchNames()` is `{decode,
merge}`. Generator configs: `configs/gfx1151_wmma_attention.yaml` and
`configs/gfx1151_wmma_attention_decode.yaml` (`kernel_defaults.launches:
{decode: {}, merge: {role: merge}}`). Each family ships 36 prefill and
18 decode objects, down from 64 (gfx11) / 56 (gfx12) before.
- **Native** (`Gfx1151WmmaAttentionNative.cpp`, both engines over one
matcher core). The decode engine serves exactly the problems rocKE's
`rdna_attention_use_decode` routes to decode, in the bucket
`wmma_fmha_decode_bucket` picks. The prefill engine declines those
problems, so hipDNN's choice between the two engines never depends on
ranking. Decode launches through `launchKernelDefinition(kernel,
"decode")` / `"merge"`. More than one split always merges in the merge
launch (the hipDNN workspace is not zeroed), so decode asks for a
workspace.
- **Scale.** The engines decline a constant softmax scale <= 0 and
return `BAD_PARAM` for such a runtime scale.
- **SDPA pinned reference cohort** (`tests/sdpa_reference`): the
gfx1151/gfx1200/gfx1201 current-source adapter moves from the retired
kernel to `wmma_fmha_fwd_v2` under a new `wmma-strided-v3` ABI. Frozen
v1/v2 replay and the old-snapshot preparation path are unchanged.
- **Tests that read shipped descriptors**
(`test_desk_check_rocke_corpus.py`, `test_hkp_pack_producer_guards.py`)
now read a multi-launch kernel's `sources`; this catalog is the first
shipped one.
- **Removal:** `kernels/gfx1151/wmma_fmha_fwd.py`,
`helpers/wmma_swapqk.py`, their C mirrors and headers, parity pairs,
tests, goldens and research drivers that only served them.

Dropped relative to the earlier revision of this PR: the
companion-kernel packaging in hkp_pack, the IngestorGenerator
`companion_kernels` / group-level `kernel_source` keys,
`CompanionKernel.hpp` and the `<role>_symbol` / `<role>_signature`
metadata. #14158 replaces them.

### Behaviour and API changes
- hipDNN decode now requests a workspace.
- Decode moves to its own engine
(`hipkernel:Gfx1151WmmaAttentionDecode`); anything selecting engines by
name must know both.

## Notes
- Kernel slots (RFC 0021, #13839) are not needed: #14158 (D1) makes
`sources` and slots orthogonal, and nothing here uses a slot.
- Both engines use `heuristic: native` (a score function), so no UHD
model is needed to land this. A UHD id and trained models for them would
be a follow-up.
- The pinned reference archives for gfx1151 and gfx1201 (DVC) have not
been re-qualified against the v3 adapter; the cohort baselines were
qualified against the retired kernel.

## Validation (on this content, Linux, Slurm compute nodes)
- hipDNN configure with the CI configuration (clang-tidy 20 on,
`HIPDNN_ENABLE_KERNEL_INGESTOR=ON`, rocKE on, gfx1100/gfx1201 shards):
everything builds except two translation units that this toolchain
cannot compile (libstdc++ 14 `<chrono>` under C++20:
`hipdnn_frontend_runtime_load_header_cpp20` and one `rocke_core_objects`
source), which this change does not touch.
- `hip_kernel_provider_tests` `TestGfx1151WmmaAttention*`,
`TestLaunchKernelDefinition*`, `TestIngestorKernelCode*`: 58/58. Census
for both engines on the gfx1100 and gfx1201 shards: 30/30. `hkp-pack`,
`hkp-probe` and census ctests: 41/41.
- IngestorGenerator pytest: 1220 passed; the 4 errors are the
real-compiler multi-launch tests, which need `hipcc`. SDPA reference
host suites (`test_sdpa_reference_contract.py`,
`test_sdpa_pinned_reference.py`, `test_reference_common.py`): 446
passed, 48 skipped.
- GPU, hipDNN integration harness with 74 SDPA graph cases (prefill,
decode, GQA, windows, bias, LSE, head widths up to 256), each pinned to
each engine: on gfx1151 the prefill engine served 40 and the decode
engine 34; on gfx1201 36 and 38. Every case was served by exactly one
engine and verified against the GPU reference; no failures.
- Not run: the pinned reference archives (DVC) for gfx1151/gfx1201
against the v3 adapter; gfx1100, gfx1101 and gfx1150 hardware.

## ASIC coverage
Same objects as #13895: gfx11-generic (GPU-verified on gfx1151) and
gfx12-generic (GPU-verified on gfx1201).
adickin-amd added a commit that referenced this pull request Oct 26, 2026
…ire plans for new ops

- Rename to 0022 (0021 is taken by kernel slots, #13839).
- Add the status header and the index row.
- Fix the RFC 0011 link (0011_BundleTestFramework.md).
- Link every section and RFC reference.
- Add 16.2: a new op cannot land without a test plan and its bundles.
@BrianHarrisonAMD
BrianHarrisonAMD marked this pull request as ready for review October 27, 2026 16:19
@BrianHarrisonAMD
BrianHarrisonAMD requested a review from a team as a code owner October 27, 2026 16:19
…er engine

Adds RFC 0021 and the RFC 0017 edits it needs. An engine declares ordered
slots, each with its own KMD, knobs, ranker and catalog. The engine's
kernel choice is the per-slot picks run as one program that shares a
workspace region. Unslotted engines are unchanged.
…rules

Specifies the shared-workspace token checks and offsets, how the
workspace limit applies to a kernel and to the engine, when a program
record is valid and how slot and program records are appended, and the
reference-pick rules for benchmarking and sweeps.
…shard path wording

A slot ranker that reads a ws.* token is disabled at load and refused by
the validator, because the root is reserved. The runtime
also checks the offset tokens, not only the size token. The cache shard
path uses one digest over every slot's name and rankers.
…nges

States what the packer checks for a slotted engine: it mirrors the shape
and resolvable rules, and the loader stays authoritative for runtime
binding, native registrations, per-arch collisions and empty slots.
Adds a table of the public surface changes with how to adapt.
RFC 0017 now ships the kernel-descriptor half of multi-launch (UKD 1.1
`sources`, #14158) and states that kernel slots are orthogonal to it.
RFC 0021 no longer claims to replace RFC 0017 section 15.1: a slot
selects one UKD, and that UKD may carry `sources`. The launch-set check
runs per slot pack, so packs with different launch sets name different
dispatch descriptors. A multi-launch slot kernel reports the scratch of
all its launches. Descriptor versions are per file type (UKD 1.1 means
`sources`; UED, KDP and UHD 1.1 mean slots).

Dependent kernels in one slot can also be one UKD whose code object
holds them, launched by symbol from the slot's native handler. That form
serves `hsaco` code objects, which a producer does not pack into
`sources`.

RFC 0017 gains a roadmap row and a composition note pointing at RFC 0021,
and the slotted workspace sentence in section 8.4.
CatalogGraphStage carries one first-pack position per slot and the
slotted decline reason and shared workspace size, because staged
applicability covers slotted engines. KernelIngestorStateManager::cacheKey
takes an optional slot. Saving a slot program under RFC 0009 is deferred:
a slotted engine does not advertise plan serialization and its plans are
not saved.
@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/rfc-kernel-slots branch from 2f60cfd to bcd1c83 Compare October 27, 2026 21:08

@GarbyGilbertAMD GarbyGilbertAMD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@BrianHarrisonAMD
BrianHarrisonAMD merged commit 2f0b99d into develop Oct 28, 2026
33 checks passed
@BrianHarrisonAMD
BrianHarrisonAMD deleted the users/bharriso/rfc-kernel-slots branch October 28, 2026 15:54
BrianHarrisonAMD added a commit that referenced this pull request Oct 28, 2026
# Conflicts:
#	dnn-providers/hip-kernel-provider/src/tests/CMakeLists.txt
GarbyGilbertAMD added a commit that referenced this pull request Oct 30, 2026
… launch-set checks and an end-to-end test (#14215)

## Summary
Follow-ups to #14158 (multi-launch `sources` kernel descriptors). A
`sources` map may now author `hip` and `hsaco` entries as well as
`rocke`, so a HIP or prebuilt-code-object multi-stage kernel can go
through the packer. The packer refuses a pack in which kernels served by
one dispatch handler name different launch sets. A device test runs a
packer-built multi-launch kernel end to end through an engine, with a
workspace hand-off between its launches. Saving an execution plan of a
multi-launch kernel is refused for having several launches, rather than
as an `embedded_source` kernel. The remaining review items from #14158
are closed with tests, tooling fixes and docs.

JIRA ID : ALMIOPEN-2973

## Risk Assessment
Risk 3 of 5. The change extends the packer (`hkp_pack`) and
IngestorGenerator with a new authoring path, adds a pack-time refusal,
and adds three inline helpers to the plugin SDK ingestor headers.
Single-launch descriptors and rocke `sources` pack and load as before;
the state manager's launch-set and adaptability rules are unchanged and
only move into shared helpers. The new packer refusal can fail a pack
that used to succeed, but such a pack already had kernels dropped at
load. Execution-plan saving refuses a multi-launch kernel with the same
status as before and a corrected message, and the serialization behavior
note is unchanged for every engine. Consumer-agreement evidence stays
rocke-only, so hip/hsaco `sources` kernels are treated like their
single-launch counterparts (a declaration with `metadata_fields` over
them is refused). The packer, the state manager and the validator also
overlap with the open kernel-slots implementation (#13972), so whichever
lands second will need a rebase.

## ASIC Coverage
Host-side packaging, loading, plan-save checks and tooling, plus a
test-only fixture. No kernel, support surface, selection rule or default
changes. Passing PR CI is sufficient. The device tests also ran and
passed on gfx90a.

## Testing Summary
- End to end on device: `TestMultiLaunchEndToEnd` loads a UKD 1.1 hip
`sources` kernel packed by `hkp_pack` (two launches on one translation
unit, one code object, two symbols), selects it through an engine with a
test-only dispatch handler, and executes it. The first launch writes the
workspace and the second reads it. The asserted output is reachable only
if both launches run, in order, over one workspace. Host-only cases
check that a handler declaring fewer launches drops the kernel and logs
both launch sets.
- Plan saving: a plan over a multi-launch kernel whose launches are all
kpack is refused for having several launches, and the message does not
call it an `embedded_source` kernel.
- Packer: hip and hsaco `sources` (compile and read once per shared
source, per-launch symbol and signature, provenance, desk check,
refusals for `role`, a missing hsaco arch, mixed kinds and
`metadata_fields`). Also the pack-time launch-set check, including two
KDPs that share one UDD and two UDDs that name one dispatch symbol, and
kills for previously surviving mutants: compile grouping by library and
toc key, the desk-check reader per launch, and launch-order
insensitivity.
- Probes: hip and hsaco launches checked by archive membership, digest,
symbol and signature without rocke evidence; rocke evidence still
required. Also per-launch sweep keys and group keys, and launch-order
insensitivity.
- IngestorGenerator: the generated multi-launch `launchNames()` stub is
now compiled, its census arm parsed, and its launch set checked against
the config. `launches` on hip and hsaco kernel sources is accepted.
`verify_variant_sets` keys hip and hsaco launches by their own identity
and ignores `sources` key order.
- Validator: a committed fixture whose kernels name different launch
sets fails validation and names both sets.
- Mixed-version check (manual): a validator built from develop just
before #14158 skips UKD 1.1 kernels with a version warning instead of
misloading them. A pack holding only 1.1 kernels is dropped; in a mixed
pack its 1.0 kernel is kept.
- Mutation checks: every new test was run against a targeted source
mutant and failed. Examples: state manager keeping every kernel, plan
passing no workspace, every launch given the first launch's symbol,
signatures keyed per code object instead of per symbol, plan capture
reading the kernel's `source` instead of its launches.
- Review follow-ups from #14158. The new tests cover:
- each launch's symbol, toc key and sha256 changing the engine-selector
revision;
- a device-free check that each launch's signature is checked against
its own expected signature before its archive is opened;
- the desk check catching a toc key shared between a single-launch
kernel and one launch of a multi-launch kernel;
- an accessor that raises AttributeError failing the observation instead
of counting as unreported;
  - empty launch `target`/`role` overrides being refused;
  - a nesting case that differs only in a launch name.

  Each was run against a targeted source mutant and failed.

## Testing Checklist
- [x] hipDNN superbuild, Linux, kernel ingestor, tooling tests and rocKE
ON, GPU hidden - `ctest --test-dir build --output-on-failure
--no-tests=error` - Status: Passed (236 registered; the 3 skips are 2
sample tests and the rocKE arch-domain reproduction test, none of them
changed here)
- [x] Multi-launch and plan-save device tests -
`hip_kernel_provider_tests
--gtest_filter='TestMultiLaunch*:TestLaunchKernelDefinition*:TestIngestorPlanCapture*:TestRestoredIngestorPlan*:TestIngestorPlanRoundTrip*'`
- Devices: gfx90a - Status: Passed (26/26)
- [x] IngestorGenerator suite - `ctest -R
hipdnn_ingestor_generator_pytest` (strict skips) - Status: Passed (1545
passed, 0 skipped)
- [x] Packer, probe and validator suites - `ctest -R
'hkp|probe|validate_descriptors'` - Status: Passed
- [x] pre-commit - GitHub check - Status: Passed
- [ ] PR CI - GitHub PR checks - Status: Pending

## Technical Changes
- **`hkp_pack`:** authored `sources` entries may be `hip` (`source`,
`entry`, `build`) or `hsaco` (`file`, `symbol`), one kind per map.
Entries sharing a translation unit and build, or an hsaco file, share
one code object and toc key; each launch keeps its own symbol and
signature. Provenance records each launch's authored identity under
`provenance.sources`. `role`, consumer agreement and `check_claims` stay
rocke-only; `embedded_source` and authored `kpack` entries stay refused.
- **Pack-time launch-set check:** within an arch shard, every kernel
served by one dispatch symbol (the `dispatch_symbol` of its KDP's UDD,
which is how the loader resolves the handler) must name one launch set
(a single-launch kernel's set is empty); otherwise the pack fails naming
the symbol, each KDP and each kernel's set. KDPs that share a UDD, or
name one symbol from two UDDs, are held to one set. The check sees one
packaging root, so two roots that register the same symbol are not
compared. The probe end-to-end fixture's fused multi-launch KDP gets a
UDD of its own, since its single-launch siblings share the original one.
- **Plugin SDK:** `Descriptors.hpp` holds the readers of a kernel's
launches. `launchNamesOf()` builds a kernel's launch-name set, for the
state manager and `hipdnn_validate_descriptors`. A multi-launch kernel
leaves `source` default, which reads as an `embedded_source` kernel, so
`singleLaunchSource()` returns a single-launch kernel's one source and
null for a multi-launch kernel, and `allLaunchSources()` tests every
launch. The state manager's adaptability check, `buildForSourceKind`,
plan capture and the serialization behavior note read through them; the
engine-selector digest still hashes both fields as before.
- **Execution-plan saving:** the saved payload holds one kernel image,
so capture refuses a multi-launch kernel for having several launches
instead of reading its default `source`. Saving these plans is tracked
in ALMIOPEN-3031.
- **Probes:** `Kind.launch_evidence` decides whether a kind's launches
carry rocke effective-spec evidence; hip and hsaco launches get the
structural per-launch checks.
- **IngestorGenerator:** `launches` on hip and hsaco kernel sources,
with per-kind override keys; `verify_variant_sets` identities for hip
and hsaco launches.
- **Tests and fixtures:** new `multi_launch` descriptor set, packed
beside the unit and integration roots so no Container loads it;
validator fixture `multi_launch_mismatch`; the `_restamp` test helper
moved to `pack_helpers.py`.
- **Docs:** RFC 0017 §15.4/§15.5 corrected and the accepted `sources`
kinds stated; RFC 0009, the provider README and the plugin development
guide state that a multi-launch kernel's plan cannot be saved yet; a
worked multi-launch handler in the ingestor-engine `native-pack.md`
guide; packaging, generator and fixture READMEs updated.
- **Review follow-ups (#14158):**
- The desk check's toc-key uniqueness now counts two kernels as one when
any launch of one shares a toc key with any launch of the other.
  - Unknown `sources` kinds share one refusal message.
  - Empty launch `target`/`role` overrides are refused.
- `launchKernelDefinition` no longer copies the `sources` map only to
discard it.
- The RFC 0017 §15.1 example is marked abridged, and the "fill every
Launch" loader check is described as arriving with `launches[]`.

Related: #14158 (multi-launch kernel descriptors), #13315 (saving and
loading ingestor execution plans), #13839 (RFC 0021, kernel slots),
#13972 (kernel-slots implementation), #13897 (RDNA SDPA catalog, a
future `sources` user).
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

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.

2 participants