perf(shader): reuse masked-select visitation storage #2654
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2654"
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 Celegans12 on 2026-10-10T10:12:44Z.
What
Masked-select elimination allocates a pending vector and a pointer set for each candidate's use walk. This reuses one pending vector and lazily allocated generation marks within the pass.
Dense marks are used only when the value's ID and pointer match the program's owned arena. Foreign, duplicate and newly added IDs retain the pointer-set fallback. Traversal order, mask and loop rules, fixed-point behavior and the seeded 4,096-visit limit stay unchanged. The const arena accessor supports that ownership check.
APS5_NO_PERF_MASKED_SELECT_SCRATCHretains the original containers. Its presence is excluded from the disk-cache key because both modes produce the same result; compiler source changes still produce a new SourceVersion. No request, cache-format or runtime-ABI layout changes are included.Tested
bae853e9is based onmain40a5b8fa; validated merge45cf3503includes1de7e438. Both platforms passed configure/full build/libs/registration and masked-select, shader-memory and disk-cache tests in both modes without skips.Coverage limits and historical measurement
Linux: CTest 0, skip checker/helper 1, raw
accepted=false. The async userfaultfd gate and skip checker are unchanged. Not tested: unavailable device/display, watched-memory, optional assembly and platform-specific subcases.Removing the neutral entry causes the expected opposite-mode miss after an ordinary hit; GREEN hits both ways. Historical integration: 30 exact SPIR-V comparisons; one eight-request OFF/ON/OFF triplet, 2.088/1.902/2.101 s. No current-main/game speedup claim.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-10T15:57:31Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
bae853e9, merged ontomain57f96fd2bin one build with 4 other new PRs.agc_masked_selectandagc_shader_disk_cache.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-10T20:35:06Z.
Independent focused Windows check at
bae853e9dc08b3ed3bb2d2d953acd28b1dbf0250: I compiled the PR's unmodifiedMaskedSelect.cpp, top-level IR sources,MaskedSelectEliminator.cppandDeadCodeEliminator.cppinto a standalone executable, using headers from that same commit. MinGW-w64 GCC 15.2.0 (UCRT/POSIX/SEH r2), C++20,-O2 -DNDEBUG.The executable exited 0 both with
APS5_NO_PERF_MASKED_SELECT_SCRATCHabsent and with it set to1. The added differential cases exercise the seeded visit-limit boundary, duplicate users, pointer identity/fallback IDs, 8-bit generation wrap, pending-state cleanup, fixed-point mutation and loop observations. This gives an isolated pass-level check alongside the integration run above.This run does not validate disk-cache neutrality, a merge into current main, GPU execution or a title speedup. AI-assisted: Codex inspected the source and performed the compilation and runs on my Windows machine.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:37:15Z.
Review: CHANGES_REQUESTED
Thanks for the thorough tests. The behaviour looks equivalent to the fallback path (visit limit, duplicate users, ID/pointer identity and generation wrap are all covered), but I can't see the benefit that justifies the extra code path:
MaskedSelectEliminator::Eliminatewith and withoutAPS5_NO_PERF_MASKED_SELECT_SCRATCH, 300 to 3000 masked selects with short use chains) showed no difference beyond noise (e.g. ~20 ms in both modes for 3000 selects).Perf PRs need before/after numbers on current
main. Please post a measurement where masked-select elimination is a visible share of the compile (several runs, medians, the command used), or drop the PR if it isn't. Without a measurable gain this addsMaskedSelectVisited.hpp, an env switch and a second walk implementation for nothing.Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-11T11:21:17Z.
I checked this against current main. The masked-lane walk now already retains its pending vector and generation-marked visitation storage in
cd4eaacf7c7300fee08a30c4c1188a86177e85db. That covers the allocation change proposed here. The earlier timing does not establish an additional benefit over current main, so I don't think rebasing this extra implementation is justified.Pull request closed