Skip to content

Commit 1549234

Browse files
committed
difftest runner: cleanup wgpu runner, remove variants of runners, use shader passthrough for rust-gpu
1 parent c41db00 commit 1549234

14 files changed

Lines changed: 358 additions & 878 deletions

File tree

tests/difftests/runner/src/runner.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use bytesize::ByteSize;
22
use difftest_types::config::{OutputType, TestMetadata};
33
use serde::{Deserialize, Serialize};
4-
use std::process::Stdio;
54
use std::{
65
collections::{HashMap, HashSet},
76
fs,
@@ -292,8 +291,6 @@ impl Runner {
292291

293292
let output = cmd
294293
.current_dir(&package.absolute_path)
295-
.stdout(Stdio::inherit())
296-
.stderr(Stdio::inherit())
297294
.output()
298295
.map_err(|e| RunnerError::Io { source: e })?;
299296
let exit_code = output.status.code().unwrap_or(-1);

tests/difftests/tests/arch/push_constants/push_constants-rust/src/main.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use difftest::config::Config;
2+
use difftest::scaffold::compute::wgpu::Features;
23
use difftest::scaffold::compute::{
3-
BufferConfig, BufferUsage, RustComputeShader, WgpuComputeTestPushConstants,
4+
BufferConfig, BufferUsage, RustComputeShader, WgpuComputeTestMultiBuffer,
45
};
56

67
#[repr(C)]
@@ -30,7 +31,7 @@ fn main() {
3031
count: num_elements as u32,
3132
};
3233

33-
let test = WgpuComputeTestPushConstants::new(
34+
let test = WgpuComputeTestMultiBuffer::new(
3435
RustComputeShader::default(),
3536
[4, 1, 1], // 256 / 64 = 4 workgroups
3637
vec![
@@ -45,9 +46,9 @@ fn main() {
4546
initial_data: None,
4647
},
4748
],
48-
std::mem::size_of::<PushConstants>() as u32,
49-
bytemuck::bytes_of(&push_constants).to_vec(),
50-
);
49+
)
50+
.with_feature(Features::PUSH_CONSTANTS)
51+
.with_push_constant(&push_constants);
5152

5253
test.run_test(&config).unwrap();
5354
}

tests/difftests/tests/arch/push_constants/push_constants-wgsl/src/main.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use difftest::config::Config;
2+
use difftest::scaffold::compute::wgpu::Features;
23
use difftest::scaffold::compute::{
3-
BufferConfig, BufferUsage, WgpuComputeTestPushConstants, WgslComputeShader,
4+
BufferConfig, BufferUsage, WgpuComputeTestMultiBuffer, WgslComputeShader,
45
};
56

67
#[repr(C)]
@@ -30,7 +31,7 @@ fn main() {
3031
count: num_elements as u32,
3132
};
3233

33-
let test = WgpuComputeTestPushConstants::new(
34+
let test = WgpuComputeTestMultiBuffer::new(
3435
WgslComputeShader::default(),
3536
[4, 1, 1], // 256 / 64 = 4 workgroups
3637
vec![
@@ -45,9 +46,9 @@ fn main() {
4546
initial_data: None,
4647
},
4748
],
48-
std::mem::size_of::<PushConstants>() as u32,
49-
bytemuck::bytes_of(&push_constants).to_vec(),
50-
);
49+
)
50+
.with_feature(Features::PUSH_CONSTANTS)
51+
.with_push_constant(&push_constants);
5152

5253
test.run_test(&config).unwrap();
5354
}

tests/difftests/tests/lang/core/intrinsics/black_box_noop/with-black-box/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
use difftest::config::{Config, TestMetadata};
2-
use difftest::scaffold::compute::{RustComputeShader, WgpuComputeTest};
2+
use difftest::scaffold::compute::{RustComputeShader, WgpuComputeTestMultiBuffer};
33

44
fn main() {
55
let config = Config::from_path(std::env::args().nth(1).unwrap()).unwrap();
6-
let test = WgpuComputeTest::new(RustComputeShader::default(), [1, 1, 1], 12 * 4);
6+
let test = WgpuComputeTestMultiBuffer::new_single_buffer(
7+
RustComputeShader::default(),
8+
[1, 1, 1],
9+
12 * 4,
10+
);
711
test.run_test(&config).unwrap();
812
config
913
.write_metadata(&TestMetadata::u32())

tests/difftests/tests/lang/core/intrinsics/black_box_noop/without-black-box/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
use difftest::config::{Config, TestMetadata};
2-
use difftest::scaffold::compute::{RustComputeShader, WgpuComputeTest};
2+
use difftest::scaffold::compute::{RustComputeShader, WgpuComputeTestMultiBuffer};
33

44
fn main() {
55
let config = Config::from_path(std::env::args().nth(1).unwrap()).unwrap();
6-
let test = WgpuComputeTest::new(RustComputeShader::default(), [1, 1, 1], 12 * 4);
6+
let test = WgpuComputeTestMultiBuffer::new_single_buffer(
7+
RustComputeShader::default(),
8+
[1, 1, 1],
9+
12 * 4,
10+
);
711
test.run_test(&config).unwrap();
812
config
913
.write_metadata(&TestMetadata::u32())

tests/difftests/tests/lib/src/scaffold/compute/ash.rs renamed to tests/difftests/tests/lib/src/scaffold/compute/ash_runner.rs

File renamed without changes.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
mod ash;
1+
mod ash_runner;
22
mod backend;
3-
mod wgpu;
3+
mod wgpu_runner;
44

55
pub use crate::scaffold::shader::*;
6-
pub use ash::AshBackend;
6+
pub use ash;
7+
pub use ash_runner::AshBackend;
78
pub use backend::{BufferConfig, BufferUsage, ComputeBackend, ComputeShaderTest, ComputeTest};
8-
pub use wgpu::{
9-
WgpuBackend, WgpuComputeTest, WgpuComputeTestMultiBuffer, WgpuComputeTestPushConstants,
10-
};
9+
pub use wgpu;
10+
pub use wgpu_runner::WgpuComputeTestMultiBuffer;

0 commit comments

Comments
 (0)