Shaders: computed_with and read_as_number indexed once per lowering (39f0 translate 25 s to 2.6 s) #1569
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1569
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@101Leafy on GitHub · 2026-11-28 21:50 UTC · original
101Leafy:nv/lower-indexed→main· +52 −27 · 10 files · 4 commits · merged 2026-11-29 08:16 UTCWhat 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
@notquiteog on GitHub · 2026-11-28 21:51 UTC · original
Great job here!
12b4080e88to7cc0d15333