shader: do not reuse texture size query (fixes AMD compiler crash) #133
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/133"
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?
Imported from uiliannn/VItoriaBr. Originally posted by GaiuLulius on 2026-11-28T02:08:29Z.
Port of Belobug PR #324.
🇧🇷 Português
Impede que o otimizador de bitcode desduplique consultas de dimensão de texturas (dx.op.getDimensions). No driver Direct3D 12 da AMD (amdxc64.dll, arquitetura RDNA4/RDNA2), a reutilização de uma mesma consulta getDimensions entre múltiplos blocos provocava o crash do compilador em 29 pipelines de compute de raytracing (CS_RaytracingResolve). Com esta alteração, a consulta permanece no ponto emitido pelo lowering. Inclui teste de regressão a_size_query_is_not_reused.
🇺🇸 English
Prevents the bitcode optimizer from reusing texture size queries (dx.op.getDimensions). On AMD's D3D12 driver compiler (amdxc64.dll), deduplicating getDimensions calls across blocks caused the compiler to crash on 29 raytracing compute pipelines (CS_RaytracingResolve). With this change, size queries remain where lowering placed them. Includes regression test a_size_query_is_not_reused.
Co-authored-by: Belobug [email protected]
Imported from uiliannn/VItoriaBr. Originally posted by upipibi on 2026-11-28T02:18:37Z.
One follow-up that may be needed on RDNA 4 (read from another tree's threads, not run):
ZigZagBoi1/ScarlettPort, also from the fxceless lineage with the same
bitcode/opt.rs, already had this fix (Belobug's "size query not reused"). An RX 9070 XT (Adrenalin 26.11.2) still died in AMD's compiler atamdxc64.dll+0x861b9f(read0x8) right after the pipeline backlog cleared (ScarlettPort#73). They called it "a different trigger in the same compiler".What stopped it was avatarmanz/VIctory-7900XTX#357, ported as ScarlettPort#93 (both GPL-3). On RDNA 4 hosts (
0x7550..=0x75ff), a raw view'sgetDimensionsgets a handle of its own. Its heap index is computed again, markedNonUniformResourceIndex, and kept out of the clean-up passes (Module::mark/keep_since), so REUSE can't merge it back into the load's index. The reporter played 8.5 minutes in the world with it, without the crash.So this PR covers the 29
CS_RaytracingResolvepipelines. The RDNA 4 fault may need ScarlettPort#93 on top. Upstream VIctory has the separate-handle form as Marvisak/VIctory#2122.AI-assisted (Claude Code, Claude Opus 5.5 read ScarlettPort#73/#93 and this diff).
Imported from uiliannn/VItoriaBr. Originally posted by GaiuLulius on 2026-11-28T02:26:26Z.
Thanks for the context and pointers to ScarlettPort#93 and Marvisak/VIctory#2122!
Indeed, keeping this PR strictly focused on the 29
CS_RaytracingResolvepipelines makes it clean and easy to review/merge. I can prepare the separate handle /NonUniformResourceIndexfollow-up for RDNA 4 (0x7550..=0x75ff) in a subsequent PR on top of this.AI-assisted (Hermes Agent, local analysis on VItoriaBr and Belobug diffs).
Pull request closed