Repository navigation
compute: decode the 10-bit-x buffer format as 2_10_10_10, not 10_10_10_2 - #2192
Merged
R0Y00 merged 1 commit intoNov 25, 2026
Merged
Conversation
AMD format names list the fields from the most significant bit. Mesa's gfx10_format_table.py reverses each name into little-endian channel sizes, and radeonsi and radv map R10G10B10A2 (x in bits 9:0, w in bits 31:30) to 2_10_10_10. The descriptor-format store and load decoders used the 10-bit-x packer for BUF_FMT_10_10_10_2_UNORM (44, legacy DFMT 8), whose x is the 2-bit field in bits 1:0, so they would have read and written the wrong fields. The packer now serves BUF_FMT_2_10_10_10_UNORM (50, legacy DFMT 9). Code 44 and legacy DFMT 8 are refused: the store is skipped and the load is invalid, so nothing is published. The store and load fixtures use code 50, and each adds a GPU run with code 44 that must leave its output at the sentinel. The controls reject the code-44 and legacy DFMT 8 words, and fail with the old mapping. Refs R0Y00#2022 AI-assisted (Claude Code); reviewed and run locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tedin7
reviewed
Nov 25, 2026
tedin7
left a comment
Collaborator
There was a problem hiding this comment.
Review of head 282f630 (comment only).
Findings: 0 P1, 0 P2.
- The fix is correct. AMD format names list fields from the most significant bit, and the R10G10B10A2 layout (x in bits 9:0, w in bits 31:30) is
BUF_FMT_2_10_10_10_UNORM(gfx10 code 50, legacy DFMT 9). Code 44 / DFMT 8 (10_10_10_2) has a 2-bit x field in bits 1:0, so refusing it is right. - Legacy table (
_legacy_field(9, 0): 50), the format table and the pinned legacy word0x00048FACagree with each other. - Tests cover both directions: the load check adds an invalid
10_10_10_2_UNORMcase, the store controls reject code 44 and legacy0x00040FAC, and the draw test adds a refused-store run. Docs are updated to match. - No concurrent open or recent merged PR changes this table. #2006 touches the fetch format in gfx2hlsl, a different file.
Commands run locally on the PR head:
python3 -B tests/compute_load_format_check.py-> exit 0descriptor_store_controls()from tests/compute_store_check.py -> passedpython3 tests/docs_links_check.py-> Checked 18 Markdown files and 404 linkspython3 tests/bidi_controls_check.py-> passgit diff --check origin/main...HEAD-> clean- Mutation 1:
tools/compute_store_aot.pyformat table50: ("unorm10", 4)->44:-> store controls FAIL (killed) - Mutation 2: legacy table
_legacy_field(9, 0): 50->_legacy_field(8, 0): 50-> store controls FAIL (killed) - Files are .py and docs only. CI: Build and test on Windows = pass, Linux Python checks = pass, gfx1013 fixtures assemble = pass.
AI-assisted; commands listed were executed locally.
stan495
approved these changes
Nov 25, 2026
stan495
left a comment
Contributor
There was a problem hiding this comment.
Verified head 282f6301 on Windows x64 (dev preset, MSVC 19.44.35228.0, SDK/DXC 10.0.26100.0):
python -B tests/compute_load_format_check.py-> passedctest --preset dev --no-tests=error -R 'compute_store_aot_.*format' -V-> 8/8 passed (compute_store_aot_mubuf_load_format_d16_{hardware,warp},compute_store_aot_mubuf_format_{hardware,warp},compute_store_aot_mubuf_store_format_{hardware,warp},compute_store_aot_mubuf_store_format_xyz_{hardware,warp})ctest --preset dev --no-tests=error -R '^compute_store_aot_descriptor_load_format_' -V-> 2/2 passed (compute_store_aot_descriptor_load_format_{hardware,warp}; 7 dispatches, 14 wrong references, 11 mutated sources checked,debug_errors=0 debug_warnings=0)- Hardware:
AMD Radeon RX 7900 XTX(vendor=1002 device=744c, driver32.0.32029.2010) - WARP:
Microsoft Basic Render Driver(vendor=1414 device=008c, driver10.0.26100.9818)
- Hardware:
Verdict: Approved at 282f6301.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2022. This fixes the format table shared by the descriptor-format stores (#1542) and loads (#2150).
Problem
The 10-bit-x packer (x in bits 9:0, y and z in the next 10-bit fields, w in bits 31:30) was registered for
BUF_FMT_10_10_10_2_UNORM, which is gfx10 code 44 and legacy DFMT 8. That format has a different layout: x is the 2-bit field in bits 1:0, followed by 10-bit y, z and w. So a store or load with code 44 would have written or read the wrong fields, with no refusal.Sources:
src/amd/common/gfx10_format_table.pyreverses each name into channel sizes ("Keep the bit sizes in little-endian order"), so2_10_10_10is [10, 10, 10, 2] from bit 0 and10_10_10_2is [2, 10, 10, 10].si_translate_buffer_dataformat) and radv (radv_translate_buffer_dataformat) map formats whose first channel is 10 bits and whose fourth is 2 bits (R10G10B10A2) toBUF_DATA_FORMAT_2_10_10_10.BUF_FMT_10_10_10_2_UNORM44 andBUF_FMT_2_10_10_10_UNORM50, astools/disasm_rdna2.pyalready does.Change
BUF_FMT_2_10_10_10_UNORM(code 50, legacy DFMT 9).Implementing the real
10_10_10_2layout is left out, so the change stays a pure correction.Tests
draw-descriptor-store-format): thexyzwstore uses code 50, with unchanged pinned words. A new GPU run gives that store code 44 and must leave its element at the sentinel.compute_load_format_check.py draw): thexyzwload uses code 50. A fifth invalid-format run gives it code 44 and must leave all 320 words at the sentinel; a zero-filled reference must fail.0x00040FAC). The pinned legacy word for code 50 is0x00048FAC. With the old mapping restored, the store controls and the load model fail.Results
Run at
282f630on8bfbabf(main), Windows 10 build 19045, debug layer enabled, 0 debug errors and 0 debug warnings on every dispatch.tests/compute_store_check.py draw-descriptor-store-formattests/compute_load_format_check.py drawOther checks:
tests/compute_store_check.py binarywith LLVM 15: pass.tests/compute_load_format_check.py binarywith LLVM 15: pass.form_coverage_check,docs_links_checkandbidi_controls_check: pass.No capability skips.
The open d16 PR #2165 uses code 44 in its fixture. Once one of the two merges, I'll update the other.
🤖 Generated with Claude Code