heap_textures: the untracked lane encodes once the pipeline pool settled

On the RTX 3090 (31247, the lane at 3df940c15f), both forms read the
kernel's write: 0 of 4096 texels as the blit wrote them and 4096 holding a
word of the write, in the Shared and the Private heap. But the device
split 0 command buffers at aliases, and the lane asserts at least one
where DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer holds. The
Radeon 780M passed both forms with 0 splits.

A compute state's creation under the default PipelineWaitPolicy::Bounded
hands its making to the device's pool and returns. A dispatch whose
pipeline is still being made then records later, into a VkCommandBuffer
of its own (pending_dispatch.rs). There it is apart from the write before
it, so there is nothing to split. The lane made its two states on a fresh
scratch cache and encoded at once. The lane now waits for the pool to
settle (pipelines_settled, as draw_work and made_at_creation do), so both
dispatches record into the encoder's VkCommandBuffer, where the split
rule acts. The HEAPTEX lines print the creations that left their making
running and the segments each command buffer began, which show the path
the run took.

Test-only. Verified: cargo fmt. The build and the 3090 run are pending.

Compiled in m3-max-31407 (msi: clippy plain and m2v_gpu, validation archive). Test-only.
This commit is contained in:
Anees Iqbal committed 2026-11-14 22:05:16 -08:00
1 parent 5e3afa3d79
commit eee64c8668
1 file changed
+13 -3
@@ -925,7 +925,12 @@ enum Reached {
}
/// The untracked heap lane's write, reaching the heap's buffer as `reached` says, then its read
/// through the texture over the same bytes, in one encoder (the tests above).
/// through the texture over the same bytes, in one encoder (the tests above). The encoder opens
/// once the device's pipeline pool settled ([`pipelines_settled`](super::pipelines_settled)): a
/// dispatch whose pipeline is still being made records later, into a `VkCommandBuffer` of its own
/// (`pending_dispatch.rs`), apart from every write before it, and splits nothing. Both made, the
/// two record into the encoder's. `HEAPTEX untracked` lines print the states' creations that
/// left their making running and the segments each command buffer began.
fn untracked_write_then_texture_read(reached: Reached) {
const SIDE: u64 = 64;
let messages = Messages::default();
@@ -945,11 +950,13 @@ fn untracked_write_then_texture_read(reached: Reached) {
.new_compute_pipeline_state(&descriptor, &PipelineOptions::default())
.unwrap()
};
let left_before = device.work_counts().creations_left_making;
let write = match reached {
Reached::Bound => state("examples/runtime_examples.ll", "scale_and_offset"),
Reached::Resident => state("examples/argument_stores.ll", "store_through_argument"),
};
let read = state("examples/texel_rows.ll", "rows_read");
let left_making = super::pipelines_settled(device).creations_left_making - left_before;
let queue = device.new_command_queue().unwrap();
let split_before = device.work_counts().command_buffers_split_at_aliases;
let mut made = false;
@@ -1005,6 +1012,7 @@ fn untracked_write_then_texture_read(reached: Reached) {
let out = device
.new_buffer(SIDE * SIDE * 16, ResourceOptions::shared())
.unwrap();
let segments_before = device.work_counts().command_buffers_begun_segments;
let command_buffer = queue.command_buffer().unwrap();
let mut encoder = command_buffer.compute_command_encoder().unwrap();
encoder.set_compute_pipeline_state(&write).unwrap();
@@ -1035,6 +1043,7 @@ fn untracked_write_then_texture_read(reached: Reached) {
.unwrap();
encoder.end_encoding().unwrap();
run(&command_buffer);
let segments = device.work_counts().command_buffers_begun_segments - segments_before;
let after = gpu_read(&queue, &out, 0..SIDE * SIDE * 16);
let read_texels: Vec<[u8; 4]> = (after.as_chunks::<16>().0.iter())
.map(|texel| {
@@ -1054,7 +1063,7 @@ fn untracked_write_then_texture_read(reached: Reached) {
.count();
eprintln!(
"HEAPTEX untracked {what}: {unchanged} of {} texels as the blit wrote them, {} \
holding a word of the kernel's write",
holding a word of the kernel's write; {segments} segments begun",
SIDE * SIDE,
words_of_the_write
);
@@ -1068,7 +1077,8 @@ fn untracked_write_then_texture_read(reached: Reached) {
let split = device.work_counts().command_buffers_split_at_aliases - split_before;
eprintln!(
"HEAPTEX untracked {reached:?}: {split} command buffers split at aliases (the driver's \
image uses miss buffer writes inside one: {splitting})"
image uses miss buffer writes inside one: {splitting}); {left_making} creations left \
their making running"
);
assert_eq!(split > 0, splitting && made);
}