From a4dbe5c5ddf391253cfb0afdf76c0b5f98813d32 Mon Sep 17 00:00:00 2001 From: bmjask <> Date: Thu, 26 Nov 2026 08:40:31 -0800 Subject: [PATCH] Tests: smoke and time wave64 graphics translation The required suite did not compile or execute custom benchmark targets, and translation timings did not cover the wave64 graphics analyses. Smoke every custom benchmark closure once and add equal-sized plain, native-spill, and split-spill translation workloads. The bench-only Cargo selector excludes library and binary test harnesses, avoiding duplicate optimized-profile unit and GPU tests. Assisted-by: Codex (GPT-5.6-sol) --- README.md | 2 +- crates/xcl/benches/gpu_cpu.rs | 68 +++++++++++++++++++++++++++++++++++ scripts/test.ps1 | 3 ++ 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 386812c599..57c63c6cc3 100644 --- a/README.md +++ b/README.md @@ -468,7 +468,7 @@ labelled as missing; it does not infer significance or percentages. ## Tests ```powershell -.\scripts\test.ps1 # cargo build --workspace + cargo test --workspace +.\scripts\test.ps1 # build + benchmark smoke + all workspace tests .\scripts\perf-run.tests.ps1 # cold/warm runner fixture (no game is run) .\scripts\perf-compare.tests.ps1 # comparison fixture (synthetic artifacts) cargo bench -p xcl # synthetic performance benchmarks diff --git a/crates/xcl/benches/gpu_cpu.rs b/crates/xcl/benches/gpu_cpu.rs index 7bdf2079df..e249d9d434 100644 --- a/crates/xcl/benches/gpu_cpu.rs +++ b/crates/xcl/benches/gpu_cpu.rs @@ -47,6 +47,53 @@ fn branch_program(blocks: usize) -> Vec { code } +fn graphics_program(instructions: usize, spills: bool) -> Vec { + let mut code = Vec::new(); + let mut count = 0usize; + if spills { + for lane in 0..48u64 { + code.extend(instruction( + "V_WRITELANE_B32", + "ENC_VOP3", + &[("VDST", 30), ("SRC0", 32 + lane), ("SRC1", 128 + lane)], + )); + count += 1; + } + for lane in 0..48u64 { + code.extend(instruction( + "V_READLANE_B32", + "ENC_VOP3", + &[("VDST", lane), ("SRC0", VGPR0 + 30), ("SRC1", 128 + lane)], + )); + count += 1; + } + } + let add = instruction( + "V_ADD_NC_U32", + "ENC_VOP2", + &[("VDST", 1), ("SRC0", VGPR0 + 2), ("VSRC1", 3)], + ); + for _ in count..instructions { + code.extend(&add); + } + code.extend(instruction("S_ENDPGM", "ENC_SOPP", &[])); + code +} + +fn graphics_options(split_wave64: bool) -> recomp::Options { + recomp::Options { + mode: recomp::Mode::Pixel(recomp::PsInterface { + inputs: Vec::new(), + outputs: Vec::new(), + input_ena: 0, + attrs: None, + }), + wave64: true, + split_wave64, + ..Default::default() + } +} + fn rdna2_frontend(c: &mut Criterion) { let code = arithmetic_program(1024); let mesh_control_flow = branch_program(256); @@ -117,6 +164,27 @@ fn translate(c: &mut Criterion) { }, ); } + let plain = graphics_program(256, false); + let spills = graphics_program(256, true); + let native = graphics_options(false); + let split = graphics_options(true); + for (name, code, options) in [ + ("plain", &plain, &native), + ("spills_native", &spills, &native), + ("spills_split", &spills, &split), + ] { + group.throughput(Throughput::Elements(257)); + group.bench_with_input( + BenchmarkId::new("wave64_graphics", name), + &(code, options), + |b, (code, options)| { + b.iter(|| { + let translated = recomp::translate(black_box(code), black_box(options)).unwrap(); + black_box((translated.hlsl.len(), translated.instructions, translated.blocks)) + }) + }, + ); + } group.finish(); } diff --git a/scripts/test.ps1 b/scripts/test.ps1 index 8bf6dca1e7..3a00be2445 100644 --- a/scripts/test.ps1 +++ b/scripts/test.ps1 @@ -10,6 +10,9 @@ $null = Get-Command cargo -ErrorAction Stop $ErrorActionPreference = 'Continue' cargo build --workspace if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } +# Compile every custom benchmark target and execute each closure once without timing samples. +cargo bench -p xcl --bench '*' -- --test +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # GPU tests that cannot run on this adapter pass too: each prints "SKIPPED : " # to stderr (XCL_REQUIRE_GPU=wave64 / =mesh makes them fail); counted at the end $skipped = @()