Commit Graph
1 Commits
Author SHA1 Message Date
Anees Iqbal bc36b3775b Translator: a variable written or read by parts takes no store at a loop trip's top
spirv::carry stores an undefined value into a marked variable at each loop
trip's top. Its domain was held only by what the structurizer marks
(demoted and phi variables, which the emitter loads and stores whole); the
pass itself followed access chains as reads and ignored partial stores, so a
marked variable that a trip wrote by parts and the next trip read would have
lost what the earlier trip wrote. The pass now leaves alone every marked
variable one of whose pointer's uses is not a load or a store through it (an
access chain, a phi, a terminator, any other instruction, a store of the
pointer itself), and reads only loads through the variable's own pointer.

Tests:
- spirv/carry/tests.rs: a three-trip loop whose marked vec2 a trip writes
  through an access chain and the next trip reads takes no store; the same
  loop written whole takes one (the control).
- The loop kernels move to metal2vulkan-devtools (loop_kernels): the vote
  loop a thread leaves early, a loop of three exits, and a nested loop whose
  outer loop has four exits and whose inner loop leaves both, each exit
  reading values defined on its own path, with their answers and trip bounds
  that reach every exit. The product's interpreter tests run them on six
  profiles; validation's new candidate test loop_exits runs them on the test
  device and counts the stores of an undefined value in the SPIR-V the
  dispatch ran (one or more for the exit kernels, none for the predicated
  vote loop).

The structurizer's marked variables are accessed whole, so modules are
expected unchanged; the lane's job compares the module hashes against the
parent.
2026-11-21 16:17:08 -08:00