Repository navigation
Conversation
Reuse scalar lowering’s address and width rules to admit in-bounds private code data to lane uniformity. Require common control flow and retain existing EXEC checks and fallback. Related proof work: pragyaangaur#671 (0b101010-lab).
GDemay
marked this pull request as ready for review
November 28, 2026 17:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
For #553, treat scalar results as wave-uniform when an unguarded load in wave-uniform control flow reads a fixed, aligned range entirely inside the shader's private code data. The proof shares the scalar load width decoder with lowering. Existing scalar and vector rules propagate the fact and checks for inactive destinations and other halves requirements still apply.
Performance
Apple M5 (Mac17,2, 24 GiB), macOS 27.0 (26A428), CrossOver Wine 11.0,
D3DMetal 4.0 beta 3, Rust 1.98.1, x86_64-pc-windows-gnullvm release. Pinned
main
27380446e227799438b2c41693426ebb5c5e4420versus2db44ab1a64e447e054731dcaf5aaef4716373b1. Both builds run the same fouroriginal shaders at 8,192 groups × 128 lanes. Four batches per arm, ABBA/BAAB,
three warm-up and 15 measured dispatches per workload per process, with no
concurrent builds. Timer starts before command-list submission through a
fence event. It includes list uploads and copies and excludes translation,
pipeline creation, command recording and readback mapping. No GPU timestamps.
The single-read fixture was faster in all four paired batch medians. Its
middle 50% went from 1.986–2.270 to 1.745–2.105 ms. Eight reads had a slow
candidate batch which also affected the unchanged varying-source control.
The timing effect of the eight-read workload remains inconclusive. The four
process-level translation setup medians were 2,146 → 2,102 μs for the first
fixture and 479 → 372 μs for the eight-read fixture. These small samples
are descriptive. Driver register pressure and game frame time were unmeasured.
All 576 dispatches, including the 96 within-process warm-ups, matched
603,979,776 independently calculated output dwords. The checks expect 17 in
the simple and scalar control fixtures, lane + 576 in the eight-read fixture,
and the console-wave first lane's ID (0 or 64) in the varying-source fixture.
Verification
Final head passed native workspace (859 passed, 23 ignored), full serial Wine
workspace (1,782 passed, 58 ignored), Windows-gnullvm Clippy with default and
all features, and the asset policy (365 files).
The strict Wine/D3DMetal test exercised 36 additional dispatches at 64, 96
and 128 threads, with lower-only, upper-only, both-half and empty EXEC. It
checked 27,648 output dwords including the raw first-lane value, branch
result, guarded store and restored-mask stores. The structural test and
emitted pipeline metadata check that short-table, mutable, and stale-lane
cases retain the fallback. The native test rejects proof when only the
second word of a two-dword load falls outside the code table.
For matched timing, copy the PR's test-only files into a worktree at the
pinned baseline (everything in this PR except emit/lower.rs,
emit/lower/halves.rs and emit/lower/tests.rs). Build and save both test binary
paths before sampling, with separate targets:
cargo test -p victory-shader --lib --release \ --target x86_64-pc-windows-gnullvm --no-run --message-format=jsonWith the checkout's Wine and
WINEDLLOVERRIDES=d3d12,d3d12core,dxgi=b, runeach binary once to warm the runtime. Then run each serially in ABBA/BAAB order
with
emit::first_lane_bench::embedded_code_first_lane_gpu_completion --exact --ignored --nocapture --test-threads=1. Record the sample lines (nanoseconds)and mode setup lines. Unset
VICTORY_WARP.Scope
The public culling analysis traces eight first-lane inputs per shader to
LDS reads feeding scalar branches. The CODE proof could help a code-derived
address or scalar operand where the existing LDS stability checks already
hold. Coverage of
87bf9e3f2bf2f052,9f017d9011377efa,0452fc2d2e2fc4c3and the wider set of 29 programs isunverified. Related prior proof work is in #671 by 0b101010-lab. No title
shaders or game assets were used.
A game owner can run
victory translate --wave32 --list --jobs 1on thesame private inputs at both commits with the three hashes in
VICTORY_TRANSLATE_ONLY. Keep the emitted DXIL local, count emitteddx.op.barriercalls, and report hash, before/after mode, proof site andload width, and any translation failure in text. A fixed-scene follow-up
can use a prewarmed cache per binary, the same save, settings and still
input replay, alternating AB and BA with 120 warm-up and 300 measured
frames. Compare frame median and tail, useful draw and dispatch counts
(
VICTORY_DISPATCH_CENSUS=1), and visual correctness locally.