Skip to content

shader: name gfx10 register codes in gfx1013_graphics_wqm.inl - #3901

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
Leyukaka:quality-item2-s2-wqm
Dec 2, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
Leyukaka:quality-item2-s2-wqm

Conversation

@Leyukaka

@Leyukaka Leyukaka commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

src/gfx1013_graphics_wqm.inl still writes scalar registers as bare numbers: 126/127 for EXEC, 106/107 for VCC, 105 for the last general SGPR, 256 for the first VGPR operand and 128 for the SCC slot of the scalar state. #3830 added src/gfx1013_registers.h to keep the register code, operand and translator slot meanings apart, and converted gfx1013_compute_native.cpp.

Change

This is the second slice. No behaviour change.

  • 8b70c6773 uses the constants from gfx1013_registers.h in src/gfx1013_graphics_wqm.inl (+53/-37, one file). The substitution is textual and the values and types are unchanged.
  • The numeric WQM lowering's write(128) becomes reg::scc_slot: it is the SCC slot of the scalar state, not operand 128 (the constant 0).
  • Left numeric:
    • 104, the bound for an aligned 64-bit register pair. The header has no constant for it, and shader: name gfx10 register codes in gfx1013_compute_native.cpp #3830 left it as is too.
    • 512 +, the key offset of the saved-coverage tags in graphics_registers. It is a translator map key, not a register code or an operand, and gfx1013_direct_graphics.inl uses the same offset.
    • 0x1890, an export target mask, along with branch opcodes and IR text. None of them are register codes.
  • No build change. The file is compiled inside gfx1013_compute_native.cpp, which already includes the header, and it is already a native shader revision input.

Validation

Built on Windows with MSVC, head 8b70c6773 on main c42b7ce3f.

  • native_graphics_wqm_ir, native_pixel_alpha_kill_controls, native_pixel_cmpx_discard_warp, native_pixel_compare_mask_ir, native_pixel_saveexec_masks_controls, native_pixel_cmpx_scalar_tail_controls, native_translator_corpus_dxil and native_translator_corpus_ir pass.
  • Translator corpus (tests/translator_corpus_hash.py): the TSV built from main c42b7ce3f and the TSV built from this branch have the same SHA-256, so they are byte-identical. The corpus is a general regression check; the WQM paths are covered by the targeted tests above.
  • Each replaced site was also read a second time against the header to confirm the same value and type.

Other open PRs

#3847 (draft) also edits gfx1013_graphics_wqm.inl, but only adds a block at the head of the file, above the lines changed here, so there is no overlap. If this lands first and a rebase is needed, I am glad to help.

Replace the magic register numbers in src/gfx1013_graphics_wqm.inl with
the constants from src/gfx1013_registers.h: EXEC (126/127), VCC
(106/107), the last general SGPR (105), the VGPR operand base (256) and
the internal SCC slot written by the numeric WQM lowering (128). The
substitution is textual and the values are unchanged, so the translator
output is byte-identical. The aligned-pair bound 104, the 512 offset of
the saved-coverage tags, export target masks, branch opcodes and IR text
are left as they are. The file is already a native shader revision
input and is compiled inside gfx1013_compute_native.cpp, which includes
the header, so no build change is needed.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed 8b70c677. I checked all seven referenced register constants against gfx1013_registers.h. Substituting their original numeric spellings leaves the same WQM source after whitespace normalization, including the original wave64 alignment bound. The trial merge with main 1c4601ff is clean. At this head the Windows, Linux Python and gfx1013 fixture checks are green.

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.

2 participants