RDNA2 771/779: s_bfe and v_cvt_(pk)norm references confirmed on RDNA2 hardware #78
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!78
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/78/head"
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?
@SchmashinPrunes on GitHub · 2026-11-22 00:40 UTC · original
SchmashinPrunes:rdna2-hw-refs→main· +956 −28 · 12 files · 96 commits · closed without merging@omonkeyz, this closes the two "RDNA2 instructions held at yellow" entries in BLOCKERS with measurements from real RDNA2 hardware. It also explains why the RDNA2 map can't honestly reach 100%.
Library / area: tombox-xshader tests (ISA sweep) and the progress data. No translator change.
Exports changed (exports.txt rows): none
Source of the behaviour: results recorded on RDNA2 silicon, the gfx1036 iGPU of a Ryzen 5 9600X (Linux Mint, ROCm/HIP 5.7.1). They came from the
sbfeandnormprobes oftools/rdna2-hwprobe/valu_probe.py(#72 by @QuentinDanblon), posted in #41. No game or console files are involved.Scope: gfx1036 is RDNA2 but not the console's GPU (gfx1013), so "confirmed on silicon" here means RDNA2 hardware (gfx1036), not a console measurement.
Dependency: the Rust test is self-contained and runs on main as is. Only the generator
tools/rdna2-hwprobe/sweep_vectors.pyneedsvalu_probe.py, which arrives with #72 (stacked on #41), so it can't run until those land.Why these were held
BLOCKERS held
s_bfe_*(the width ≥ 32 rule) andv_cvt_norm/v_cvt_pknorm(the rounding) because neither rule had been confirmed on silicon. The sweep already passes all 10 mnemonics on WARP against its reference modelsops_s::bfe64andops_v::norm16. What was missing was evidence that those models match hardware. This PR adds it.What RDNA2 does
s_bfe_{u,i}{32,64}: the width is the full 7-bit field. A signed field that reaches the top bit sign-fills. Junk in the unused S1 bits is ignored. SCC = result != 0. All 152 measured cases matchbfe64, which is the translator's behaviour since8491769.v_cvt_norm_*/v_cvt_pknorm_*: the exact value rounded to nearest, and NaN gives 0. The only exact ties are ±0.5, where ties-to-even and ties-away agree.v_cvt_norm_*keeps the upper half of D. This matchesnorm16(and sotb_nrm) everywhere.Change
tests/isa_sweep/rdna2_hw.rs: the hardware record, generated bytools/rdna2-hwprobe/sweep_vectors.py:s_bfecases as literals;NRM_F32edge grid plus 512 literal random pairs.tests/isa_sweep.rs: a new CPU-only test,sweep_references_match_rdna2, checksbfe64/norm16against the record.bfe64andNRM_F32becomepubfor it.progress.json:s_bfe_i32/s_bfe_u32joinrdna2_verified(the other 8 held mnemonics were already listed there), andrdna2_pendingis empty. The two BLOCKERS entries are marked DONE.gen.py: RDNA2 769/779 → 771/779. No other generated value changes.Tests (Windows 11, WARP, on
9ab754c; rebased onto4cb7a54, generated files regenerated)Mutation check: each of these planted model changes makes the new test fail:
Why 100% isn't reachable
After this PR, 8 of 779 squares are left, and none of them can honestly turn green:
ds_gws_*(6): a wave blocks until other thread groups release a semaphore or reach a barrier. D3D12 has no cross-group blocking primitive and no forward-progress guarantee for spin waits, so any lowering could hang or would only appear to work.ds_ordered_count: counts in wave-launch order, which D3D12 doesn't expose. Atomics give unique slots, not ordered ones.s_sendmsghalt: halts the wave until a debugger or trap handler resumes it, which is a GPU hang on a console. Translating it as "end the wave" would be fake success.No title shader uses any of them, and these are the refusals you already documented in BLOCKERS. Hardware measurements can't change that, because the gap is what D3D12 can express, not a missing description of RDNA2. Unless you count a documented refusal as "done", 771/779 is the honest ceiling. If you'd like the map to show that, for example a separate "unsupported by design" state, I'm happy to send it as a follow-up.
Related
#70 (@QuentinDanblon) fixes the stale
s_bfeexpected values invop::basic::salu_basic/scalar_sop2, which still fail on main. It's independent of this PR, so no file overlap.#38 touches the same instructions in other files. Its translator change is already on main.
cargo test -p tombox-xshader --release --test isa_sweeppasses (the 10 known WARP deviations are the existingWARP_KNOWNlist)No game or console files and no binaries included
No fake success: the 8 refusals stay refused
🤖 Generated with Claude Code
@QuentinDanblon on GitHub · 2026-11-22 00:57 UTC · original
Tested and cross-checked against the probe this builds on (#72). Short version: the test passes on today's main and the record is consistent with the probe in every way I could check from here.
Run (Windows 11, WARP, this PR merged into main
285a165, the merge is clean):Cross-check of
rdna2_hw.rswith a separate script that uses onlyvalu_probe.pyfrom #72 (its case list, its input generators and itsFractionmodels, which share no code with the Rustbfe64/norm16):BFEinputs equal the probe's case list, in orderBFEresults: 7-bit width with sign-fillBFEresults: literal ISA formula / width modulo the operand sizeBFESCC = (result != 0)norm32_input()So the record matches what the probe would have fed the GPU, and two independent models (Rust and Python) agree with it. What I cannot check from here is that the numbers are what the GPU returned: that rests on your run. If you still have the probe directory, attaching the raw
sbfe_*.out,norm16.outandnorm32.outas a zip in a comment (not in the tree) would let anyone regeneraterdna2_hw.rsbyte for byte.Three notes:
tools/rdna2-hwprobe/sweep_vectors.pyimportsvalu_probe.py, which only exists in #72, itself stacked on #41, andtools/rdna2-hwprobe/is not on main yet. The Rust test is self-contained and works without them, but the generator cannot run on main until #41 and #72 land. Worth one line in the description.BLOCKERS.md,progress.json,LIBRARY_MAP.md,MILESTONES.mdand the SVGs are rewritten by @omonkeyz in each sync commit (285a165touched all of them except the instructions badge). They merge cleanly today and will conflict at the next sync. The two files that carry the result aretests/isa_sweep.rsandtests/isa_sweep/rdna2_hw.rs; those can be taken on their own.rdna2_hw.rssays gfx1036, which is right. I would keep "RDNA2 hardware (gfx1036)" wherever the docs say "confirmed on silicon", so nobody reads it as a console measurement.On the tie argument: I agree.
valu_probe.pymakes the same point for itsnearestrule (the only exact tie a float can produce is ±0.5, at 16383.5 and 32767.5, where ties-to-even and ties-away give the same result), so the measurement cannot separate the two and does not need to.#70 is still needed on main for the two stale
s_bfeexec oracles (scalar_sop2,vop::basic::salu_basic), as you say. No overlap with this PR.@SchmashinPrunes on GitHub · 2026-11-22 02:52 UTC · original
Thanks for the independent cross-check, that's exactly the second pair of eyes this needed.
4cb7a54(the sync did conflict, as you predicted). The code files are unchanged and the generated files were regenerated with gen.py, still 771/779. @omonkeyz, if the generated files keep getting in the way,tests/isa_sweep.rsandtests/isa_sweep/rdna2_hw.rscarry the result on their own, plus the twoprogress.jsonentries.I'll attach the raw
sbfe_*.out,norm16.outandnorm32.outas a zip below so anyone can regeneraterdna2_hw.rsbyte for byte.@SchmashinPrunes on GitHub · 2026-11-22 03:02 UTC · original
rdna2-hw-gfx1036-sbfe-norm.zip
Raw results as promised. README.txt has the regenerate command; the output is byte-identical to rdna2_hw.rs at
d94424d@omonkeyz on GitHub · 2026-11-22 13:12 UTC · original
Main's history was rewritten, which auto-closed this PR (sorry for the noise). Please drop the edits to the generated docs/ and tools/progress files and strip the comment lines. The RDNA2 silicon evidence is very welcome. Resubmit after #41/#72, since sweep_vectors.py depends on #72. To resubmit:
git fetchthis repo, branch from the currentmain, cherry-pick only your own commits (the old branch is based on the previous history and cannot be merged), and open a new PR.Pull request closed