Repository navigation
Conversation
Add src/gfx1013_registers.h with x2w::gfx1013::reg (VCC, M0, NULL, EXEC, the last general SGPR and the internal SCC slot) and x2w::gfx1013::operand (inline integer and float ranges, VCCZ, EXECZ, SCC, the literal and the VGPR base). The header notes the three number spaces that share these integers: scalar register codes, ISA operand encodings and translator slots. static_asserts pin every value; gfx1013_registers_check covers the predicate boundaries. Nothing includes the header yet.
Replace the magic register and operand numbers in src/gfx1013_compute_native.cpp with the constants from src/gfx1013_registers.h: VCC, M0, NULL, EXEC, the last general SGPR, the SGPR count, the zero/inline integer/float/literal/SCC operands and the VGPR operand base. The substitution is textual and the values are unchanged, so the translator output is byte-identical (the native_translator_corpus_* guard checks this). Decode masks such as & 127 and & 255, HLSL text, VGPR counts and the remaining bounds (108, 104, < 105, < 127, 192u - code) are left as they are. The header joins the native shader revision inputs.
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.
Problem
The gfx1013 translator writes scalar registers and operands as bare numbers (106, 107, 124 to 128, 255, 256...). The same integer means different things depending on where it appears:
Change
This is the first slice of replacing those numbers with named constants that keep the three meanings apart. No behaviour change.
88541bca6addssrc/gfx1013_registers.hwithx2w::gfx1013::regandx2w::gfx1013::operand, and thegfx1013_registers_checktest.static_asserts pin every value and one case per predicate checks its boundaries.a65c80947uses the constants insrc/gfx1013_compute_native.cpp. The substitution is textual and the values are unchanged. Decode masks (& 127,& 255), HLSL text, VGPR counts and the remaining bounds (108,104,< 105,< 127,192u - code) are left as they are. The header joins the native shader revision inputs inCMakeLists.txt.Only
gfx1013_compute_native.cppis converted here. Many open PRs edit thegfx1013_direct_graphics.inl,gfx1013_direct_compute.inlandgfx1013_direct_mesh.inlfrontends, so those will follow in small slices once that work lands.Validation
Built on Windows with MSVC, head
a65c80947onmainf365f125b.gfx1013_registers_check,native_compile_dxil_refusals,gfx1013_compute_ir_all,native_fixed_graphics_psi1andnative_direct_containerpass.tests/translator_corpus_hash.py, steps indocs/experiments/translator-corpus.md): the output built frommainf365f125band the output built from this branch have the same SHA-256, so the DXIL fingerprints and the refusal reasons are byte-identical.Opened as a draft: six open PRs (#3792, #3717, #3631, #3544, #3527, #3320) also edit
gfx1013_compute_native.cpp. I will rebase this after they land, so it does not force them to rebase.