Tests: cover Direct DXIL Module::optimize passes and GPU execution #1832
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1842"
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 ivall/xcl. Originally posted by microwave805 on 2026-11-24T21:42:47Z.
Add standalone integration and GPU tests for the Direct DXIL module optimizer (
crates/xcl/src/gpu/dxil/module/opt.rs), which currently has no dedicated unit or integration tests.What is in it
crates/xcl/tests/gpu_dxil_opt.rs:opt_constant_folding_and_identities_validate_and_run: verifies 32-bit constant folding (AShr,UDiv,URem,SExt,SLt,Add,Xor,Select) and algebraic identities (+0,&~0,*1,*0,x^x,select(c, x, x),bitcast(bitcast(x)),cmp(x, x)), checking DXIL disassembly and wave32 GPU execution against CPU values.opt_cse_merges_dominators_isolates_siblings_and_keeps_wave_is_first_lane: verifies dominator-tree CSE across child blocks, sibling-branch undo-stack isolation, same-blockwaveActiveBallotCSE without hoisting across a divergent branch (verified on GPU viawaveActiveBallot(true)returningodd_maskinstead of0xFFFF_FFFF), andwaveIsFirstLaneremaining unmerged.opt_prunes_unreachable_blocks_and_collapses_trivial_phis: verifies unreachable-block pruning and second-pass trivial-phi collapse after CSE unifies diamond arms, plus GPU execution.opt_dce_drops_dead_32bit_ops_but_preserves_64bit_flags: verifies DCE removes dead 32-bit ops while retaining deadi64/f64ops soInt64Ops/Doublesshader flags stay consistent under DXC validation.opt_leaves_malformed_use_before_def_for_writer_to_reject: verifiesuses_well_formedleaves malformed forward-reference IR untouched sotry_to_bitcodestill reports an error.Tested
stable-x86_64-pc-windows-msvc, debug)7753368(based onmainc4d37be):cargo test -p xcl --test gpu_dxil_opt -- --nocapture: 5 passed, 0 failed, 0 ignored (0 skipped).\scripts\test.ps1(cargo build --workspace && cargo test --workspace -- --test-threads=4): 964 passed, 0 failed, 43 ignoredgpu_dxil_opt): 18×no wave64(lower::tests,lower_dxil::tests,recomp::tests), 3×per-lane form: refused(lower_dxil::tests:f16 arithmetic,f16 packed,f32 conversions), 1×no heap windows(heap_window_out_of_memory_falls_back_to_the_switch_form), 1×cannot disable the driver cache(shaders::tests::pso_measurement_compiles_an_exact_synthetic_record)Regression run
crates/xcl/tests/gpu_dxil_opt.rs(no runtime or build-input files changed).Not tested
AI use
crates/xcl/src/gpu/dxil/module/opt.rs, wrotecrates/xcl/tests/gpu_dxil_opt.rsand this PR description, and ran the verification commands above.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-24T22:40:44Z.
AMD run with native 64-lane waves, which this PR lists as not tested, plus an NVIDIA one.
Tested: pass, head
7753368applied onmain689f2db, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.cargo test -p xcl --test gpu_dxil_opt -- --test-threads=4withXCL_ADAPTERset to each GPU:cargo test -p xcl --lib -- gpu::recomp --test-threads=4with this PR applied: 261 passed, 0 failed, 18 ignored on both; the SKIPPED lines are the same as onmain.Not tested: Intel; Linux / Wine; the whole workspace suite.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T22:40:45Z.
Full-suite run, since this PR has no test report yet. Tested exact head
7753368(on its basec4d37be).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: 959 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.opt_constant_folding_and_identities_validate_and_run,opt_cse_merges_dominators_isolates_siblings_and_keeps_wave_is_first_lane,opt_prunes_unreachable_blocks_and_collapses_trivial_phis,opt_dce_drops_dead_32bit_ops_but_preserves_64bit_flags,opt_leaves_malformed_use_before_def_for_writer_to_reject.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 964 passed, 0 failed, 43 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out five tests where this PR's base has them. They fail on main689f2dbtoo, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns their skips into failures. These areheap_window_out_of_memory_falls_back_to_the_switch_form(#1651) and the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests (follow-up on #1651). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T01:15:28Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T03:22:10Z.
Tested
PR #1842 was open at
775336821f5c95ecb329a4c06a8a5e14670cdac9before and after testing. The assigned checkout was clean and detached at that SHA for the run. The PR description and three discussion comments showed no equivalent Arc A770 result.STOR-WINLAB ran Windows 11 Enterprise Evaluation 25H2 (26200.9974), AMD Ryzen 7 3800X, and Intel Arc A770 (driver 32.0.101.9175). Rust and Cargo were 1.100.0, host
x86_64-pc-windows-msvc. Each fixture reported DXC and DXIL 1.9.2609.5.cargo test -p xcl --locked --test gpu_dxil_opt --no-runbuilt successfully outside the GPU mutex. The unoptimized build usedCARGO_BUILD_JOBS=2,CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0, andCARGO_PROFILE_TEST_DEBUG=0.CARGO_TARGET_DIR=L:/XclTooling/pr1947-1831ec4-t3-97236edf/target,TEMP=TMP=L:/XclTooling/pr1842/tmp,XCL_ADAPTER=A770, andXCL_DXC_DIR=$env:LOCALAPPDATA/XclTooling/dxc-1.9.2609/bin/x64.All three exact invocations exited 0. The checked-in DXIL validation and GPU result assertions passed with 3 passed, 0 failed, 0 ignored, 0 hardware skips, and 0 validator skips. The GPU mutex was released and the assigned Cargo target is available.
Not tested
Other fixtures, the workspace suite, retail titles, and other adapters or drivers.
AI use
T3 Code / Codex
gpt-6.2-solran the commands, checked the logs, and prepared this report.upstream-sync referenced this pull request2026-11-25 18:03:20 +00:00
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:02:18Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T13:11:38Z.
merge-check claim
head:
775336821fImported from ivall/xcl. Originally posted by BBareth on 2026-11-30T13:22:09Z.
merge-check
base:
9dfbe3ea66head:
775336821fmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2890 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base. The five new tests in
crates/xcl/tests/gpu_dxil_opt.rspassed and ran on the GPU here (no new SKIPPED line):opt_constant_folding_and_identities_validate_and_run,opt_cse_merges_dominators_isolates_siblings_and_keeps_wave_is_first_lane,opt_prunes_unreachable_blocks_and_collapses_trivial_phis,opt_dce_drops_dead_32bit_ops_but_preserves_64bit_flags,opt_leaves_malformed_use_before_def_for_writer_to_reject.review: no blocking finding; one new test file, every line read, no change outside tests. The tests build small compute kernels through the public
Shader/ModuleAPI, check the optimized DXIL with the DXC validator and its disassembly, and compare GPU results with values computed on the CPU; they skip throughrunner::skip_testwithout DXC or wave32. Two nits, neither blocking: (1) in the last test the assertionerr.contains("before") || err.contains("dominat") || !err.is_empty()is always true afterexpect_errunless the message is empty, so it only pins that emission fails; (2) several checks match disassembly text (", 13 ","mul i32 ","-4"), which ties them to the DXC disassembler's formatting.performance: none at run time; the suite gains five tests (four with a DXC validation, three of them with a GPU run).
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T14:33:06Z.
merge-check claim
head:
775336821fImported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T14:38:53Z.
merge-check
base:
9dfbe3ea66head:
775336821fmerge: clean (trial merge fba15a10037e364b4a0b746400730c984ae16408; git diff --check clean; +350/-0 in crates/xcl/tests/gpu_dxil_opt.rs)
build: cargo build --workspace -> ok (39 pre-existing warnings, none from the PR's files)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2890 passed, 1 failed, 51 ignored (lib 2737/1/31, integration 153/0/20); SKIPPED: 27 (22 "no wave64" — wave32-only GPU, 2 "no heap windows", 1 "cannot disable the driver cache (Developer Mode)", 2 "no xgameruntime.dll"); failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, pre-existing on this machine (fails identically on base
9dfbe3ea, same "2D D16 resinfo clobbered v2/v3" assertion); all five new gpu_dxil_opt tests ran on this GPU (four with wave32 execution, one pure IR) and passreview: test-only, one new integration test file, read in full; no unsafe, no new dependencies, existing public API only (build-confirmed). Minor nits, nothing blocking: opt_leaves_malformed_use_before_def_for_writer_to_reject's final assertion (err.contains("before") || err.contains("dominat") || !err.is_empty()) is nearly tautological via the third disjunct — any non-empty error passes; opt_constant_folding pins the folded constant via dis.contains("-4"), which is disassembly-format-dependent but fine as a pin.
performance: none; tests only.
verdict: safe to merge
hardware / tool and model: RTX 4070 SUPER (driver 32.0.16.2140), Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0, DXC 1.8.2502.11 (23992152) / OpenCode, Qwen 3.8 27B
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:57:44Z.
Triage (#1607) – head
7753368No open or merged PR adds integration tests of
Module::optimize(crates/xcl/tests/gpu_dxil_opt.rsis new). #3269 and #3268, merged since, changed the optimizer, so the disassembly assertions need a rerun on current main.In
opt_leaves_malformed_use_before_def_for_writer_to_reject, the assertionerr.contains("before") || err.contains("dominat") || !err.is_empty()is always true onceexpect_errpasses, so it checks nothing about the error.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.