rt: the count kernel's shape call takes the state's compiled content; the refusal beside Accumulate; as_chunks in the new word readers

What: RenderCommandEncoder::execution_part passes the compiled content by reference
(&**compiled), as Indirect::shape takes it; the tuple built before the call took no coercion. The
runtime README's known gaps of render encoders name the execution over a held range refused while
a visibility query counts (VisibilityResultInterrupt) beside Accumulate's refusal: both need a
count carried across two queries with the parts added; the visibility section lists it among the
commands that end the rendering. The count kernel's interpreter test and the runtime's visibility
cell read their words with as_chunks, which the dated nightly's clippy asks for.

Why: job m3-max-63533 on d245bab9d1 failed clippy plain and --cfg m2v_gpu with E0308 at
render_encoder.rs:2801 (expected &RenderCompiled, found &Arc<RenderCompiled>).

Verified: by this commit's compile job (named in the lane's report).
This commit is contained in:
Anees Iqbal committed 2026-11-21 06:53:05 -08:00
1 parent d245bab9d1
commit 5a04298008
4 files changed
+18 -8

No files matched your search

+9 -2
View File
@@ -3447,7 +3447,12 @@ cache is answered compile-required on both.
pass whose `visibility_result_type` is `Accumulate` (`AccumulatedVisibilityResults`,
`set_visibility_result_mode`; counted in `Metrics::accumulated_visibility_refused`), each
refused where it is set, the encoder's state unchanged; the replay streams set Metal's defaults
alone, which those setters take as nothing; a draw of lines or a line strip while the encoder's line width
alone, which those setters take as nothing; beside `Accumulate`, while a `Boolean` or `Counting`
mode's query counts the draws, an execution of an indirect command buffer over a range a buffer
holds (`VisibilityResultInterrupt`, `execute_commands_in_buffer_with_range`; counted in
`Metrics::visibility_interrupts_refused`), refused where it is called: its count kernel ends the
rendering, and both need a count carried across two queries with the parts added, which is not
built; a draw of lines or a line strip while the encoder's line width
(`set_line_width`, which keeps every width) is not 1 (`LineWidth`): Metal draws such a line as
a parallelogram that width wide, and Vulkan's wider lines are a device feature (`wideLines`)
the floor does not require; a
@@ -3545,7 +3550,9 @@ cache is answered compile-required on both.
- While a `Boolean` or `Counting` mode's query counts the draws (from the mode's first draw to the
next mode set or the encoder's end), a command that would end the pass's rendering is refused,
`Gap::Draw` of `VisibilityResultInterrupt`, the encoder as it was, and counted in
`Metrics::visibility_interrupts_refused`: a memory barrier after a draw that wrote memory; a
`Metrics::visibility_interrupts_refused`: a memory barrier after a draw that wrote memory; an
execution of an indirect command buffer over a range a buffer holds, whose count kernel runs
outside the rendering; a
draw that moves an attachment to the feedback layout, pays the barrier owed before an
attachment read, or copies into an attachment's shadow what it reads; and, whether or not a
copy is owed, a draw that looks at textures over a buffer in images of their own (one bound or
@@ -2797,7 +2797,7 @@ impl RenderCommandEncoder {
};
let (topology, _) = primitives(PrimitiveType::Triangle);
let pipeline = compiled.pipeline(topology, self.raster)?;
let made = (compiled, self.raster, pipeline);
let made = (&**compiled, self.raster, pipeline);
let shape = indirect.shape(&self.core, made, buffer.layout(), buffer.size())?;
Ok(shape.part)
}
@@ -677,8 +677,8 @@ mod on_device {
// SAFETY: the buffer holds 16 bytes, which the finished command buffer wrote and whose
// writes reach the host.
let bytes = unsafe { std::slice::from_raw_parts(contents.as_ptr(), 16) };
let counts: Vec<u64> = (bytes.chunks(8))
.map(|word| u64::from_le_bytes(word.try_into().expect("a word")))
let counts: Vec<u64> = (bytes.as_chunks::<8>().0.iter())
.map(|word| u64::from_le_bytes(*word))
.collect();
// Each command draws a band of 16 pixels: the execution's four, the two direct draws'.
assert_eq!(counts, [64, 32], "{name}: each mode's samples");
+6 -3
View File
@@ -225,9 +225,12 @@ mod tests {
..Config::default()
};
let out = run(&module, &config, resources).expect("the run");
(out.buffers[0][ExecutionCounts::COUNTS_AT as usize..].chunks(4))
.map(|w| u32::from_le_bytes(w.try_into().expect("a word")))
.collect()
(out.buffers[0][ExecutionCounts::COUNTS_AT as usize..]
.as_chunks::<4>()
.0
.iter())
.map(|w| u32::from_le_bytes(*w))
.collect()
}
/// Each part's count runs through the range's last command and no further, none for a part