docs(shader): measure explicit-LOD gather level selection on gfx1036 #23856
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23856"
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?
Imported from boykopovar/AnyPS5. Originally posted by brumskysb on 2026-11-19T19:22:54Z.
What
Measures the level selection of the [Explicit-LOD gathers] entry of
docs/dev/debt/shader.md(added by #12790): "(image_gather4_l, 2D, no offset or depth compare) are emulated, not measured on hardware" and its "Unverified there:" list. No code changes.Measured on gfx1036 (driver 31.0.22044.1) with the hardware oracle, wave32. Fixture:
image_gather4_lDIM 2D through a 2D T# over the surface ofImageGatherLod.cpp(16x16, 5 levels,8_8_8_8_UNORM, linear, every level's 2x2 footprint distinct so the returned words name the level), T#/S# words from a generator;image_sample_lsiblings as controls. 128 LODs per dispatch: -1 to 5 in 1/16 steps, the exactn + 0.5ties, and probes just below and above them.v_mov_b32 v10, 0x2aprobe 32 of 32;image_load_mipreads each of the 5 levels 32 of 32 (levels stored smallest-first; a largest-first control is 32 of 32 wrong);image_sample_landimage_gather4_lat integer LOD 0..4 each read their own level 32 of 32.n + 0.5and the tie goes up (0.5 -> 1, 1.5 -> 2, 2.5 -> 3, 3.5 -> 4); probes 1/4096 to 1/512 below 0.5 and 1/1024 below 1.5 also go up, 1/256 below 0.5 stays at 0.LOD_BIAS(+1.0, -0.5, +0.25) is added before the S#MIN_LOD/MAX_LODclamps;image_sample_lpicks the same level as the gather 128 of 128.MIP_FILTERnone reads the T#MIN_LODrounded down (1.75 -> 1, 2.5 -> 2) at every LOD; the T#MIN_LODis applied after the S#MAX_LOD; linearMIP_FILTERgather returns the same words as point 128 of 128 (theimage_sample_lcontrol blends, so the field is live);LOD_BIAS_SECraw 0x08/0x10/0x30 changes nothing (384 of 384 lanes).MIN_LODbefore S#MAX_LOD: 128). 18 mutation controls fire, no-op silent.verify_lod.py, imports neither the fixture nor the checker; rebuilds the surface and asserts its hash, decodes every T#/S# from the bodies, predicts all 16 output words per lane): 0 of 43,008 words off, the 84 linear-blendimage_sample_llanes within 0.074/255; it also rejectsMIP_FILTERnone rounding the T#MIN_LOD(256 lanes off); 19 mutation controls each fire from that passing baseline. A model that also rounds the LOD to 1/256 first matches every lane; that is a fit to the sub-1/256 probes, not a measured mechanism, and is not written into the entry.Code reading (not a measurement): the shader rounds with
GLSLstd450Ceiloflod + 0.5minus 1 (core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp:1083), so it gathers one level lower than the hardware at an exact tie. This PR records that in the entry and does not change the code.Evidence (runners, every dump, claims worksheets, checker, verifier, overlap sweeps, SHA-256 ledger): https://gist.github.com/brumskysb/a8b17ad91187303d26c28b05510a6a50
Tested
gfx1036, driver 31.0.22044.1, Windows 11. Harness:tools/hw-oraclevia the campaign'srigio.py(in the gist).aa698cdc08, themainfetched before the edit; it changes only line 307 ofdocs/dev/debt/shader.md.The edit removes "not measured on hardware" and the "Unverified there:" lead, keeps the shader's rules verbatim as the description of what the emulation does, and adds one measured sentence after them.
Before:
After:
Added sentence:
CHANGE SUMMARY (from the gate):
Removed phrases declared to the gate:
emulated, not measured on hardware:,shader. Unverified there:. "emulated" and "shader" are re-added; "not measured" is re-added for mirror-once, +-2^24, wave64 and the PS5's gfx1013. The sentences on tables, border modes, offsets, compares, arrays, 3D, cube,image_gather4_band 1D are unchanged.Notes
debt-length: the entry grows from 975 to 1,425 characters, over the 1,000 guideline (CI warning). It was already at 975, and every added clause is a measured condition or a still-unmeasured scope; trimming it is left to a separate PR rather than dropping a condition here.LOD_BIAS_SECvalues, T# base level above 0, other formats and surfaces, wave64, other parts, and the console's gfx1013.overlap_sweep.pyonaa698cdc08(2,006 open PRs, 86 candidates, 86 evaluated, 0 hits; controls A/B fire, C silent). No open PR edits this entry.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attached to this PR)