bench: allow more worker threads than cards to measure submission overlap
ci / fmt (pull_request) Successful in 21s
bench / build (pull_request) Successful in 56s
bench / measure (pull_request) Failing after 8s
ci / clippy (pull_request) Successful in 1m49s
ci / doc (pull_request) Successful in 1m59s
ci / test (pull_request) Successful in 7m0s

Two threads on one card overlap one thread's readback with the other's
dispatch, which is the bubble quantus/miner#4 and #5 target. Measuring it in
the harness first means #4 lands with a number instead of a hypothesis.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CBgs2nSi4H2mdh8kD8vMX5
This commit is contained in:
2026-09-03 13:03:21 +03:00
co-authored by Claude Fable 5.1
parent bad02fbc33
commit 5f3c51c5cb
+8 -6
View File
@@ -40,9 +40,11 @@ struct Args {
#[arg(long, default_value_t = 1_000_000)]
batch_size: u32,
/// Worker threads; each is assigned its own device by the engine, so on a
/// multi-card host N threads measure N cards. Extra threads beyond the
/// card count are refused.
/// Worker threads. The engine assigns threads to devices round-robin, so
/// on a multi-card host N threads measure N cards. More threads than cards
/// is allowed on purpose: two threads on one card overlap one thread's
/// readback with the other's dispatch, which is the submission bubble
/// quantus/miner#4 and #5 are about, measured without touching the miner.
#[arg(long, default_value_t = 1)]
workers: usize,
@@ -307,11 +309,11 @@ fn main() {
Arc::new(GpuEngine::try_new(args.batch_size, 0, false).expect("GPU engine init failed"));
let devices = engine.device_count();
if args.workers > devices {
eprintln!(
"--workers {} exceeds the {devices} GPU device(s) present",
log::warn!(
"{} workers on {devices} device(s): threads share cards, so per-worker numbers \
are shares and total_median_mhs is the number to compare",
args.workers
);
std::process::exit(2);
}
log::info!(
"engine {} with {devices} device(s); measuring {} worker(s), {} x {}s windows after {}s warm-up, batch {}",