Repository navigation
Conversation
ConstantFolder::Fold visits each instruction once, in block order. A loop header phi whose back-edge value is a later phi that folds to it in the same pass, such as the header phi of an inner loop in which an S# is copied out and back, is visited before that phi folds and stays a phi of its one definition and itself. Later folds run only after read-lane or masked-select elimination changed the program, and since boykopovar#4150 the one after masked-select elimination only runs in programs where a PackedAncillary builtin still has live uses. These phis reach resource tracking, which compares descriptor dwords as IR values, so the phi of an S# and the S# itself become two samplers. Two PPSA11386 (007 First Light) pixel shaders each had 21 direct samplers for 6 distinct S# values; at two heap slots each they exceed the 32 sampler slots, and the shaders stopped at their first draw with "shader sampler pairs exceed runtime heap capacity". After its pass over the instructions, Fold now folds the phis of its blocks again until a pass folds none. Each fold turns a phi into an Identity, so the loop ends. Replayed on an older local branch with boykopovar#4150's restriction in place, the captured requests plan 6 samplers each, one per distinct S#, and recompile. agc_shader_memory compiles an S# copied out and back in three nested loops and sampled before and inside them, with and without a masked write: one sampler and one sampled pair each, two of each before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 15, 2026
Closed
|
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.
|
11 tasks done
This was referenced Oct 16, 2026
This was referenced Oct 17, 2026
Merged
12 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ConstantFolder::Foldvisits each instruction once, in block order. A loop header phi whose back-edge value is a later phi that folds to it in the same pass is visited before that phi folds, so it stays a phi of its one definition and itself. An example is an outer loop's header phi whose back-edge value is the header phi of an inner loop in which an S# is copied out and back.PackedAncillarybuiltin still has live uses.Such phis reach resource tracking, which compares descriptor dwords as IR values. So the phi of an S# and the S# itself become two samplers, and the same holds for T#s. Two PPSA11386 (007 First Light) pixel shaders each planned 21 direct samplers for 6 distinct S# values. At two heap slots each they exceed the 32 sampler slots, and the shaders stop at their first draw with:
shader sampler pairs exceed runtime heap capacityAfter its pass over the instructions,
Foldnow folds the phis of its blocks again until a pass folds none. Each fold turns a phi into anIdentity, so the loop ends. Only phis are repeated: a fold that depends on a phi folded this late waits for the nextFold, which follows read-lane and masked-select elimination as before. #4150's restriction stays as it is.#6083 raises the sampler heap to 32 pairs, which would also fit this shader's 21 samplers, duplicates included. This change removes the duplicates: the shader plans one sampler per distinct S#. The two do not conflict. #6176 and #5914 also edit
ConstantFolder::Fold; both merge cleanly with this change.Tested
maina08de68, then rebased without conflicts ontomainb3f9f89, wheretools/check_conventions.py --base upstream/mainandgit diff --checkpass.agc_shader_memory,verifyDescriptorPhis: an S# copied out and back in three nested loops, sampled before and inside them, compiled with and without a masked write. Each now plans one sampler and one sampled pair. Onmainboth plan two of each, and the test fails withdescriptor Phi: an S# copied out and back in three nested loops was planned as more than one sampler. One extra phi pass instead of the loop also plans two of each, so the test needs the fixed point.agc|shader|recompileron lavapipe (Mesa 26.2.4, LLVM 23.1.1; Arch Linux container, GCC 16.2.1): 575 of 580 pass. The five failures (agc_storage_kept_unit_settle,agc_driver_bc_block_copy,agc_driver_depth_compare_copy,agc_driver_native_multisample_depth,agc_driver_storage_write_back_overhang) also fail onmainbuilt the same way. The other descriptor-phi and fold tests pass:agc_constant_phi,agc_masked_select,agc_shader_control_flow,agc_driver_relative_ancillary,agc_shader_bindless,agc_vector_windowand others.agc|shader|recompiler|pm4|draw|position, 583 of 583 pass, two of them skipped as onmain.maincan't read their requests, which come from an older local branch, so they ran on that branch with fix(shader): preserve ancillary proofs across relative VGPR accesses #4150's restriction restored and this change added:Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code