startup: source-built NGG identity and contrast cases with a reference model #1954
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1961"
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 R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-24T22:11:09Z.
Change
A first source-built slice for the NGG (primitive shader) vertex programs discussed in #1723: test only, no lowering and no translator change.
tests/startup_ngg_slice_check.pybuilds six gfx1013 NGG programs from documented encodings: an identity triangle, an LDS broadcast across lanes, a reversed primitive, a null primitive, a two-wave count broadcast and a masked vector ALU case. Each is decoded with the repository's disassembler, run by a multi-wave Python reference model with shared LDS (in forward and reversed wave order, which must agree), and compared on positions, parameters, primitive indices, winding and counts under three candidate interpretations:pass: lane-private LDS, primitive export and counts ignored;lane: lane-private LDS, counts and primitive honoured;shared: group-shared LDS with barriers, counts and primitive honoured.The check is registered as the CTest
startup_ngg_slice, in the Linux Python job and in the pure-Python list inAGENTS.md;docs/experiments.mdhas a new section.Refs #1723. AI-assisted (Claude Code).
Verification
At
09b21dfc(merged withmainat82f0db65):python -B tests/startup_ngg_slice_check.pyprints6 cases decoded, anchored and separated under 3 interpretations; 6 planted model faults detectedand exits 0.python -B tests/rdna2_tools_check.py,tests/docs_links_check.pyandtests/bidi_controls_check.pypass.Not run locally: the CTest registration (no configured build in the worktree used); CI runs it.
Evidence and follow-up
primexport target and theGS_ALLOC_REQmessage id; Mesa's NGG code form0 = prim<<12 | vtx, the wave id bits of the merged wave info, the null-primitive flag and the 9-bit index plus edge-flag slot layout.sharedmatches the reference model on all six cases.lanediffers only where LDS carries data between lanes or waves.passdiffers on every contrast case except the masked ALU one. On the two-wave case neither lane-private interpretation is right, so the counts have to be group-uniform.llvm-mcreassembly of the encoded words (no binary mode yet). Winding is computed in raw x/y, not in D3D front-face terms.Checklist
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-24T22:29:01Z.
Added an optional
binary <llvm-mc>mode inc6d2b00e: it reassembles all six programs with LLVM 15llvm-mc(gfx1013, wave64), requires word-for-word identity with the fixture's encoder (342 instructions), and must report a deliberately wrong encoder word. It runs in the Linux LLVM job; the pure-Python mode is unchanged. This closes the "no llvm-mc reassembly" limit in the description.Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-24T22:54:08Z.
Correction to my note above: this PR merged before that commit was pushed, so the
binarymode is not part of what merged here. It is proposed separately in #2000.