fix(shader): ballot each predicate once per block #6644
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6644"
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 boykopovar/AnyPS5. Originally posted by mariuszkreft on 2026-10-16T01:06:03Z.
What
Tested
Linux, on the host, in the slice worktree. The loop ran this gate itself; the tail of it is
at the bottom of this pull request. No title and no GPU were involved.
Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryVerification log tail
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T01:37:10Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/tests/Wave32WideSubgroup.cppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvSubgroup.cppcore/libs/tests/Wave32WideSubgroup.cppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/libs/tests/Wave32WideSubgroup.cppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvSubgroup.cppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppImported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-16T20:06:52Z.
@mariuszkreft heads-up: this PR, your #6638 and your #6654 all change the same line in
SpirvValueEmitContext::Ballot(the high-halfOpGroupNonUniformBallot), and none of them names the others ("Depends on: none" on all three). They can't all merge as they are.git merge-tree --write-treeon each pair of heads (#6638f826414e2, #6644 4ecf22026, #66541c0c66c98):SpirvEmitter.cppSpirvEmitter.cppandSpirvMemory/SpirvSubgroup.cppSpirvEmitter.cppandcore/libs/tests/Wave32WideSubgroup.cppEach of the three merges cleanly onto upstream/main
ea4cc112aon its own.This PR already covers #6638's case. Here the high-half ballot goes through
AddSubgroupBallot, which turns a repeat of the low half's predicate in the same block into anOpCopyObject. #6638 avoids the same repeat with its ownhighPredicate == lowPredicatecheck. To check, I applied only #6638's test change (CheckTwoLaneBallotincore/libs/tests/Wave32WideSubgroup.cpp) on top of this head, without #6638'sSpirvEmitter.cppchange:wave32_wide_subgroupAddSubgroupBallotandCollapseBlockBallotsdisableda wave64 ballot of one predicate for both halves was not issued onceYour description here also says the same rewrite fixes
c02e5e3f35010fa5, the capture #6638 was opened for. So you could close #6638, or mark which PR depends on which. As it stands, the checklist line "no other open PR implements the same functions" doesn't hold for #6638 and #6644.#6654's description says "Removing repeated ballots is not enough" and that its OR form builds
fe506552cec99bfctoo. If #6654 is meant to replace this PR, or to land on top of it, a note on both would help the reviewers pick the merge order. I did not run #6654.This PR's own tests (
agc_spirv_module,agc_spirv_optimizer,_full,_none,wave32_wide_subgroup) passed 3/3 on head 4ecf22026 and merged onto upstream/main406fd9ea9. With the dedupe disabled,agc_spirv_moduleand the three optimizer tests failed 3/3 with the same check counts as your log (3, 6, 6, 4).Setup: Linux, lavapipe (Mesa 26.2.4),
-DANYPS5_ENABLE_SPIRV_TOOLS=ON,ctest -V --no-tests=error -R '^<name>$'. Nothing was run on NVIDIA or with the GTA V captures.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Neithennn on 2026-10-17T19:39:01Z.
Windows NVIDIA run, since the description says no GPU was involved.
Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), AMD Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies,
BUILD_TESTING=ON,ANYPS5_NO_SHADER_CACHE=1. Head4ecf22026merged onto mainf51724078; full build succeeds.wave32_wide_subgroup,agc_spirv_module,agc_subgroup_clock,agc_driver_wave32_subgroup,agc_driver_wave32_exec_lane_bits: pass, withANYPS5_REQUIRE_VULKAN=1. The RTX 4080 reports subgroups of 32.ctest -j 8: 1397/1398. The failure isagc_driver_multisample_fill_host_only(the intermittent test of #6512) in that run only: it passes 10/10 serial runs on this tree, and this PR does not touch that path. Unchanged main on the same machine: 1398/1398.No title run.
AI-assisted: yes (runs done with Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T08:15:27Z.
Checked the block-local dedupe (
AddSubgroupBallot,CollapseBlockBallots): a repeat of the same (type, scope, predicate) inside one block, with no label, call or demote in between, returns the same result, and the set is cleared on each of those. The new tests fail with the dedupe disabled. The only conflict withmainwas the test list inSpirvOptimizer.cpp(next to the new constant-sharing tests); I rebased, kept both lists, and the build and ctest pass on the rebased head. Thanks to @Neithennn for the Windows/RTX 4080 run. Merging through the queue.