shader: run the BVH builder's short last groups in 32-lane waves (the last 2 refused builder PSOs) #105
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/uiliannn--VItoriaBr!105
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-105"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@martindevbr on GitHub · 2026-11-26 00:20 UTC · original
martindevbr:pr/bvh-launched-exec→main· +234 −5 · 4 files · 1 commits · openProblema / Problem
O README diz: "Restam 2 PSOs recusados no builder para investigar." São os 2 programas de reidratação Box32/16 do construtor de BVH. Na NVIDIA (32 lanes) o driver os recusa (
VICTORY_D3D12_DEBUG=1): "Shader wants wave lane count of 64 but maximum wave lane count for device is 32" — e com isso o construtor inteiro fica desligado (2 de 53 pipelines faltando, 120–1.400 dispatches do builder descartados por quadro).Causa: o dispatch desses programas pode terminar num grupo curto; eles eram lowerados com as threads além da contagem saindo logo no início, e essa forma nunca divide uma wave64 do console em duas waves de host (as metades se encontram nas barreiras de grupo, que threads que saíram não alcançam). No console essas lanes ficam na wave com o bit de EXEC apagado, e o código depende disso:
s_bcnt1do EXEC na entrada e somas da wave inteira (s_or_saveexec_b64 -1) que mascaram as lanes fora do EXEC salvo.Mudança / Change
structure::with_launched_exec: o EXEC de entrada passa a ser uma máscara opaca das lanes lançadas.lowerdá esse EXEC como o ballot da wave do console de "thread < contagem do dispatch" (cada metade faz o seu e as duas trocam no bloco de entrada), mantendo as threads além da contagem rodando com o bit apagado.box_rehydrationque já existe), em hosts de 32 lanes, e só mantido se sair em waves de host;VICTORY_LAUNCHED_EXEC=0desliga. Hosts de 64 lanes não mudam.Testes / Tests
a_short_last_group_in_host_waves_of_32_keeps_its_unlaunched_lanes_out_of_exec(programa sintético, roda na placa): com 0, 1, 7, 31, 32, 33, 40, 41, 63, 64 e 65 threads, a contagem de lanes lançadas e uma soma da wave inteira batem com o console em toda lane lançada, e lanes não lançadas não escrevem nada.cargo test -p victory-shader: ok; clippy-D warningslimpo.translate --validate --pipelinesemXboxBvhBuilder.dll(RTX 3060): 52/52 com pipeline (50/52 antes / withVICTORY_LAUNCHED_EXEC=0).No jogo / In game (RTX 3060 12 GB, 32 GB, preset do README +
VICTORY_BVH_BUILDER=1)VICTORY_FIRSTLANE_OWN, o título morria em ~9–18 s); descartes 477 → 4 por quadro (os 4 restantes são compute wave64 fora do builder).The builder now has all its pipelines and runs without dying on a 32-lane GPU; it stays off by default because of its CPU-side cost (next step).
The two Box32/16 rehydration programs of the ray-tracing structure builder were the last builder stages without a host pipeline on NVIDIA: their dispatch can end in a short group, so they were lowered with the threads past the count leaving at the start, and that form never split a console wave64 into two host waves (each half meets the other at group barriers, which threads that left cannot reach). They stayed wave64 and the driver refused them ("Shader wants wave lane count of 64 but maximum wave lane count for device is 32"), which kept the whole builder off: 2 of 53 pipelines missing, 120-1,400 builder dispatches dropped a frame. On the console such lanes are in the wave with their EXEC bit clear, and these programs read that: `s_bcnt1` of EXEC on entry, and whole-wave scans (`s_or_saveexec_b64 -1`) that mask lanes outside the saved EXEC. `structure::with_launched_exec` now takes EXEC on entry as an opaque mask of the launched lanes, and lowering gives it as the console wave's ballot of "thread < dispatch count" (each host wave's, exchanged between the halves in the entry block), keeping the threads past the count running with that bit clear. Tried only for those programs on 32-lane hosts, and only kept when it comes out in host waves; `VICTORY_LAUNCHED_EXEC=0` turns it off. Offline (`translate --validate --pipelines`, XboxBvhBuilder.dll, RTX 3060): 52/52 builder programs validated and with pipelines (50/52 before). New test runs a short group on the card for 0, 1, 7, 31, 32, 33, 40, 41, 63, 64 and 65 threads: the launched count and a whole-wave sum match the console's in every launched lane, and unlaunched lanes store nothing.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.