Skip to content

Prefer paired wave64 for masked first-lane reads - #1

Open
carlosmegino wants to merge 2 commits into
PiloteCode:pr/shadersfrom
carlosmegino:codex/wave64-masked-first-lane
Open

carlosmegino wants to merge 2 commits into
PiloteCode:pr/shadersfrom
carlosmegino:codex/wave64-masked-first-lane

Conversation

@carlosmegino

Copy link
Copy Markdown

Summary

A compute shader using logical wave64 can have an EXEC-masked v_readfirstlane_b32 that elects a lane from the other half. On a wave32 adapter, the ordinary translation can succeed and still elect independently in each half. Try the exact paired form first for non-waterfall masked first-lane reads. Preserve the existing translation fallback when pairing declines the shader.

This PR targets pr/shaders at 51700c6, the head of fxceless#854. Commit 805a455 adapts de64bd5 and adds the readback regression. Commit b252f2d adds the runtime PSO check.

Validation

RTX 5070 Ti, D3D12 wave limits 32/32. On unmodified 51700c6 and 7af465b (fxceless#994), both group sizes returned 0 instead of 40 in UAV 2, lane 0. With the fix, groups of 64 and 128 logical threads match the CPU reference in all seven UAVs at every lane. The two-wave group uses different EXEC masks and loop counts, keeps each wave's LDS separate, reads from opposite halves and reaches a shared group barrier. Canaries remained intact with zero D3D12 GPU validation warnings or errors.

A separate runtime test starts from the device's reported wave capabilities, creates both PSOs and checks the automatically selected group sizes of 32 and 64 physical threads. On fxceless#994, the validation port preserves the branch's separate handling of thread-count-limited dispatch.

For reproduction on a wave32 GPU, install Windows Graphics Tools, provide the DXIL validator and use a writable synthetic fixture directory outside the checkout:

cargo test -p victory-shader --locked --lib wave64_auto_group -- --ignored --nocapture --test-threads=1
$env:VICTORY_TEST_WAVE64_DIR = 'C:/path/to/synthetic-fixtures'
cargo test -p victory-shader --locked --lib wave64_write_runtime_fixtures -- --ignored --test-threads=1
$env:VICTORY_D3D12_DEBUG = '1'
$env:VICTORY_D3D12_GBV = '1'
cargo test -p victory-gpu --locked --features diagnostics --lib wave64_runtime_selects_paired_compute_pipelines -- --ignored --nocapture --test-threads=1

All inputs are synthetic. This PR does not measure gameplay stability or frame rate. Refs Marvisak/VIctory#2688.

Adapt de64bd5 to PR 854 and exercise the public translator with synthetic 64- and 128-thread guest containers. Validate both wave selections, the seven UAVs and their padding on a D3D12 wave32 adapter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant