Evaluate shader lane-mask selects iteratively #1103
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!1103
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1103"
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?
@ghptc on GitHub · 2026-11-28 13:17 UTC · original
ghptc:fix/iterative-lane-mask-select→main· +61 −14 · 1 files · 1 commits · merged 2026-11-29 00:24 UTCThe shader structurer builds ordered decision diagrams for lane masks. An unresolved Boolean select recursively evaluated its low and high cofactors. Even a narrow diagram with one node per variable consumed a native call frame per level. The node budget bounds diagram size, but a valid diagram can be deep.
This patch evaluates the same cofactors with an explicit work list. Each entry records the unresolved high branch and the low result. Low precedes high, and node interning and memoization still occur after both results are known. The new semantic regression selects between two independent outputs using a six-variable parity mask and checks all 256 assignments and a repeated select.
Reproduction and measurements
On Windows, or using a Windows-target test executable under Proton, run the shader structuring suite:
For the stack measurement, use a 2 MiB test thread and create 16, 64, or 256 ordered lane atoms. Starting with true, walk the variables in reverse order and build each node with false as its low child and the preceding result as its high child. Negate the resulting conjunction and verify that negating the result returns the original canonical node. Sample the address of a black-boxed local in a non-inlined observer on entry to the original select, or at each descent in the iterative select. Reset the min, max, and visit count before the first negation.
The span measures variation across visits at that sampling site. The routine still uses a fixed call frame and allocates space for its explicit work list. A separate stack sample on the existing divergent-if fixture reached this function from the normal shader structurer. No stack overflow occurred in these bounded tests.
A separate uninstrumented timing test applied the structurer 4,096 times per batch to the same small divergent-if program. After warm-up, ten release samples per revision in A/B/B/A process order gave medians of 10.357 ms before and 10.886 ms after (about 5.1% slower on that fixture). This patch trades some shallow-case CPU time for bounded native stack use in this operation. Windows x64 MSVC-target release tests ran on Proton. Native Windows and representative shader-corpus performance remain unmeasured.
@ghptc on GitHub · 2026-11-28 13:23 UTC · original
Windows Clippy reported the same two diagnostics on this PR and its exact upstream base,
63b902f:let_and_returnin shader emission andmanual_is_multiple_ofin the shadow worker. With #957 applied locally to1a35cb3, both locked workspace Clippy checks passed for Windows MSVC on Rust 1.98.1, including--all-features, with-D warnings. Upstream CI log1a35cb316ato92906a74d3