[pr-tests][shaders] Test the isolated LDS add lowering with its switch set for the test #186
Loading…
Reference in a new issue
No description provided.
Delete branch "Remorce/Darner:pr-lds-isolated-add-test"
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?
Why: main's
darner-shadertests fail on every run on a GPU, because this test still expects a lowering that is now off by default. Anyone running the gates in AGENTS.md gets a failure that has nothing to do with their change, and the lowering has no test that actually runs. This change makes the test set the switch itself and check both sides. The suite gets one failure closer to clean, and the lowering stays covered while it's off.Contributor role (optional)
What it changes
emit::wave64_tests::lds_shared_atomic_add_producer_executes_wave32_on_hardwarecame with the isolated LDS add lowering (merge10c532c1) and expects the program to lower toWaveSize(32). Commit68cb7c85then put that lowering behindDARNER_LDS_ISOLATED_ADD=1, off by default. The test never sets the switch, so it now getsWaveSize(64)and fails on every run:The switch is read once per process through a
OnceLock, and a test cannot safely set the process environment while other tests run. Solds_isolated_add()(inemit/lower.rs) now checks a thread-local test setting first.with_test_lds_isolated_add(enabled, f)sets it for the length off. This is the patternlds::with_test_write_only_okalready uses forDARNER_LDS_WRITE_ONLY_OK. Both the setting and the helper are#[cfg(test)].The test now checks both sides of the switch:
WaveSize(64)on a 32-lane host.Outside tests nothing changes: the switch is still read from the environment once, off unless it is exactly
1, and the list of switches in the shader cache key is unchanged. As with any change undercrates/darner-shader/src, the translator source hash changes too, so cached translations are rebuilt once even though none of them comes out different.Threading the setting through
lower::Partsinstead would touch about 60 places that build one, for a switch that only tests need to set. So this follows the existing test-override pattern.How it was tested
bf21435bon57dea7f2. The pull request's commit751d9105has the same tree; only the commit message changed.cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.cargo xtask policy: "asset policy: 553 files ok".cargo test --locked -p darner-shader --lib lds_shared_atomic_add_producer_executes_wave32_on_hardware: 1 passed. On57dea7f2it fails as quoted above.cargo test --workspace --locked --no-fail-fast: 3309 passed, 1 failed, 120 ignored. Thedarner-shaderlib tests: 555 passed, 1 failed, 15 ignored. On57dea7f2they had 554 passed and 2 failed: this test, and the one below.emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders("DXIL validation failed: Not all elements of output SV_Depth were written"), fails the same way on57dea7f2alone, and this change does not touch it.Checklist
main.docs/asset-policy.md.Checked for overlap
emit/lower.rsoremit/wave64_tests.rs, and none of their diffs mentions the test,lds_isolated_addorDARNER_LDS_ISOLATED_ADD.Main already has this fix:
f622896d(pushed today) gives the test a per-threadTEST_LDS_ISOLATED_ADDoverride and turns the switch on for it, solds_shared_atomic_add_producer_executes_wave32_on_hardwarepasses on current main. That's why this branch now conflicts in lower.rs and wave64_tests.rs.What this PR adds beyond that is the check that the program stays
WaveSize(64)with the switch off. If you want that in, rebase on main and keep only that part, using main's existingTEST_LDS_ISOLATED_ADDguard (wave64_tests.rs around line 4260) instead of a second one.Closing: main fixed this test in
f622896d(f622896d1a), so this one is no longer needed.Pull request closed