compute: lower the d16 descriptor-format buffer loads #2157
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2165"
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 archielcqp-a11y on 2026-11-25T02:32:06Z.
Refs #2022 (item A). This follows #2150 (merged), which added the descriptor-format decoder.
Summary
R0Y00 asked on #2022 for d16 to follow the first slice, with integer versus float handling and a format-specific rounding or conversion control. This PR adds that.
buffer_load_format_d16_{x,xy,xyz,xyzw}now use the descriptor-format decoder from #2150. The format word, the exact-width validity rule and the refusal (no store when any load is invalid) are unchanged. Two 16-bit channels pack per result word, x in the low half.The format's type decides the 16-bit value:
x / (2^n - 1)ormax(x / 32767, -1), rounded to nearest even by integer long division (descriptor_ratio16). Binary16 denormals are kept, so1/65535is0x0100.32_FLOATto binary16). So32_UINTand32_FLOAT, in one to four channels, are invalid under d16 and publish nothing.Whether the RDNA format unit rounds the same way, or keeps binary16 denormals, is not verified.
Odd channel counts:
d16_xandd16_xyzleave the high half of the last word undefined. That word is now analu_low16value. It reaches a whole-word store or an ALU operand only throughv_and_b32 0xffff, the same rule the existing caller-format D16 reads (source_low16) follow.Fixture
compute_store_aot_descriptor_load_format_d16_{warp,hardware}(tests/compute_load_format_check.py draw-d16).The fixture makes ten d16 loads over the same t0 words as the binary32 fixture, one per format with a d16 rule, into a 64-byte u0 record. The edge values exercise round-up, binary16 denormals, -32768 and -32767, and the sign of 16-bit SINT.
32_32_FLOATunderd16_xy,16_16_UNORMunderd16_x, and8_SNORM). Each must leave u0 unwritten, and a zero-filled reference must fail.draw-mubuf-load-format-d16), which shares the mask rule, still passes on WARP.Results
Run at
340c608(on #2150's headf3a6819), Windows 10 build 19045, debug layer enabled, 0 debug errors and 0 debug warnings on every dispatch. The pull-request CI runs theprsmoke preset, which does not include these tests, so here is the local CTest output:The hardware adapter is an NVIDIA GeForce RTX 3080 (driver 32.0.15.9174), and WARP is 1.0.22 (app-local).
Other checks:
tests/compute_load_format_check.py binarywith LLVM 15: pass, both fixtures.tests/compute_store_check.py binarywith LLVM 15: pass.tests/compute_store_check.py draw-mubuf-load-format-d16on WARP: pass.form_coverage_check,docs_links_check,bidi_controls_checkandshader_census_check: pass.No capability skips.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:54:35Z.
Review: COMMENTED
Review of head
340c608531.P1: 0. P2: 0.
Logic: the binary16 long division in
descriptor_ratio16is correct. Normal results keep 11 bits, and denormals count units of 2^-24. Rounding is nearest-even with a sticky bit, and a carry into the exponent is fine. SNORM16 clamps -32767 and below to -1.0. 16-bit UINT and SINT stay integer, and 32-bit formats have no d16 arm. The odd last half is tracked asalu_low16, so it must be masked before a whole-word store.Linux, run locally:
python3 tests/compute_load_format_check.pypassed.python3 tests/docs_links_check.pypassed.python3 tests/bidi_controls_check.pypassed.git diff --check origin/main...HEADwas clean.Mutations in tools/compute_store_aot.py:
0uinstead of the packed flag made the test fail (rc=1).Win2025 (
x2w_pipe.py win2025 2165 --wait 3600): Debug 60/60 passed and Release /O2 60/60 passed. This includescompute_store_aot_descriptor_load_format_d16_warp, a GPU readback test against a CPU reference. GitHub CIBuild and test on Windows= SUCCESS.Competing PRs: no other open PR covers d16 descriptor-format buffer loads. #2139 is D16 image_load, a different opcode.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T05:32:57Z.
Review: APPROVED
Verified head
340c6085on Windows x64 (devpreset, MSVC19.44.35228.0, SDK/DXC10.0.26100.0):python -B tests/compute_load_format_check.py-> passedctest --preset dev --no-tests=error -R '^compute_store_aot_descriptor_load_format_' -V-> 4/4 passed (compute_store_aot_descriptor_load_format_{hardware,warp}andcompute_store_aot_descriptor_load_format_d16_{hardware,warp})descriptor_load_format: 6 dispatches, 13 wrong references, 11 mutated sources checked;descriptor_load_format_d16: 5 dispatches, 10 wrong references, 9 mutated sources checked (debug_errors=0 debug_warnings=0).AMD Radeon RX 7900 XTX(vendor=1002 device=744c, driver32.0.32029.2010)Microsoft Basic Render Driver(vendor=1414 device=008c, driver10.0.26100.9818)Verdict: Approved at
340c6085.Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T05:47:28Z.
Ran head
340c6085on three adapters. All pass. Windows 11 build 26100, debug layer unavailable.compute_store_aot_descriptor_load_format_d16_warpcompared_words=320 mismatches=0compute_store_aot_descriptor_load_format_d16_hardware(XBOX2WINDOWS_ADAPTER=Quadro)compute_store_aot_descriptor_load_format_d16_hardware(XBOX2WINDOWS_ADAPTER=Intel)AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:44:01Z.
@archielcqp-a11y could you rebase this branch onto current
mainand force-push?GitHub reports head
340c6085as conflicting withmain, so it cannot be merged as is.Files that conflict with current
main(b1a644ae):CMakeLists.txtREADME.mdtools/compute_store_aot.pyCommands run locally:
Once it is rebased and CI is green it will be re-checked right away.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:17:54Z.
Pushed
6ceb259a0: a merge of main into this branch (no force, no rebase) so the PR is mergeable again. The d16 lowering itself is unchanged.Main had changed the same areas, so the merge needed a few decisions. Both sides are kept where they do not clash:
tools/compute_store_aot.py: main'scallstring for descriptor-format and heap-view loads, with the d16 flag passed toload_descriptor_format.tests/compute_load_format_check.py: your suite-parameteriseddraw()now uses main's batched references (--compute-store-batch) and parallel mutations.CMakeLists.txt,README.md,docs/experiments.md: both sides kept; the README row names the d16 forms.Two behaviours to review:
load_descriptor_formatwith d16 off. Refuse rather than guess.Commands executed locally:
python3 tests/compute_load_format_check.py,tests/compute_heap_view_check.py,tests/compute_heap_store_check.py: passpython3 x2w_pipe.py win2025 2165 --patch <merge diff> --regex 'compute_store_aot_descriptor_load_format|compute_store_aot_heap_view|compute_heap|compute_load_format'(default slots, dev and release): 11/11 passed each, including the d16 and heap-view WARP and hardware drawsAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:26:58Z.
Pushed
3d84b653e: a second merge of main into this branch (no force, no rebase) so the PR is mergeable again. The d16 lowering is unchanged.One real conflict, in
tools/compute_store_aot.pynext to thev_and_b32 0xffffrule. Both sides are kept: yoursource_low16/alu_low16handling stays, and main's new_e64float add/sub/mul rule with source modifiers follows it.CMakeLists.txtand the docs merged cleanly, and theforeach/endforeachcounts match (368/368).Commands executed locally:
python3 -m py_compile tools/compute_store_aot.pypython3 -B tests/compute_load_format_check.py controls(pass)python3 -B tests/rdna2_tools_check.py(OK)The Windows WARP pass on the d16 content was recorded earlier in this thread; it was not re-run because the conflict was a keep-both merge of two independent rules.
AI-assisted; commands listed were executed locally.