pub unsafe fn benchmark_kernel(
kernel: &dyn Program,
buffers: &[*mut u8],
vals: &[i64],
global_size: Option<[usize; 3]>,
local_size: Option<[usize; 3]>,
config: &BenchmarkConfig,
) -> Result<BenchmarkResult>Expand description
Benchmark a compiled kernel’s execution time.
Runs warmup iterations (discarded), then timing iterations. Returns min/mean/all timings.
§Safety
All buffer pointers must be valid for the duration of benchmarking. The kernel will be executed multiple times.
§Example
ⓘ
let config = BenchmarkConfig::default();
let result = unsafe { benchmark_kernel(&kernel, &buffers, &vals, None, None, &config)? };
println!("Min time: {:?}", result.min);