Evaluate shader lane-mask selects iteratively #1103
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ghptc on 2026-11-28T13:17:12Z.
The 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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ghptc on 2026-11-28T13:23:02Z.
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 log