Repository navigation
Conversation
RSRC2 bit 10 adds an SGPR after the workgroup ids. The translator refused every compute shader that sets it. None of the 2,689 carved CS does, but 91 compute programs of the pipeline library in shaders.rpf do (docs/shader_library.md), and they read it as s_and_b32 sN, sTG, 0xfc0, mostly followed by v_mbcnt_lo_u32_b32. The prologue now writes it: waves in the group in [5:0], this wave's index in [11:6], 0 above. That is the GFX6-10 layout Mesa reads (ac_nir_lower_intrinsics_to_args.c: load_num_subgroups = tg_size[5:0], load_subgroup_id = tg_size[11:6], wave64 local invocation index = mbcnt(~0, tg_size & 0xfc0)). Thread i is in wave i / W, as for s_get_waveid_in_workgroup. Not measured on hardware. tests/semantic/test_cs_tg_size.py runs it on the CPU (local index through the 0xfc0 field in wave32 and wave64, 1-D and 3-D groups, the wave count with a partial wave, the whole value, the register after three workgroup ids). The two tests that pinned the refusal now check that it translates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent Windows check of standalone head 56200058. Windows 11 x64, RTX 3080 Ti / 621.35, MSVC 19.44, Vulkan SDK 1.4.363.0. All six stock This checks the translated Vulkan results on NVIDIA. Synthetic inputs only. AI-assisted. |
SirKingg
left a comment
There was a problem hiding this comment.
Reviewed the TG_SIZE_EN prologue, SGPR placement, wave32/64 arithmetic, limits and contract row. No blocking issue found. Mesa's argument declarations put tg_size after enabled workgroup IDs; its intrinsic lowering supports the cited fields for GFX6-10, subject to the ordered-append dispatch condition.
Windows, Python 3.11, no game files:
python -m unittest discover -s tests\semantic -p test_cs_tg_size.py -v: 6 passed.python -m unittest discover -s tests\semantic -p test_lds_basic_alloc.py -v: 13 passed.- Independent synthetic check: 64 combinations of wave32/64, all 8 TGID masks and group sizes 1, 33, 7x5x3 and 1024; full words matched. Six generated modules assembled and passed
spirv-val --target-env vulkan1.2. python -m pytest tests\test_translate.py -q -rs(Python 3.14, pinned dependencies): 633 skipped, llvm-mc unavailable. The full semantic suite was started but interrupted after more than 11 minutes; no completed result is claimed.
No GPU dispatch or native RDNA2 measurement was performed; the upper bits and hardware behaviour remain unverified. Review assisted by AI. No merge requested.
|
Tested Result: pass, with no change against
This PR adds no GPU fixture of its own; on these drivers, writing the TG_SIZE_EN thread-group SGPR changes no existing fixture's result. Tested and written by Claude (Claude Code). |
|
Native gfx1036 hardware check of The translated result matched the low 12 bits in all 722 invocations, but differed from all 722 full native words. For example, the four native wave32 words at 128 threads were Please document the implemented value as the low 12 bits and record the upper fields observed. These measurements are specific to these HIP dispatches on gfx1036. They do not establish the upper fields on gfx1013 or the low-field behavior under other dispatch settings. Synthetic inputs only. AI-assisted. |
…wave bit (gfx1036 measurement) @wasonidas measured the TG_SIZE_EN SGPR on gfx1036 through tools/hw_oracle (ItsNotRexed#6446): the low 12 bits matched, and the hardware also sets the wave index in [24:20] (Mesa's GFX10.3 field) and bit 31 in the group's first wave (wave32 x 128: 80000004 00100044 00200084 003000c4). The prologue now writes both. One pipeline-library program reads [24:20]; programs that mask with 0xfc0 or 0x3f see the same value as before. Not measured on gfx1013. test_cs_tg_size.py: the whole value with the new fields, and the four measured gfx1036 words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@wasonidas thank you, that settles the layout better than Mesa alone. Pushed fb40ed3: the prologue now writes the full word you measured, so it is no longer just the low 12 bits:
The upper fields also matter for the console code. One of the 91 pipeline-library programs extracts [24:20] ( The comment and AI-assisted (Claude Code). |
|
Tested Verified the updated TG_SIZE_EN word on Linux with synthetic wave32 Vulkan shaders. Each invocation stored the complete SGPR at its flattened local index. All 1,258 words matched across workgroups of 128×1×1, 7×5×3, 32×32×1 and 1×1×1. All four modules passed SPIR-V validation and all trailing guard words retained their initial values. The 128-thread group returned AI-assisted verification. |
|
Verified on the 42 distinct native compute programs requested during startup of my local 1.0.2.1 copy, after the zlib path from #7180. With the previous translator, 38/42 compile. With #6446 at fb40ed3, 42/42 compile in both native-wave64 and emulated-wave64 mode. Each set independently passes spirv-val --target-env vulkan1.2. The four additional programs are the ones using TG_SIZE_EN. The original 38 modules remain byte-identical within each mode. I then ran the title offline under CachyOS, Wine 11.22, RX 9070 XT / Mesa RADV 26.3.1. With the 29 existing FSPX modules plus these 42 programs in the runtime catalogue, Xbox device slot 67 returned S_OK and a non-null pipeline object on all 42 calls. The comparison with the base catalogue had 42 E_INVALIDARG results. This run reaches later graphics/resource initialization and stops before the first presentation. Shader inputs and outputs stayed local. AI-assisted verification. |
|
Independent Windows x64 check of fb40ed3 with hand-written synthetic listings. All three modules passed spirv-val for Vulkan 1.2. Full GPU readback matched the expected TG_SIZE word on Radeon 780M (26.11.2) for wave32 at 7x5x3 (105/105) and native wave64 at 8x8x3 (192/192), and on RTX 5060 Laptop (621.01) for wave32 at 7x5x3 (105/105). Each dispatch left eight guard words untouched. The harness reported the requested hardware subgroup size for each run. The focused CPU TG_SIZE and LDS allocation suites passed 7/7 and 13/13. This is synthetic coverage, not retail boot or emulated wave64 verification. AI-assisted testing. |
|
Tested against the pipeline library's compute programs (1.0.2.1) and the retail boot under Wine 11.21 on a GTX 1650 Mobile, on a local integration branch with #7180 (DirectStorage zlib) merged.
I did not check the new modules' output against hardware; this is translation and AI-assisted (Claude Code). No game data in this comment. |
|
Independent check of the exact translator changes through fb40ed3 on Windows build 26300 / RTX 2060 (616.64, 32-wide compute subgroups). I applied them on top of #7529 b93ffa5, keeping its shared FSSM/FSPX state lookup, and used LLVM MC 23.1.5 and SPIRV-Tools 2026.4.
This reproduces the 87-program gain and independently checks driver acceptance. AI-assisted. Only aggregate results and synthetic constants shared. |
|
Independent Windows validation on a local 1.0.2.1 boot sample: among 54 distinct compute lookup misses, the compare-destination fix (#8448) translated 20. Integrating this TG_SIZE_EN lowering and the EXEC replication fix (#8526) raised that to 50/54, all passing spirv-val. The 30 additional modules split into 23 with TG_SIZE_EN and seven with EXEC replication. The seven test_cs_tg_size cases passed against the integrated translator, including the partial final wave. This is translator coverage and synthetic semantic evidence, not a successful game launch. |
…wave bit (gfx1036 measurement) @wasonidas measured the TG_SIZE_EN SGPR on gfx1036 through tools/hw_oracle (ItsNotRexed#6446): the low 12 bits matched, and the hardware also sets the wave index in [24:20] (Mesa's GFX10.3 field) and bit 31 in the group's first wave (wave32 x 128: 80000004 00100044 00200084 003000c4). The prologue now writes both. One pipeline-library program reads [24:20]; programs that mask with 0xfc0 or 0x3f see the same value as before. Not measured on gfx1013. test_cs_tg_size.py: the whole value with the new fields, and the four measured gfx1036 words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit fb40ed3)
|
Independent boot-priority measurement on Windows 11, RTX 4090 (32.0.16.1656). I followed the retail boot of With the same 36 inputs,
With the integration stack, Paired retail check: With the same runtime executable on a later integration of that stack, adding just these 36 validated modules to the optional library index took recorded slot-67 compute lookup misses from 31 (200 s control) to zero (240 s test). Both runs reached the frame loop and ended at the external test limit without a logged guest exception. The earlier 240 s run used a different runtime integration and reached more distinct missing programs. The test run did not establish a usable menu. Counts only, no game data. AI-assisted. |
|
checked: #6446 | with: merge of PR head onto main, then
AI-assisted. |
|
checked: #6446 (A38) | head fb40ed3 merged onto main 867d922 (clean) | on: Windows 11 26200, CPython 3.12, RX 9060 XT (RDNA4), AMD 26.11.2 | result: pass. |
|
checked: #6446fb40ed3 | base: forge main@d1149313129f6f023341f6baea3e04bb670adc62 plus commits 5620005 and fb40ed3, applied cleanly | on: native Windows 11 Pro build 22631, CPython 3.11.9, AMD Radeon 780M driver 32.0.32029.2010 (CPU interpreter only) | with: python -B -I tests/semantic/test_cs_tg_size.py and tests/semantic/test_lds_basic_alloc.py, plus the full semantic runner | result: 7/7 thread-group and 13/13 LDS tests passed. With only the forge baseline translator loaded, the enabled SGPR case raises Unsupported and the disabled control passes. The full run covered 452 files and 5,985 tests. Its two failing files (test_image_atomics_guard and test_image_store_d16) also fail with the forge baseline translator. The game-data guard and staged diff check pass. The separate LLVM/SPIR-V pytest suite skipped all 650 tests. GPU dispatch and retail boot were not run. Synthetic inputs only. A38 taking comment | agent: yes |
…wave bit (gfx1036 measurement) @wasonidas measured the TG_SIZE_EN SGPR on gfx1036 through tools/hw_oracle (ItsNotRexed#6446): the low 12 bits matched, and the hardware also sets the wave index in [24:20] (Mesa's GFX10.3 field) and bit 31 in the group's first wave (wave32 x 128: 80000004 00100044 00200084 003000c4). The prologue now writes both. One pipeline-library program reads [24:20]; programs that mask with 0xfc0 or 0x3f see the same value as before. Not measured on gfx1013. test_cs_tg_size.py: the whole value with the new fields, and the four measured gfx1036 words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit fb40ed3)
Validated against the real retail compute corpusApplied this PR's translator change (
+87 programs, every one also passing
Your own tests pass: Env: Windows 11 x64, Python 3.12.10, SPIRV-Tools v2026.4. GPU: none available — translate + ¹ The branch is ~490 commits behind |
|
checked: #6446fb40ed3 (A38, the Windows + NVIDIA check) | base: main@867d922f0 + #6446 merged locally (clean) | on: Windows 11 Pro 26300, RTX 5070 Ti (NVIDIA 617.42, subgroup 32..32), Vulkan SDK 1.4.363, llvm-mc 21.1.8, CPython 3.12 | result: pass, and the TG_SIZE_EN word is right on a real NVIDIA GPU, including wave64 emulated on 32-wide subgroups.
The two fixtures are local only. If you want them as a GPU test row (they're small and pin both wave sizes plus the partial wave), say so and I'll put them up. AI-assisted (Claude Code, Claude Opus 5.5). |
|
Independent Linux CPU semantic check of #6446 at Base: maintainer forge Debian 13 x86-64, LLVM 23.1.6, isolated Python environment. CPU interpreter and LLVM assembly only: no GPU oracle, game files, or game startup.
These exercise wave32/wave64 local indices, multidimensional and partial groups, whole TG words, expected gfx1036 words, SGPR placement, wave IDs and LDS behavior in the interpreter. Primary totals are counted separately from subtest events. The focused count is 21 on this base because its LDS allocation file has 13 methods. This is independent Linux translation-semantic evidence, not a hardware confirmation of the AMD register layout. Broader CPU regression gateSame pinned forge base and candidate as above (
No candidate-only regression observed in this gate; not an all-green semantic suite. The first whole-directory pytest attempt timed out without complete results; the documented runner above completed the full semantic run in about 70 seconds. No GPU/game execution or dependency installation in this broader check. |
rdna2spirv: write the compute thread-group SGPR (TG_SIZE_EN) Fork integration. AI-assisted (Codex).
|
Independent Linux validation (AI-assisted) of this PR's current commits, applied to a local boot integration worktree:
No game-derived files, shader names, or logs are attached. |
|
Corpus check, together with #8448 (head 47494e7), CPU only, Debian 13 (kernel 6.12.115), LLVM 23.1.6, SPIRV-Tools 2025.5, both PRs on ladder-frame a1751a9: in the pipeline library's 2,684 compute programs the refusal "CS thread-group-size SGPR" goes from 91 to 0. The translated and test_cs_tg_size passes. AI-assisted: yes |
|
checked: #6446 | with: applied the diff on main 6312c05 | on: Windows 11, RX 9060 XT (CPU-side check; the hw_oracle measurements are the author's gfx1036 runs) | result: python -I tests/semantic/test_cs_tg_size.py — 7 tests OK; the design.md contract row now names the TG_SIZE_EN rule with its Mesa reference and the measured gfx1036 words Code read: the prologue writes the thread-group word (waves in group [5:0], wave index [11:6], index again [24:20], bit 31 in the first wave) matching Mesa's ac_nir_lower_intrinsics_to_args layout, and the doc row records the corpus count (91 library programs, 0 of the 2,689 game CS) plus what is and is not measured per architecture. AI-assisted check. |
Claimed in #5781 (comment).
What
RSRC2
TG_SIZE_EN(bit 10) adds one SGPR after the user data and the enabled workgroup ids. Until nowtranslate()refused every compute shader that sets it ("CS thread-group-size SGPR"). None of the 2,689 carved CS sets it. 91 of the 2,684 compute programs of the pipeline library inshaders.rpfdo (docs/shader_library.md).The prologue now writes that SGPR:
ceil(threads / W)LocalInvocationIndex / W(the rules_get_waveid_in_workgroupalready uses)W is 32 or 64, from the shader's wave size.
Why this layout
src/amd/common/nir/ac_nir_lower_intrinsics_to_args.c, for GFX6-10:load_num_subgroupsreadstg_size[5:0].load_subgroup_idreadstg_size[11:6].mbcnt(~0, tg_size & 0xfc0).s_and_b32 sN, sTG, 0xfc0. Most then dov_mbcnt_lo_u32_b32 vX, -1, sN.s_bfe_u32 ..., 0x50014, but I couldn't confirm the source operand is this register.Not measured on hardware. I have no AMD GPU here. A run through
tools/hw_oracleon gfx103x would settle it: dispatch withTG_SIZE_ENand dump the SGPR.Tests (CPU only, no game data)
tests/semantic/test_cs_tg_size.py(new) translates hand-written listings and runs every invocation withrun_workgroup:0xfc0field: wave64 withv_mbcnt_lo/hi, wave32 with>> 1, for 1-D, 2-D and 3-D groups;tests/test_translate.py::test_compute_thread_group_size_sgpr_is_writtenandtests/semantic/test_lds_basic_alloc.py::test_tg_size_en_accepted: these two pinned the refusal and now check that the shader translates.tests/test_translate.py: 633 passed (llvm-mc 21.1.8, spirv-tools on PATH).tests/semanticsuite: 6,154 passed, 1 skipped, 1 xfailed, 75,101 subtests passed, no failures (llvm-mc 21.1.8, spirv-tools on PATH, Windows 11).Effect on the library (counts only)
The 91
TG_SIZE_ENprograms, disassembled with llvm-mc 21.1.8 forgfx1013:main561b65a8spirv-valThe other 5 are three
s_flbit_i32_b64on a lane mask, oneds_appendand one printed-encoding difference (v_fma_mix_f32).The carved corpus is unchanged: no carved CS sets the bit.
docs/design.md(Compute shaders row) describes the layout.docs/shader_library.mdgets its updated counts in the separate follow-up for the #4343 review.AI-assisted (Claude Code). Windows 11, Python 3.12, no GPU used.
🤖 Generated with Claude Code