[comgr][hotswap] Prove scratch liveness from current text - #3618
Conversation
7d3e665 to
34bdd98
Compare
8318fad to
6d98b78
Compare
|
CI triage for head |
|
Moved out of draft to test automate-prs-label |
Compute numbered-SGPR and VCC liveness for an entire function with one bounded backward dataflow analysis. Fail closed at unresolved control-flow and register-effect boundaries, account for tied, implicit, pair, and subregister operands, and analyze replacement inputs before selecting scratch registers. Decode the current text generation instead of the original instruction snapshot. Centralize immediate text writes so every mutation clears cached function data, while preserving failure-atomic NOP-sled emission and bounded memory across repeated patches. Cover diamonds, loops, calls, returns, traps, real MC barriers, malformed boundaries, mutation-driven rebuilds, replacement boundaries, SGPR limits, register overlap, and a 16K-instruction scaling case.
4c2c2b1 to
a9e6282
Compare
Claude code review — #3618Posted by @lamb-j (Claude Code), using local Comgr context + Recommendation: approve — no blockers. This is a clean, high-quality fail-closed MC-level SGPR/VCC liveness primitive.
MINOR
NIT
Test coverage is comprehensive: every reject reason and every live/dead verdict class has a case, including the sync-re-decode-after-production-mutation scenario and the SoftFail-cache-hit subtlety. |
…ing) (#6940) ## Summary Bumps `compiler/amd-llvm` from `2a67d831` to `8f497e09`, bringing the **remaining** comgr **hotswap** content from `amd-staging` onto the pin. Cherry-picked on top of the current pin, in `amd-staging` landed order: | PR | Title | |----|-------| | ROCm/llvm-project#3554 | `[comgr][hotswap] Share conservative liveness state` | | ROCm/llvm-project#3555 | `[comgr][hotswap] Size set-PC gateways without assembly` | | ROCm/llvm-project#3562 | `[comgr][hotswap] Scale bounded return analysis` | | ROCm/llvm-project#3556 | `[comgr][hotswap] Cache kernel metadata in one pass` | | ROCm/llvm-project#3274 | `[Comgr][HotSwap] Refactor hotswap related files into their own directory` | | ROCm/llvm-project#3576 | `comgr: share far branch gateways across hotswap sites` | | ROCm/llvm-project#3618 | `[comgr][hotswap] Prove scratch liveness from current text` | | ROCm/llvm-project#3577 | `comgr: handle banked VGPRs in DS and scale16 WMMA rewrites` | | ROCm/llvm-project#3653 | `[Comgr] Add predicate-driven hotswap reducer` | | ROCm/llvm-project#3610 | `[comgr][hotswap] Prove finite indirect control flow` | | ROCm/llvm-project#3673 | `[Comgr] Use StringRef::str() in HotswapMCTest SCOPED_TRACE calls` (gtest portability) | Each carries a `(cherry picked from ...)` provenance line; all applied cleanly with no conflicts (including the #3274 directory refactor and the post-refactor commits). After the picks, the comgr hotswap sources and tests are **byte-identical to `amd-staging`** except the previously-dropped gfx12-5-generic entry-trampoline RUN lines (see #6793) — that trim carried through the #3274 refactor. None of the new commits add gfx1251/gfx12-5-generic coverage. ### Numbering Follows SMP 23.13 (the current pin `2a67d831`), so this is **SMP 23.14**. ISSUE ID: #6235
Scope
Add the fail-closed register-liveness primitive needed to reuse scratch
registers safely in later far-return routing changes. The proof:
overwriting it;
.textbytes soearlier patch writes cannot make a cached decode snapshot stale; and
calls, returns, and unresolved control flow.
This first replacement is based directly on current
amd-staging; laterreplacement PRs will depend on its exact head. It establishes the liveness
prerequisite but does not activate a new corpus rewrite by itself.
Review fixes
The review repair commit
eada1e3b9041:s_rfe_i64as terminating control flow;SoftFailin safety proofs;The branch was then merged with the current target in
065af42b4b0a.Validation
Exact head:
065af42b4b0ae8764b19be22d8d4b6176aeb2b99Exact corpus baseline:
39f443516c145f27e2255a41a232d565c9acb409All qualification checkouts and builds were created on
mi300x.HotswapMCTests: 143/143 passedHotswapMCTests: 143/143 passedclang-format,git diff --check, focused review, and two independentsibling reviews: clean
Corpus qualification status
Both exact baseline and candidate runs evaluated the same 2,685 paths with the
audited four-gate harness, four workers, 1,800-second rewrite timeouts, and no
exclusions:
failures.
improvements and no strict reduction in the failing set.
The failed improvement gate remains a blocker to an independent
QUALIFIEDverdict, but under the revised qualification procedure it does not stop
MI400-3 functional testing.
MI400-3 qualification status
The complete original-library baseline and isolated candidate matrix is complete
on the current Confluence image. Because the original-library sparse suites
aborted, the authoritative candidate matrix was rerun in a second fresh
container as required by the qualification procedure.
Candidate library SHA-256:
960b67ac1ceb80b74d325730d548171efec6c2c75196d16ae664b24c05792663The selected quick counts reflect the current procedure: hipTensor uses the
exact
^quick$label; rocPRIM, rocThrust, and the remaining suites use thecurrent
quickselection, includingffm-quickwhere applicable.Blocking MI400-3 findings:
test_device_partition_gpus_quick_suite,timed out at 300.11 seconds in the isolated full matrix. A focused fresh
A/B subsequently passed with both the original library (92 seconds) and the
exact candidate (94 seconds), so the timeout was not reproducibly
candidate-specific; the recorded required-matrix timeout still blocks.
HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION, matching the original-libraryfailing cases and failure class. hipSPARSE test Drano integrated w/ AMD llvm, basic functionality working. #9 took about 228 seconds
with the candidate versus 3.5 seconds in the original baseline.
reset or device loss occurred.
MI400-3 therefore FAILS its required pass gate. Together with the failed
corpus improvement gate, PR #3618 is NOT QUALIFIED independently. The
corpus safety gate remains PASS: no new or worsened corpus failures.