Repository navigation
reprend #2174: rdna2spirv: seed the POPS collision word so the wait loop ends (SHADER-POPS-COLLISION-SEED) - #2731
Conversation
…R-POPS-COLLISION-SEED) A pixel shader with an ordered section (POPS) reads the hardware's collision word, which sits in the SGPR after the user SGPRs and the primitive mask: collision wave id in bits 0-9, this wave's id in bits 16-25, overlap in bit 31. The program waits until wave_id + ~collision_id is below src_pops_exiting_wave_id + ~collision_id (unsigned). The translator orders the section with fragment-shader interlock and reads the exiting id as 0, and the word was whatever the push constants held at that dword, usually 0. With wave id == collision id the test is 0xffffffff < 0xffffffff, never true, so a wave that reached the loop ran it until the loop guard (65,536 rounds). The overlap test before the loop skips it whenever a lane is on in EXEC, so it is a wave (a host subgroup) with EXEC all off there; on 32-wide subgroups that is either half of a wave64 program whose lanes are all off. The SGPR is now the source of the program's wave-id extract (s_bfe_u32 with field 0x000a0010) when the program reads that SGPR's entry value (shader_meta's user_sgpr_reads), and it is set at entry to 0x00010000 (no overlap, wave id 1, collision id 0): the loop leaves after one round. A program without that extract keeps the old behaviour. - tools/rdna2spirv.py: pops_collision_sgpr and the entry store. - tests/semantic/test_pops_collision_seed.py: subgroups of 64 and 32 lanes, with and without the seed, and the SGPR search; the GPU fixture runtime/test/shaders/ps_pops_wait_loop.asm (check.py, run_gpu_tests.py) and its llvm-mc listing. - tests/semantic/spirv_wave_interp.py: the interlock instructions run as no-ops (a run has no other primitive). - runtime/test/vk_harness.cpp: a fragment shader that needs pixel interlock on a device without it is unsupported (77), as for barycentrics. - docs/design.md, docs/d3d12_vulkan.md: the POPS rows. GPU: on an RTX 4070 SUPER the fixture gives 4096 of 4096 pixels as expected; with the seed taken out every pixel's round count is 0x00010000. Idea from Marvisak/VIctory 7ac1f54, written anew. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
vk_harness: main's has_cap scan of both stages, plus needs_interlock = has_cap(fs_code, 5378) from the PR. Co-authored-by: QemmHD <290605352+QemmHD@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Current main after ProjectLeonida#2566. New conflict on top of the earlier carry merge: tools/rdna2spirv.py, _translate (straight-line and CFG paths): main passes extra=meta_extra to _shader_meta.collect and reads the literal samplers after it; the PR's g.note_pops_word(insns) runs right after that block, before fit_shared_memory / needs_barrier_rounds as before. Co-authored-by: QemmHD <290605352+QemmHD@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16 (pytest, no GPU),
Not independent: this PR and this check share the same owner (OreoFR). Treat it as a second-machine run, not an independent review. AI-assisted: Claude Code |
|
Independent check on Windows/NVIDIA (not the author), at
Machine: NVIDIA RTX 4070 Ti SUPER, driver 621.01 (Windows 32.0.16.2101), Windows 11 Pro 10.0.26200.9711, MSVC 14.52.37025, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8. No regressions seen. As with the other carries, a rebase on current AI-assisted: yes (opencode). |
…vm-mc does The carry's new fixture ps_pops_wait_loop.asm reads it (s_add_i32), and test_parity_with_llvm_mc_on_shader_fixtures failed where llvm-mc is installed: the decoder gave raw src_239. rdna2spirv and shader_ir already expect the special name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
AI-assisted: Claude Code |
|
Verified by MoonEyes (another owner than OreoFR) on head
AI-assisted (Claude Code). |
|
Merging. Head AI-assisted (Claude Code). |
Carries #2174 by @QemmHD, because it conflicts with
mainafter #2566 and the reminder to mergemain(#2174 (comment)) got no answer within the delay of the carry rule. If the author comes back, this carry is dropped.Item:
SHADER-POPS-COLLISION-SEED-CARRY(claimed in #2570 (comment); original itemSHADER-POPS-COLLISION-SEED).What this branch is
15350f6da, unchanged (no rebase, author commits kept).main(from the carry preparation of 29/11) that resolves the conflict, then a merge of currentmainf9f3ec4c6, which had a new conflict (below). Both merge commits carryCo-authored-bythe author.What conflicted and how it was resolved
runtime/test/vk_harness.cpp:main's two-stagehas_capscan, plus the PR'sneeds_interlock = has_cap(fs_code, 5378).f9f3ec4c6:tools/rdna2spirv.py,_translate(straight-line and CFG paths):mainnow passesextra=meta_extrato_shader_meta.collectand reads the literal samplers right after it; the PR'sg.note_pops_word(insns)follows that block, still beforefit_shared_memory/needs_barrier_roundsas in the PR.Tests
mainf9f3ec4c6merged), Windows 11, Python 3.12, no GPU used:tests/semantic/test_pops_collision_seed.py: 12 OK.run_gpu_tests --filter ps_pops_wait_loop: PASS 4096/4096; red (main'srdna2spirv.py): 1 failure + 14 errors, GPU FAIL; full semantic suite 530 files / 6537 tests, same 2 failures asmain.python -I scripts/check_no_game_data.pyon every file this PR changes: clean.ctest, the full translator suite).Depends on: none.
Needs an independent verifier before merge (red/green on another machine), as for any carry.
AI-assisted (Claude Code, oreofr-agent).
🤖 Generated with Claude Code