Repository navigation
fix(shader): isolate terminating paths from loop continuations - #2311
JulioCacko wants to merge 1 commit into
Conversation
|
Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at
LGTM! |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks. I built it merged onto current main and ran the full libSceAgc/libSceAgcDriver ctest (293/293 green), but the new tests don't show the bug:
tests/execution/RuntimeImages.cpp:22(RunLoop, wave32 and wave64): with the fourSpirvBackendsources reverted tomain,agc_driver_runtime_imagesstill passes on RADV. The loop it builds never yields a terminating path inside a continuation onmain, so neither the structural check (lines 53-62) nor the stored values (lines 67-74) exercise the change.tests/Structurizer.cpp:81: the PR changes nothing in the structurizer, so this case passes onmainas well and tests nothing of this PR.- Only
tests/SpirvModule.cpp(the new helpers) depends on the change, and it pins the helper API, not the failing case.
Please add a case that fails on main: a guest loop whose shader (a runtime image op, as you describe) really emits OpUnreachable/OpKill/... in the continue block, and check it fails on main (e.g. spirv-val on the output, ANYPS5_ENABLE_SPIRV_TOOLS, or a before/after log of the validation error on your RTX 3070). Also state which driver rejects the main SPIR-V.
Smaller point: core/libs/prx/libSceAgcDriver/CMakeLists.txt:701 adds the include directory for the test outside the if(BUILD_TESTING) block and not next to the target definition; move it there.
boykopovar#2311) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested head
Both runs used the default pipeline configuration; The branch needs an update for current main. For this local validation I resolved the conflicts in |
boykopovar#2311) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the work. I rebased this onto current
Closing as a duplicate of work already on |
What
Runtime image operations can emit terminating paths inside a guest loop's continuation. Record emitted
OpLoopMergeoffsets and move the SPIR-V continuation to a separate backedge block only when the emitted instruction range containsOpUnreachable,OpReturn,OpReturnValue,OpKill, orOpTerminateInvocation. Preserve the semantic guest CFG and patch phi predecessors to the actual block exit labels.This is a SPIR-V structural correction, not a change to RDNA instruction semantics. The rule comes from the SPIR-V specification's structured-control-flow restrictions on continue constructs: https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_structured_control_flow. Tests cover patch offsets across vector growth, invalid offsets/IDs, terminating opcodes, unchanged guest instruction ranges, and a runtime image loop's three stores plus untouched exit row in wave32 and wave64.
Tested
Windows 11 x64, MinGW GCC, RelWithDebInfo, SPIRV-Tools enabled, NVIDIA GeForce RTX 3070. Focused build passed;
agc_spirv_module,agc_structurizer, andagc_driver_runtime_imagespassed 3/3 (0.15 s, 0.14 s, 0.80 s) withANYPS5_REQUIRE_VULKAN=1, no skips. The branch/title/body conventions check passed. Built and tested with the integrated contribution set on upstreamd70b8998; this branch contains only the loop correction. Synthetic regression results do not establish Demon's Souls presentation or gameplay.Checklist
main; open-PR overlap checked before submission