Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
68 changes: 68 additions & 0 deletions crates/xcl/benches/gpu_cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,53 @@ fn branch_program(blocks: usize) -> Vec<u8> {
code
}

fn graphics_program(instructions: usize, spills: bool) -> Vec<u8> {
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);
Expand Down Expand Up @@ -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();
}

Expand Down
3 changes: 3 additions & 0 deletions scripts/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 <test>: <reason>"
# to stderr (XCL_REQUIRE_GPU=wave64 / =mesh makes them fail); counted at the end
$skipped = @()
Expand Down
Loading