rdna2-hwprobe: mip selection and resinfo probe; RDNA2 rules for gather4_l bias/clamp and 2D-array resinfo #361
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!361
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/361/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-24 13:51 UTC · original
SchmashinPrunes:rdna2-mip-select→main· +352 −1 · 4 files · 1 commits · closed without mergingRDNA2 measurements for two descriptor questions:
image_gather4_l, and in what order do bias, clamp and base level combine?image_get_resinfo2D-array layer word: the BLOCKERS formula that QuentinDanblon's design question on #306 relies on.Library / area:
tools/rdna2-hwprobe(no runtime code),docs/BLOCKERS.mdExports changed (exports.txt rows): none
Source of the behaviour:
gfx10-rsrc.json. They match the ones #306 uses.Probe
g4_fillwrites a 16×16 R32_FLOAT image with 5 levels throughimage_store_mip. The texel at level m, (x, y) holds m·1000 + y·16 + x, so the level layout in memory doesn't matter.image_gather4_l,image_gather4_lzandimage_sample_l(point xy filter).image_get_resinfocovers 2D array, 2D and 3D: 8 layer counts × 6 base/last pairs × 7 levels.What RDNA2 does
All fields are in levels: S# and T# LODs are u4.8, LOD_BIAS is s6.8.
rel = max(clamp(lod + LOD_BIAS, S# MIN_LOD, S# MAX_LOD), T# MIN_LOD − BASE_LEVEL). So:_l;level = clamp(BASE_LEVEL + floor(rel + 0.5), BASE_LEVEL, LAST_LEVEL).l > 0.5 ? ceil(l + 0.5) − 1 : 0, hlsl.rs) picks the lower level at every exact .5. It's the same rule #306 keeps, so I'm noting it there rather than changing it here.level = max(BASE_LEVEL, floor(T# MIN_LOD)), clamped to LAST_LEVEL. The LOD and the S# fields are ignored.image_sample_lblends floor(rel) with the next level.image_gather4_lzreads BASE_LEVEL and ignores the S# fields. When floor(T# MIN_LOD) > BASE_LEVEL it returns 0 in all four components.image_get_resinfoon a 2D array returns DEPTH + 1 at every level and every BASE_LEVEL: 100 layers still give 100 at level 3. The BLOCKERS line "max(1, layers >> (BASE_LEVEL + level)); 100 layers at level 3 give 12" does not hold on RDNA2.mip_probe.py checkreproduces all of the above with 0 differences. Two deliberate mutations are caught:Change
tools/rdna2-hwprobe/mip_probe.py(new):genwrites the kernels and inputs;check <in> <out>compares a recording with the rules above and exits non-zero on any difference.tools/rdna2-hwprobe/mip_runner.cpp(new): a HIP runner that keeps one image buffer across the kernels of a run.README.txt: a section with the commands.docs/BLOCKERS.md:Tests
checkprinted 0 differences for gather4_l, gather4_lz, sample_l and resinfo (2D array, 2D, 3D).pr_gate.py --base origin/main --head HEAD: 4 files checked, 0 problems.#360 also appends a section to
tools/rdna2-hwprobe/README.txt. Whichever lands second needs a trivial merge there.cargo testunaffected (no crate changes)🤖 Generated with Claude Code
@omonkeyz on GitHub · 2026-11-25 13:50 UTC · original
Applied on main in
b931581(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed