Skip to content

X2w compute store format - #1683

Merged
tedin7 merged 5 commits into
R0Y00:mainfrom
SimSalabimse:x2w-compute-store-format
Nov 24, 2026
Merged

tedin7 merged 5 commits into
R0Y00:mainfrom
SimSalabimse:x2w-compute-store-format

Conversation

@SimSalabimse

Copy link
Copy Markdown
Contributor

compute: lower buffer_store_format_* from the descriptor format

Change

The compute translator lowers buffer_store_format_x, _xy, _xyz, and _xyzw, and the d16_x, d16_xy, d16_xyz, and d16_xyzw forms, using V# word 3. Repeat --descriptor-format-constant once per formatted store, in program order. Each index is a ready s_buffer_load from the constant descriptor.

FORMAT is bits 18:12. The other bits must be the GFX10 identity 0x01000FAC or the legacy DFMT/NFMT identity 0x00000FAC. The handled GFX10 formats, and the legacy DFMT/NFMT pairs that name the same layouts, are:

  • 32-bit UINT and FLOAT, one to four channels (32, 32_32, 32_32_32, 32_32_32_32)
  • 16_16_FLOAT and 16_16_16_16_FLOAT
  • 8_8_8_8_UNORM, 16_16_UNORM, and 10_10_10_2_UNORM
  • single-channel 16_UNORM, 16_SNORM, 16_UINT, 16_SINT, and 16_FLOAT

The opcode width has to match the format. A d16 opcode converts each packed binary16 half with f16tof32 before packing. d16 combined with 16-bit UINT or SINT does not store. Any other format, selector, index stride, ADD_TID_ENABLE, OOB, or type bit skips the store. The lowering does not substitute raw dwords for an unknown format.

A 32-bit result is a raw UAV store. Packed UNORM and FLOAT16 results occupy one or two dwords. A single 16-bit channel updates its half of the containing dword with InterlockedAnd and InterlockedOr. The indexed span reserved for a descriptor-format store is four bytes per channel.

This path is separate from --output-format. Supplying both is rejected. The existing gfx1030 UINT formatted stores are unchanged.

The gfx1013 fixture stores thirteen values, covering all eight opcodes, 16_SNORM, and 16_SINT, with both GFX10 and legacy words. compute_store_aot_descriptor_store_format_{hardware,warp} dispatches it, compares 320 UAV words, refuses BUF_FMT_8_SNORM and d16 plus 16_UINT, and checks that a changed payload is reported.

Merge

The branch is merged with origin/main 578d1e1c787e1118ad252940c76d126b7c738362. The merge commit is 6ee522e41801bd4abf739285bff7e5a27729d238. Its parents are 6177df41cfa8d66afce8095c816350866f2d0ee4 and 578d1e1c787e1118ad252940c76d126b7c738362.

tools/compute_store_aot.py was the only conflict. lower() and the container CLI call now take both descriptor_format_constant and rsrc2. Main's MED3, MIN3, MAX3, and XOR3 forms, the COMPUTE_PGM_RSRC2 entry layout and field widths, and the pixel SCC diamond stay as they are on main. CMakeLists.txt, README.md, and docs/experiments.md auto-merged with one descriptor-format test registration and one documentation row added. There is no second copy of those rows.

Verification

Host: Windows 11 25H2, build 26200, UBR 8655. VS 2022 Community, MSVC 19.42.34435, CMake 3.29.5-msvc4. Python 3.12.10 at out/pe-env. Hardware tests set XBOX2WINDOWS_ADAPTER=RTX 4070 Ti. Both ctest runs started with nvidia-smi reporting NVIDIA GeForce RTX 4070 Ti, 621.35.

cmake --preset dev and cmake --build --preset dev exited 0. cmake --preset release and cmake --build --preset release exited 0. The full presets built. The DirectStorage file-read check from origin/main is included, and the build did not stop on C2664.

ctest --preset dev --no-tests=error --output-on-failure -R '^compute_'

Exit code 0. 100 of 100 passed. Total time 666.99 sec.

ctest --preset release --no-tests=error --output-on-failure -R '^compute_'

Exit code 0. 100 of 100 passed. Total time 626.58 sec.

Preset Command exit Passed Time
dev 0 100/100 666.99 sec
release 0 100/100 626.58 sec

Tests brought in by origin/main, plus the descriptor-format stores. Every row passed on WARP and on the RTX 4070 Ti.

Test Dev Release
compute_entry_layout_hardware 6.00 sec 5.25 sec
compute_entry_layout_warp 1.48 sec 1.49 sec
compute_store_aot_alu_minmax3_hardware 7.67 sec 7.59 sec
compute_store_aot_alu_minmax3_warp 3.24 sec 3.25 sec
compute_store_aot_alu_med3_hardware 6.07 sec 5.90 sec
compute_store_aot_alu_med3_warp 3.53 sec 2.92 sec
compute_store_aot_alu_xor3_hardware 8.46 sec 8.29 sec
compute_store_aot_alu_xor3_warp 3.34 sec 3.34 sec
compute_store_aot_descriptor_store_format_hardware 4.81 sec 4.69 sec
compute_store_aot_descriptor_store_format_warp 3.53 sec 3.49 sec

Every ^compute_ test. Every row passed.

Test Dev Release
compute_root_hardware 0.40 sec 0.45 sec
compute_root_warp 0.05 sec 0.04 sec
compute_tables_hardware 0.33 sec 0.30 sec
compute_tables_warp 0.06 sec 0.05 sec
compute_mesh_texture_hardware 5.79 sec 3.16 sec
compute_mesh_texture_fallback_hardware 8.13 sec 3.23 sec
compute_store_aot_hardware 43.38 sec 21.28 sec
compute_entry_layout_hardware 6.00 sec 5.25 sec
compute_store_aot_guard_read_hardware 33.75 sec 32.98 sec
compute_store_aot_mubuf_subword_hardware 6.57 sec 6.67 sec
compute_store_aot_f32_hardware 7.80 sec 7.78 sec
compute_store_aot_mubuf_reduction_hardware 10.76 sec 10.74 sec
compute_store_aot_alu_minmax3_hardware 7.67 sec 7.59 sec
compute_store_aot_mubuf_reduction_x2_hardware 10.91 sec 10.57 sec
compute_store_aot_mubuf_exchange_hardware 4.91 sec 4.72 sec
compute_store_aot_mubuf_exchange-x2_hardware 4.81 sec 4.72 sec
compute_store_aot_mubuf_counter_hardware 4.19 sec 4.08 sec
compute_store_aot_mubuf_counter-x2_hardware 4.21 sec 4.08 sec
compute_store_aot_mubuf_csub_hardware 3.21 sec 3.13 sec
compute_store_aot_mubuf_vector_hardware 5.27 sec 4.96 sec
compute_store_aot_alu_med3_hardware 6.07 sec 5.90 sec
compute_store_aot_mubuf_d16_hardware 8.48 sec 8.29 sec
compute_store_aot_alu_xor3_hardware 8.46 sec 8.29 sec
compute_store_aot_mubuf_load_format_d16_hardware 6.06 sec 5.94 sec
compute_store_aot_mtbuf_load_hardware 10.10 sec 9.44 sec
compute_store_aot_mubuf_format_hardware 6.19 sec 5.84 sec
compute_store_aot_mimg_load_hardware 19.16 sec 18.38 sec
compute_store_aot_mimg_mip_hardware 18.86 sec 17.86 sec
compute_store_aot_mimg_resinfo_hardware 7.21 sec 6.77 sec
compute_store_aot_mimg_packed_hardware 14.37 sec 14.10 sec
compute_store_aot_mimg_msaa_hardware 4.19 sec 4.37 sec
compute_store_aot_mimg_store_hardware 8.89 sec 8.71 sec
compute_store_aot_mimg_store_packed_hardware 9.13 sec 9.00 sec
compute_store_aot_mimg_atomic_integer_hardware 6.36 sec 6.18 sec
compute_store_aot_mimg_atomic_minmax_hardware 6.06 sec 5.96 sec
compute_store_aot_mimg_atomic_exchange_hardware 3.89 sec 3.87 sec
compute_store_aot_mimg_atomic_counter_hardware 8.65 sec 8.35 sec
compute_store_aot_ds_route_hardware 4.15 sec 4.06 sec
compute_store_aot_lds_private_hardware 19.80 sec 19.04 sec
compute_store_aot_lds_packed_hardware 11.74 sec 11.52 sec
compute_store_aot_lds_arithmetic_hardware 25.95 sec 25.43 sec
compute_store_aot_lds_replacement_hardware 11.73 sec 11.58 sec
compute_store_aot_lds_strided_hardware 5.75 sec 5.72 sec
compute_store_aot_lds_wide_replacement_hardware 6.99 sec 6.84 sec
compute_store_aot_lds_qword_hardware 28.13 sec 27.67 sec
compute_store_aot_lds_f32_hardware 17.11 sec 17.23 sec
compute_store_aot_mubuf_store_format_hardware 8.70 sec 8.72 sec
compute_store_aot_mubuf_store_format_xyz_hardware 3.10 sec 3.10 sec
compute_store_aot_descriptor_store_format_hardware 4.81 sec 4.69 sec
compute_store_aot_mtbuf_store_hardware 10.41 sec 10.61 sec
compute_store_aot_mubuf_store_subword_hardware 7.40 sec 7.28 sec
compute_to_pixel_hardware 3.32 sec 3.32 sec
compute_mesh_texture_warp 2.46 sec 2.45 sec
compute_mesh_texture_fallback_warp 2.45 sec 2.47 sec
compute_store_aot_warp 5.81 sec 5.78 sec
compute_entry_layout_warp 1.48 sec 1.49 sec
compute_store_aot_guard_read_warp 7.86 sec 8.60 sec
compute_store_aot_mubuf_subword_warp 3.09 sec 3.10 sec
compute_store_aot_f32_warp 3.95 sec 3.37 sec
compute_store_aot_mubuf_reduction_warp 3.84 sec 3.86 sec
compute_store_aot_alu_minmax3_warp 3.24 sec 3.25 sec
compute_store_aot_mubuf_reduction_x2_warp 3.90 sec 3.91 sec
compute_store_aot_mubuf_exchange_warp 2.72 sec 2.70 sec
compute_store_aot_mubuf_exchange-x2_warp 2.70 sec 2.72 sec
compute_store_aot_mubuf_counter_warp 2.52 sec 2.58 sec
compute_store_aot_mubuf_counter-x2_warp 2.56 sec 2.62 sec
compute_store_aot_mubuf_csub_warp 2.39 sec 2.41 sec
compute_store_aot_mubuf_vector_warp 2.80 sec 2.78 sec
compute_store_aot_alu_med3_warp 3.53 sec 2.92 sec
compute_store_aot_mubuf_d16_warp 3.49 sec 3.46 sec
compute_store_aot_alu_xor3_warp 3.34 sec 3.34 sec
compute_store_aot_mubuf_load_format_d16_warp 2.93 sec 2.93 sec
compute_store_aot_mtbuf_load_warp 3.76 sec 3.67 sec
compute_store_aot_mubuf_format_warp 3.01 sec 2.92 sec
compute_store_aot_mimg_load_warp 5.76 sec 5.73 sec
compute_store_aot_mimg_mip_warp 5.61 sec 5.50 sec
compute_store_aot_mimg_resinfo_warp 3.85 sec 3.32 sec
compute_store_aot_mimg_packed_warp 4.87 sec 4.82 sec
compute_store_aot_mimg_msaa_warp 2.65 sec 2.66 sec
compute_store_aot_mimg_store_warp 3.71 sec 3.74 sec
compute_store_aot_mimg_store_packed_warp 3.75 sec 3.69 sec
compute_store_aot_mimg_atomic_integer_warp 2.98 sec 2.99 sec
compute_store_aot_mimg_atomic_minmax_warp 2.96 sec 3.35 sec
compute_store_aot_mimg_atomic_exchange_warp 2.53 sec 2.53 sec
compute_store_aot_mimg_atomic_counter_warp 3.46 sec 3.45 sec
compute_store_aot_ds_route_warp 3.13 sec 2.60 sec
compute_store_aot_lds_private_warp 5.71 sec 5.70 sec
compute_store_aot_lds_packed_warp 4.07 sec 4.06 sec
compute_store_aot_lds_arithmetic_warp 6.89 sec 6.92 sec
compute_store_aot_lds_replacement_warp 4.07 sec 4.13 sec
compute_store_aot_lds_strided_warp 2.92 sec 2.93 sec
compute_store_aot_lds_wide_replacement_warp 3.16 sec 3.17 sec
compute_store_aot_lds_qword_warp 7.54 sec 7.39 sec
compute_store_aot_lds_f32_warp 5.19 sec 5.18 sec
compute_store_aot_mubuf_store_format_warp 3.47 sec 3.50 sec
compute_store_aot_mubuf_store_format_xyz_warp 2.43 sec 2.44 sec
compute_store_aot_descriptor_store_format_warp 3.53 sec 3.49 sec
compute_store_aot_mtbuf_store_warp 3.80 sec 4.43 sec
compute_store_aot_mubuf_store_subword_warp 3.21 sec 3.16 sec
compute_to_pixel_warp 2.40 sec 2.38 sec

Fixes #1542

AI-assisted (Grok Build)

Read V# word 3 for each formatted store and pack the x, xy, xyz, and xyzw forms, including d16. An unknown format or a channel mismatch does not store.
Keep the COMPUTE_PGM_RSRC2 entry layout with the descriptor-format buffer stores.
Keep the scratch-base write, quad DPP OR, and image stores with the descriptor-format buffer stores.
@SimSalabimse
SimSalabimse marked this pull request as ready for review November 24, 2026 17:05

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head 19c19eb (comment only, not an approval).

No blocking defect found.

What I ran

  • python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM.so.19.1: exit 0. The focused descriptor_store_binary run printed DESCRIPTOR_OK.
  • Not run: compute_store_aot_descriptor_store_format_{hardware,warp} (Windows, DXC, D3D12). Those are the only tests that compare the 320 UAV words, so the packing maths and the "100/100" claim are unconfirmed here.
  • Mutations in tools/compute_store_aot.py, each restored with git checkout --: dropping the d16 guard on 16-bit UINT/SINT fails, but only on the source-text assert "d16 == 0u" in source; dropping bit 24 from FIXED_MASK fails on a real behaviour assert; unorm10 alpha scale 3.0 -> 7.0, legacy 32_UINT NFMT 4 -> 6 and snorm scale 32767 -> 32768 all pass, so the Linux-runnable part does not catch them.

Non-blocking

  • descriptor_store_controls in tests/compute_store_check.py asserts text in the generated HLSL (f"format == {code}u" in source, "InterlockedAnd" in source, "params[3].x" in source, "store_descriptor_format(" not in old). Those fail on a rename, not on a behaviour change, and the loops over aot.DESCRIPTOR_STORE_FORMATS take the expected values from the code under test. Pinning literal expected words would make the three mutations above visible.
  • The legacy mapping is checked against itself: descriptor_format_word(code, legacy=True) uses the table the shader decodes; only legacy words 74 and 29 are pinned to independent constants.
  • docs/experiments.md says "gfx1013 and gfx1030", but the only fixture is gfx1013.
  • descriptor_unorm uses HLSL round() (ties to even); the Python reference uses floor(x + 0.5). No test value is a tie, so it is invisible today. NaN/Inf and f32tof16 rounding are untested too.

Questions

  • The format comes from a separate b0 constant word, not from the descriptor in s[20:23]. Is that contract enforced elsewhere?
  • Is the legacy word (RESOURCE_LEVEL=0) valid on gfx1013 hardware?
  • Is widening d16 halves to f32 before a 32-bit format store what the hardware does?

Overlap: #1684, #1675, #1673, #1649, #1596 and #1592 also edit tools/compute_store_aot.py, CMakeLists.txt, docs/experiments.md and/or tests/compute_store_check.py, so textual conflicts are likely. None implements the same descriptor-format store.
Linux limits: no Windows, MASM, MSVC, DXC or D3D12 device here; LLVM 19 only (CI uses LLVM 15). Anything that needs them was not run.

AI-assisted; commands listed were executed locally.

@tedin7

tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

This PR currently has merge conflicts with main. Could you please rebase it onto the latest main so it can be checked for merge?

AI-assisted.

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head 9ff8ee1a80ad388104e86215e14ab02a936c39ef.

Scope: CMakeLists.txt (only registers compute_store_aot_descriptor_store_format_<adapter>), README.md, docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py. The change reads the buffer format from V# word 3 (GFX10 or legacy) and refuses unknown formats instead of writing raw dwords. Clean-room: the encodings come from public register documentation and the existing local tooling. No copied sources.

Commands executed locally:

  • git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts.
  • gh pr checks 1683: Windows build and test, Linux Python checks and gfx1013 fixtures all pass. The /O2 Windows job is skipped in CI.
  • python3 tests/docs_links_check.py: PASS (18 files, 388 links).
  • python3 tests/bidi_controls_check.py: PASS.
  • git diff --check origin/main...HEAD: clean.
  • Windows Server 2025, x2w_pipe.py win2025 1683 with --targets offscreen_check --regex '^compute_store_aot_(descriptor_store_format|mubuf_store_format)': Debug 6/6 pass, Release /O2 6/6 pass, docs link check ok. The WARP adapter ran compute_store_aot_descriptor_store_format_warp.
  • The Linux box has no LLVM 15 tools, so the binary round trip ran only in CI. descriptor_store_controls() ran locally and passed.

Mutations in the code under test, each reverted with git checkout -- .:

  • DESCRIPTOR_FIXED_MASK widened to 0xFFFFFFFF: killed by descriptor_store_controls() (valid format rejected).
  • Legacy table entry (13, 7) remapped from 74 to 77: killed (StopIteration on the round trip lookup).
  • Survived locally: the reservation span reduced to 4 * count. The controls alone do not catch it. See the P3 note.

P1: 0. P2: 0.

P3 (non-blocking): a code comment in tools/compute_store_aot.py cites a third-party header for the bit layout. Only register field positions are used, no code is copied, but a pointer to the public ISA document would keep the clean-room record tidy.

P3 (non-blocking): the d16_xyzw reservation width (16 bytes, not the two data VGPRs) is not pinned by the Python controls (the mutation survived them). A direct control that lower refuses a d16_xyzw store overlapping the next element would pin it.

AI-assisted; commands listed were executed locally.

Compare the generated store helper with literal UAV words and legacy
V# word 3 constants, so a changed unorm10 alpha scale, legacy 32 UINT
NFMT, snorm scale, or d16 integer guard fails the Linux check. UNORM
and SNORM follow the Direct3D half-away conversion, including one exact
unorm8 tie. The store-format note names the gfx1013 fixture only.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
@SimSalabimse

Copy link
Copy Markdown
Contributor Author

Thanks for the run. Head is now f37fe7b8e855c9b035739b6f66ba979b1d447fee.

  • descriptor_store_controls evaluates the generated store helper and compares the 28 UAV dwords to literal constants (PINNED_THREAD0), not to values taken from DESCRIPTOR_STORE_FORMATS. All 18 legacy V# word 3 values are pinned the same way, including 32 UINT 0x00024FAC (DFMT 4, NFMT 4). A d16 16_UINT store and a d16 16_SINT store must leave the sentinel; that is what fails if the d16 == 0u guard is removed. params[3].x is still a source check, because that is the b0 binding.
  • UNORM and SNORM now use the Direct3D conversion in both the HLSL and the Python reference: scale, add 0.5 for a non-negative value or subtract 0.5 for a negative one, then drop the fraction. HLSL round() is ties-to-even and disagreed on an exact tie. The fixture's unorm8 blue channel is binary32 0x3C20A0A1, whose product with 255 is exactly 2.5. This path stores 3 (0x0003BF40). Ties-to-even would store 2. The Direct3D rule is documented at https://learn.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-data-conversion. I did not find the MUBUF format unit's tie break in the RDNA ISA. LLVM's packed conversions (v_cvt_pk_*, SIInstrInfo.td) are ties-to-even on a different unit. The gfx1013 buffer-format tie break is unverified.
  • docs/experiments.md no longer says gfx1030 for this path. The only fixture is gfx1013.

