Files
metal2vulkan/docs
Anees Iqbal 2fbfafe0fe Translator: a structurizer variable no later trip reads is ended at each loop trip's top (SEMANTICS 2264)
What: spirv::carry::end_dead_carries, run in the stage bound after the uniform-load hoist (and in
pipeline::testing's typed module), stores an undefined value into a demoted value's or a phi's
Function variable at the top of the first block of each loop whose body holds every whole store of
the variable, where the variable is live into that block and the block does not read it before a
store. P8 marks those variables LocalVar::trip_local, only in a walk that is not predicated: the
predicated walk runs a loop's later trips for an invocation that left it, which reads the value of
its own last trip after the loop. The new field rides through roll's renumbering with its variable;
roll's own variables are unmarked. Terminator::for_each_target is the read-only twin of
for_each_target_mut. cache::SEMANTICS_VERSION 2263 to 2264. docs/ARCHITECTURE.md names the pass.

Why: the exit dispatches and pending guards P5 to P7 add give paths from a back edge to a read of
such a variable that pass no store of it. No execution takes them, but the driver keeps the
variable around the back edge as a phi live through the whole loop. In the source the value's
definition dominates each use and the loop's header dominates the definition, so no trip reads the
value an earlier trip left; the store ends it at each trip's top and the driver keeps nothing of it.
Jobs m3-max-65023 (780M and RTX 3090) and m3-max-65024 (Iris Xe) timed the same form, written by a
probe after roll and hoist, cold through the runtime's helper against development, arms alternating
in one job: helper peak and CPU time fell on all three cards.

Tests: tests::engine_trip_carries runs a loop with three exits, the second reading a value its trip
defined, on six profiles: a value is ended at a trip's top, carry::dead_carries finds no variable
left that no later trip reads but the module keeps around a back edge, the module passes spirv-val,
and the interpreter gives the source's words. tests::engine_divergent_barriers adds a vote loop
whose early leavers read their last trip's value after it (loop_leaver_k), run predicated on six
profiles under Vulkan's barrier rule. The compile job, the two tests' red runs without the form and
without the predicated rule, and the states-only plays run on this commit.
2026-11-21 15:42:11 -08:00
..