replay: a compute encoder's setStageInRegion: plays on the new runtime

The runtime's compute encoder takes setStageInRegion: (59bb3634d1): it changes nothing a dispatch
of a kernel without a stage-in argument does, the only kernel it builds. glbench-780m-r1's all8
play (m3-max-49209) stopped at frame 438, call 593644, on the player's refusal of the selector;
the census found 158,349 such calls there and 300,832 in glbench-3090-r2, every one on a kernel
with no stage-in argument. The new runtime's backend now plays it through
ComputeCommandEncoder::set_stage_in_region; the old runtime still refuses it.

Test a_stage_in_region_plays_on_a_compute_encoder: an encoder's region plays, nothing skipped.
This commit is contained in:
Anees Iqbal committed 2026-11-18 18:52:40 -08:00
1 parent 39e9e52726
commit 8cb034077c
3 files changed
+35 -1

No files matched your search

@@ -370,6 +370,11 @@ impl NewRuntime {
Ok(())
}
},
"setStageInRegion:" => {
let region = region(call, arg(call, 0)?)?;
self.compute(id).encoder.set_stage_in_region(region);
Ok(())
}
_ => return Err(refuse(call, "not played on a compute encoder")),
};
result.map_err(failed(call))
@@ -9,6 +9,7 @@
//! report says the play is no verdict past it: its gap, frame and call.
//! - A compute pipeline state the runtime answers with a typed gap is skipped and counted by the
//! gap, and a dispatch of it is skipped, and the play goes on.
//! - A compute encoder's `setStageInRegion:` plays: the runtime takes it.
//! - The host's library from source is made of its display library where the backend has it, a
//! function of it with it; without it both are skipped.
//! - A Managed buffer of a stream recorded with two copies keeps both on any device (the player's
@@ -446,6 +447,32 @@ fn a_compute_state_the_runtime_does_not_build_is_counted_and_its_dispatch_skippe
assert!(lines.iter().any(|l| l.starts_with(line)), "{lines:?}");
}
#[test]
fn a_stage_in_region_plays_on_a_compute_encoder() {
let dir = ScratchDir::new("rt-replay-stage-in").unwrap();
let path = written(&dir, |w| {
w.call("MTLCreateSystemDefaultDevice", 0, 1, &[], &[])?;
w.call("newCommandQueue", 1, 2, &[], &[])?;
w.call("commandBuffer", 2, 3, &[], &[])?;
w.call("computeCommandEncoder", 3, 4, &[], &[])?;
let region = Value::Map(vec![
("origin".into(), uints(&[("x", 0), ("y", 0), ("z", 0)])),
(
"size".into(),
uints(&[("width", 64), ("height", 1), ("depth", 1)]),
),
]);
w.call("setStageInRegion:", 4, 0, &[region], &[])?;
w.call("endEncoding", 4, 0, &[], &[])?;
w.call("commit", 3, 0, &[], &[])?;
w.call(WAIT_COMPLETED, 3, 0, &[], &[])
});
let (report, _) = play("stage-in", &path);
let executed = &report.total.executed;
assert_eq!(executed["skipped_calls"], 0, "{executed:?}");
assert_eq!(report.first_skip, None);
}
#[test]
fn a_two_copy_stream_s_managed_buffer_keeps_both_copies() {
let dir = ScratchDir::new("rt-replay-two-copies").unwrap();
+3 -1
View File
@@ -669,7 +669,9 @@ counted from 0), completes the work committed so far, reports as at the stream's
buffers, offsets, bytes, textures and sampler states, the viewport, scissor, cull mode, winding,
blend color and stencil references, the draws (indexed or not, with instance counts, base
vertex and base instance), fences and memory barriers (their stages are the runtime's to
order).
order). Compute encoders on the new runtime play `setStageInRegion:` (the runtime takes it and
it changes nothing a dispatch of a kernel without a stage-in argument does, the only kernel it
builds); the old runtime refuses it.
`report.txt` holds one line per item: the line `recorded before the recorder's completion fix: the
stream may differ from what the program did` first where the stream's header lacks bit 1 (section