Mutations in tools/compute_store_aot.py, each restored with git checkout --:

Mutation descriptor_store_controls()
unorm10 alpha 3.0 → 7.0 exit 1
legacy 32 UINT NFMT 4 → 6 exit 1
snorm 32767.0 → 32768.0 exit 1
drop the d16 guard on 16-bit UINT/SINT exit 1

python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 exited 0 (LLVM 15.0.7).

On Windows 11 (MSVC 19.42, RTX 4070 Ti, driver 621.35), dev build at f37fe7b8: ctest --preset dev --no-tests=error --output-on-failure -R "^compute_store_aot_descriptor_store_format" passed 2/2 (_hardware and _warp), exit 0.

Answers:

  • The format word is a separate b0 constant. Each formatted store must name a ready --descriptor-format-constant index, already loaded with s_buffer_load and waited. s[20:23] is checked only as the u0 UAV descriptor. FORMAT is not read from those registers, and nothing else in this repository compares the b0 word to word 3 of that descriptor. The contract is the caller's.
  • Legacy RESOURCE_LEVEL=0 on gfx1013 is unverified. Mesa's GFX10 SQ_BUF_RSRC_WORD3 definition marks bit 24 RESOURCE_LEVEL as "must be 1". I did not find an RDNA ISA sentence that a cleared bit is still decoded as DFMT/NFMT. The lowering accepts 0x00000FAC.
  • Widening d16 halves to f32 before a 32-bit format store is what the lowering does (f16tof32, then the same packer). For 32-bit FLOAT that is the numeric conversion, and f16 to f32 is exact. I did not find an RDNA ISA or LLVM AMDGPU statement that the format unit widens through f32 before a 32-bit UINT or UNORM store. Unverified for those formats. The fixture's d16 32-bit store is 32_32_32_FLOAT.

AI-assisted (Cursor)

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head f37fe7b

Scope: CMakeLists.txt only registers the new compute_store_aot_descriptor_store_format_<adapter> test. README.md and docs/experiments.md document the descriptor-format store path. The logic is in tools/compute_store_aot.py and tests/compute_store_check.py. The unverified UNORM tie break is stated in the docs and in the code comment. No clean-room concerns found.

P1: 0. P2: 0.

Commands executed locally:

  • git merge-tree --write-tree --name-only origin/main HEAD: no conflicts. PR is MERGEABLE.
  • gh pr checks 1683: Linux Python checks, fixture assembly and Windows build/test pass.
  • python3 tests/docs_links_check.py: PASS (388 links).
  • python3 tests/bidi_controls_check.py: PASS.
  • git diff --check origin/main...HEAD: clean.
  • python3 -B tests/compute_store_check.py binary with the LLVM 19 mc/objcopy on this Linux host (LLVM 15 not installed here): PASS.
  • Win2025, --targets offscreen_check --regex '^compute_store_aot_(descriptor_store_format|mubuf_store_format)' (the full auto-discovered command exceeded the cmd.exe length limit): Debug 6/6 passed, Release /O2 6/6 passed.

Mutations (both killed by tests/compute_store_check.py binary, then reverted):

  1. Swapped the legacy UINT16 and SINT16 format mapping in LEGACY_DESCRIPTOR_FORMATS: assertion failure in descriptor_store_controls.
  2. Dropped the d16-with-16-bit-integer guard in the generated store function: the skipped-store sentinel assertion failed.

AI-assisted; commands listed were executed locally.

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardware-source check for head f37fe7b (follow-up to the earlier review on this head: 0 P1, 0 P2, Linux pass, Win2025 Debug and Release /O2 6/6, 2 mutations killed). No P1, no P2.

