mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
Configure number of iterations
This commit is contained in:
parent
a0648a2153
commit
7a021793ee
|
@ -43,14 +43,12 @@ pub struct ClearBinding {
|
|||
|
||||
pub unsafe fn run_clear_test(runner: &mut Runner, config: &Config) -> TestResult {
|
||||
let mut result = TestResult::new("clear buffers");
|
||||
// This will be configurable.
|
||||
let n_elements: u64 = config.size.choose(1 << 12, 1 << 20, 1 << 24);
|
||||
let out_buf = runner.buf_down(n_elements * 4);
|
||||
let code = ClearCode::new(runner);
|
||||
let stage = ClearStage::new_with_value(runner, n_elements, 0x42);
|
||||
let binding = stage.bind(runner, &code, &out_buf.dev_buf);
|
||||
// Also will be configurable of course.
|
||||
let n_iter = 1000;
|
||||
let n_iter = config.n_iter;
|
||||
let mut total_elapsed = 0.0;
|
||||
for i in 0..n_iter {
|
||||
let mut commands = runner.commands();
|
||||
|
@ -79,10 +77,7 @@ impl ClearCode {
|
|||
let code = include_shader!(&runner.session, "../shader/gen/Clear");
|
||||
let pipeline = runner
|
||||
.session
|
||||
.create_compute_pipeline(
|
||||
code,
|
||||
&[BindType::BufReadOnly, BindType::Buffer],
|
||||
)
|
||||
.create_compute_pipeline(code, &[BindType::BufReadOnly, BindType::Buffer])
|
||||
.unwrap();
|
||||
ClearCode { pipeline }
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ use clap::ArgMatches;
|
|||
pub struct Config {
|
||||
pub groups: Groups,
|
||||
pub size: Size,
|
||||
pub n_iter: u64,
|
||||
}
|
||||
|
||||
pub struct Groups(String);
|
||||
|
@ -35,7 +36,15 @@ impl Config {
|
|||
pub fn from_matches(matches: &ArgMatches) -> Config {
|
||||
let groups = Groups::from_str(matches.value_of("groups").unwrap_or("all"));
|
||||
let size = Size::from_str(matches.value_of("size").unwrap_or("m"));
|
||||
Config { groups, size }
|
||||
let n_iter = matches
|
||||
.value_of("n_iter")
|
||||
.and_then(|s| s.parse().ok())
|
||||
.unwrap_or(1000);
|
||||
Config {
|
||||
groups,
|
||||
size,
|
||||
n_iter,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ pub unsafe fn run_prefix_test(runner: &mut Runner, config: &Config) -> TestResul
|
|||
let stage = PrefixStage::new(runner, &code, n_elements);
|
||||
let binding = stage.bind(runner, &code, &data_buf, &out_buf.dev_buf);
|
||||
// Also will be configurable of course.
|
||||
let n_iter = 1000;
|
||||
let n_iter = config.n_iter;
|
||||
let mut total_elapsed = 0.0;
|
||||
for i in 0..n_iter {
|
||||
let mut commands = runner.commands();
|
||||
|
|
|
@ -57,7 +57,7 @@ pub unsafe fn run_prefix_test(runner: &mut Runner, config: &Config) -> TestResul
|
|||
let stage = PrefixTreeStage::new(runner, n_elements);
|
||||
let binding = stage.bind(runner, &code, &out_buf.dev_buf);
|
||||
// Also will be configurable of course.
|
||||
let n_iter = 1000;
|
||||
let n_iter = config.n_iter;
|
||||
let mut total_elapsed = 0.0;
|
||||
for i in 0..n_iter {
|
||||
let mut commands = runner.commands();
|
||||
|
|
Loading…
Reference in a new issue