Commit Graph
10 Commits
Author SHA1 Message Date
Dean 43ea7688cf Merge pull request #5511 from JJenkx/perf/spirv-bounded-redundancy
perf(shader): avoid redundancy traversal map copies
2026-10-15 07:38:13 +13:00
Adrià a7d38a3f4f Merge pull request #4827 from QRMOE/fix-spirv-noopt-specialization
fix(shader): honor disabled optimization during specialization
2026-10-14 19:34:08 +02:00
JJenkx 8ed0bc395d perf(shader): avoid redundancy traversal map copies 2026-10-14 06:01:00 -04:00
Dean 675c52ca98 Merge pull request #4580 from coltken95/fix/shader-same-target-branch
fix(shader): never branch conditionally to one label twice
2026-10-13 16:52:48 +13:00
QRMOE cac1355283 test(shader): preserve specialized words when optimization is disabled 2026-10-13 01:02:56 +02:00
Claude 1285ee06f5 fix(shader): keep a folded selection's branch when SPIR-V 1.6 forbids one label
The previous commit pointed the untaken side of a folded branch that
keeps its selection merge at the merge block. That adds an edge from the
header to the merge block: the merge block's phis have no operand for it,
and values from the taken arm no longer dominate the merge block, as
fuzzing with validation on found once the repeated label stopped hiding
it.

For SPIR-V 1.6 the branch is now left as it is, so the control flow and
the untaken arm stay; earlier versions keep naming the taken label twice,
which they allow, and drop the untaken arm as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZWLdTjf1S57iLgn2rcaFb
2026-10-12 16:40:43 +00:00
Claude 52b679c552 fix(shader): keep the back-edge of a loop whose continue block is dead
Pipeline specialization replaced every unreachable block with
OpUnreachable. When a loop's continue target became unreachable, either
because the latch exited on a constant condition or because the emitter
had already folded it, that removed the header's only back-edge, and
validation rejects a loop header targeted by no back-edge block.

An unreachable continue target of a live loop header now keeps an
OpBranch to its header, as SPIRV-Tools' dead branch elimination does.
The header's phis keep an operand for it, naming the phi itself, since
the edge is never taken and the continue block's values are gone.

Found by recompiling mutated compute shaders with SPIR-V validation on,
for loops with a literal bound such as s_cmp_lt_u32 with two constants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZWLdTjf1S57iLgn2rcaFb
2026-10-12 16:25:22 +00:00
boykopovar 199eeb1805 fix(shader): preserve structured exits during SPIR-V specialization 2026-10-08 19:19:50 +03:00
Nikhil Panchal 39e8e70caf fix(recompiler): guard narrow-type scanning bounds
Check module headers, instruction lengths and required operands before
scanning narrow types.

Cover malformed and byte-swapped modules while retaining the native
SPIR-V 1.3 conversion matrix.

Tested: Linux/llvmpipe CTest three times with SPIRV-Tools on and off,
cold-cache Vulkan regressions, and ASan/UBSan in all optimization modes.
2026-10-08 13:20:06 +02:00
Nikhil Panchal 43074a805e fix(recompiler): avoid illegal narrow constants during optimization
Skip CCP and Simplification for storage-only narrow types while keeping
the remaining passes and arithmetic-capable folding.

Add compiler and Vulkan readback regressions for default/full/none modes.

Tested: Linux/llvmpipe, full CTest with SPIRV-Tools on/off, ASan/UBSan
optimizer checks, and cold-cache Vulkan wave32/wave64 readback.

Fixes boykopovar/AnyPS5#1276
2026-10-08 13:20:06 +02:00