Claims checked: the README row "Descriptor-format buffer stores" and docs/experiments.md#descriptor-format-buffer-stores, against tools/compute_store_aot.py (DESCRIPTOR_*, LEGACY_DESCRIPTOR_FORMATS).

Public sources, all match:

  • GFX10 V# word 3, FORMAT bits 18:12, RESOURCE_LEVEL bit 24 ("must be 1"), INDEX_STRIDE 22:21, ADD_TID_ENABLE 23, OOB_SELECT 29:28, TYPE 31:30 ("must be 0"): Mesa src/amd/registers/gfx10-rsrc.json lines 329-342 (SQ_BUF_RSRC_WORD3). The gfx103 variant (lines 343-357) adds LLC_NOALLOC 27:26. The code refuses any non-identity fixed bit, so a descriptor with LLC_NOALLOC set is skipped, not misread. That is conservative and matches the doc ("any other fixed bits skip the store").
  • Legacy word 3, NUM_FORMAT bits 14:12, DATA_FORMAT bits 18:15, ELEMENT_SIZE 20:19, INDEX_STRIDE 22:21, ADD_TID 23: Mesa src/amd/registers/gfx6.json lines 9878-9893. This matches DESCRIPTOR_FIXED_MASK = 0xFFF80FFF and the shifts in the code and doc.
  • Identity DST_SEL X/Y/Z/W = 4/5/6/7: gfx6.json lines 601-604. 4 | 5<<3 | 6<<6 | 7<<9 = 0xFAC, so the GFX10 identity 0x01000FAC and legacy identity 0x00000FAC in the doc are right.
  • Legacy DFMT values (16=2, 32=4, 16_16=5, 10_10_10_2=8, 8_8_8_8=10, 32_32=11, 16_16_16_16=12, 32_32_32=13, 32_32_32_32=14): LLVM 15.0.7 llvm/lib/Target/AMDGPU/SIDefines.h enum DataFormat, lines 469-495. NFMT values (UNORM=0, SNORM=1, UINT=4, SINT=5, FLOAT=7): same file, enum NumFormat, lines 497+.
  • GFX10 unified format codes in DESCRIPTOR_STORE_FORMATS: LLVM 15.0.7 SIDefines.h namespace UfmtGFX10 (line 537), sequential enum with UFMT_INVALID=0. Counted by position: 16_UNORM=7, 16_SNORM=8, 16_UINT=11, 16_SINT=12, 16_FLOAT=13, 32_UINT=20, 32_FLOAT=22, 16_16_UNORM=23, 16_16_FLOAT=29, 10_10_10_2_UNORM=44, 8_8_8_8_UNORM=56, 32_32_UINT=62, 32_32_FLOAT=64, 16_16_16_16_FLOAT=71, 32_32_32_UINT=72, 32_32_32_FLOAT=74, 32_32_32_32_UINT=75, 32_32_32_32_FLOAT=77. All 18 codes match the table. All 18 legacy DFMT/NFMT pairs map to the same GFX10 codes.
  • The doc states the unorm8 tie break is unverified (not in the ISA text checked). That is an honest caveat, not an unverified claim, and the fixture pins the D3D rule it implements.

Commands executed locally: fetched the above files at those revisions and read the cited line ranges. Position of each UFMT name was counted with awk over SIDefines.h lines 539-632. No code was changed.

AI-assisted; commands listed were executed locally.

@tedin7
tedin7 merged commit e99a787 into R0Y00:main Nov 24, 2026
5 checks passed
Jess-Doit added a commit to Jess-Doit/Xbox2Windows that referenced this pull request Nov 25, 2026
Conflict with R0Y00#1683 (descriptor-format stores) in the indexed raw-store
branch of tools/compute_store_aot.py: this branch routes it through
linear_uav_address, main sized the field as span instead of 4 * count.
The helper now receives span, so descriptor stores reserve the same
bytes as on main; main's descriptor-store program lowers to identical
HLSL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compute: buffer_store_format_* and the d16 forms with the format taken from the descriptor

2 participants