Shaders: computed_with and read_as_number indexed once per lowering (39f0 translate 25 s to 2.6 s) #1569
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1569"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by 101Leafy on 2026-11-28T21:50:00Z.
What it changes
computed_withandread_as_numberscanned every instruction of the program on each call, andcomputed_withcalls itself again for each move it follows. On a large title shader that was most of the translate time: pixel shader39f0e9aeb156a61c(13,890 blocks, 2,453 descriptor loads) took 25 to 45 s to translate.Both now build an index on first use and keep it for the rest of the lowering, in two
OnceCells onLower:numbers: every value a scalar or vector instruction or a phi reads.readers: for each value, the instructions that read it, in program order.The answers are the same as before. The output DXIL does not change, so
emit::VERSIONstays.How it was tested
39f0e9aeb156a61ctranslates in 25 s.cargo testpassed for the crates it touches:cargo test -p victory-shader --libgives the same results with and without this change (the same 38 tests that need a card fail on both).Checked for overlap
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by notquiteog on 2026-11-28T21:51:38Z.
Great job here!