Runtime tests: the mesh cost rows time a one-group draw of an object state too

On the RX 7900 XTX (RADV, Mesa 26.2.6, job 86024) a one-group mesh draw
through the launcher took 63,560 ns against a one-triangle vertex draw's
7,920 ns, 8.0 times; on the RTX 3090 it took 0.84 times. The row cannot
tell whether that cost is the launcher's shape or any task stage on that
driver. mesh_costs_print_per_card now also times a one-group draw of a
state with an object function (mesh_draws_object, 1 object thread), whose
task stage is the guest's function, not the launcher: printed as
"object 1 group N ns" beside the launcher's row. Nothing asserts on time.

Verified: see the job named in the handover.
This commit is contained in:
Anees Iqbal committed 2026-12-03 17:05:48 -08:00
1 parent 6b0f0ab72d
commit df4d351048
1 file changed
+19 -2
@@ -664,7 +664,9 @@ mod on_device {
/// time: a state without an object function draws through its launcher's one task workgroup,
/// and each stage's workgroup is the state's maximum `M`, the draw's threadgroup within it.
/// Rows: a 1-group mesh-only draw against a 1-triangle vertex draw on the same kind of pass
/// (the launcher's fixed cost), 65,535 groups of 4 threads at the state's `M` and at `M` 4
/// (the launcher's fixed cost), a 1-group draw of a state with an object function, whose task
/// stage is the function's (the cost of any task stage beside the launcher's own), 65,535
/// groups of 4 threads at the state's `M` and at `M` 4
/// (the idle invocations' cost), and the time per group between 1 and 65,535 groups. Run
/// under `METAL2VULKAN_TEST_UNVALIDATED=1`, once per card: `--run-ignored only`.
#[cfg(m2v_gpu)]
@@ -694,6 +696,16 @@ mod on_device {
println!("mesh_costs: {name}: no mesh set; nothing timed");
return;
};
// A state with an object function, whose task stage is the function's, not the
// launcher's.
let mut d = MeshPipelineDescriptor::new(function(&draws, "mesh_draws_mesh"));
d.object = Some(function(&draws, "mesh_draws_object"));
d.fragment = Some(function(&draws, "mesh_draws_fragment"));
d.max_total_threads_per_object_threadgroup = Some(1);
for color in d.color_attachments.iter_mut().take(2) {
*color = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint));
}
let object_state = made(name, &device, &d, listed).expect("an object state");
let colors = [0, 1].map(|_| {
target(
&device,
@@ -730,13 +742,18 @@ mod on_device {
encoder.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0)
});
let one = median_gpu_nanos(name, &queue, &mesh_pass, mesh(&at_m, 1));
let object_one = median_gpu_nanos(name, &queue, &mesh_pass, |encoder| {
encoder.set_render_pipeline_state(&object_state)?;
encoder.set_object_bytes(&[0; 16], 0)?;
encoder.draw_mesh_threadgroups([1; 3], [1; 3], [1; 3])
});
let many = median_gpu_nanos(name, &queue, &mesh_pass, mesh(&at_m, 65_535));
let many_at_4 = median_gpu_nanos(name, &queue, &mesh_pass, mesh(&at_4, 65_535));
let m = at_m.max_total_threads_per_mesh_threadgroup();
let per_group = many.saturating_sub(one) as f64 / 65_534.0;
println!(
"mesh_costs: {name}: vertex 1 triangle {triangle} ns; mesh-only 1 group {one} ns; \
65535 groups of 4 threads at M {m}: {many} ns, at M {}: {many_at_4} ns \
object 1 group {object_one} ns; 65535 groups of 4 threads at M {m}: {many} ns, at M {}: {many_at_4} ns \
(x{:.2}); {per_group:.2} ns a group at M {m}",
at_4.max_total_threads_per_mesh_threadgroup(),
many as f64 / many_at_4.max(1) as f64,