shader(gfx10): cross-validate the opcode and field tables against AMD's machine-readable ISA XML #650
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS#650
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@AnastasisKon on GitHub · 2026-11-28 21:34 UTC · original
What
The gfx10 decoder (crates/victory-shader/src/gfx10/fields.rs, opcodes.rs) is hand-written. AMD publishes the RDNA2 ISA as a machine-readable XML (MIT licence, gpuopen "Machine-Readable ISA"), and XCL generates its whole RDNA2 spec from it (scripts/gen_rdna2.py: primary encodings emitted with operands, literal/SDWA/DPP/NSA variants derived at decode time exactly as hardware does, always-literal instructions flagged). A decode bug in a hand-written table becomes a wrong shader with no signal.
What this changes
An xtask command or test that parses the XML and diffs our opcode list and field encodings against it, reporting every mismatch. Not a rewrite of the decoder — a cross-check. Policy question to settle in the PR: the XML is vendored under its MIT licence or fetched at test time and never committed (cargo xtask policy is the gate).
How it was tested
Sources: MacBox scripts/gen_rdna2.py, tests/data/llvm-amdgpu/ (they also carry LLVM's disassembly test data as a second corpus — gfx10_vop1/2/3, sopk, smem, mimg, mtbuf, sdwa...).
@AnastasisKon on GitHub · 2026-11-29 08:59 UTC · original
/claim
The XML is fetched (AMD's machine-readable archive, gpuopen.com/download/machine-readable-isa/latest/, MIT, release 2026-02-20): amdgpu_isa_rdna2.xml, ~11 MB. Plan: an xtask command that takes the XML's path (never committed — policy stays clean), parses its instruction list and diffs it against our gfx10 tables, reporting every mnemonic we do not decode and every name of ours the spec does not carry. Opcode-value comparison for the main encodings follows if the first cut finds the tables sound.
@github-actions[bot] on GitHub · 2026-11-29 08:59 UTC · original
Claimed by @AnastasisKon. Open a draft pull request with
Refs #646in its description within 24 hours, or the claim expires.@AnastasisKon on GitHub · 2026-11-29 09:05 UTC · original
Done — landed on the fork's main as commit 38e5b416 (shader(gfx10): cross-check the opcode tables against AMD's machine-readable ISA).
The archive: AMD's machine-readable ISA download (gpuopen.com/download/machine-readable-isa/latest/ — it serves a zip containing amdgpu_isa_rdna2.xml, MIT, release 2026-02-20, 11 MB). The policy question the issue raised is settled the clean way: fetched at test time, never committed — the test is gated on VICTORY_AMD_ISA_XML naming the XML's path, skipped without it, exactly as the repo's real-file tests are.
What it holds, measured against that release:
Run: VICTORY_AMD_ISA_XML= cargo test -p victory-shader the_tables_match. Gate green in isolation with the real XML in the run, plus the full usual suite (native, x86_64-apple-darwin, clippy gnullvm, xtask policy, shell tests).