rt: the compute encoder takes setStageInRegion:, which changes nothing it dispatches

glbench's streams call setStageInRegion: 158,349 times (780M) and 300,832 times (3090), every call
on an encoder whose kernel has no stage-in argument; neither stream makes a compute state with one
(replay's census over 204 and 148 states). Metal's region is what a kernel's [[stage_in]] argument
fetches by, and rt refuses a kernel with one at its state's creation (Gap::KernelInput,
pipeline.rs), so no state the encoder dispatches reads the region: `set_stage_in_region` accepts
it and changes nothing, as a kernel without the argument ignores it on Metal. No stage-in fetch is
built; the refusal stays.

Test: the sampling device test sets a stage-in region before its dispatch and checks the samples
as before. README and the signature table updated. Verified in the job named in the landing
message.
This commit is contained in:
Anees Iqbal committed 2026-11-18 18:05:44 -08:00
1 parent b7ef04ae97
commit 59bb3634d1
4 files changed
+22 -5

No files matched your search

+3
View File
@@ -956,6 +956,9 @@ that touch blocks first.
texture's format (`metal::format::integer_channels_word`); and for each constexpr sampler it
samples through, the index the consumer gave it at the state's creation. Nothing is written
into set 1 at bind or dispatch time, and every texture stays in its home layout.
- `set_stage_in_region` (`setStageInRegion:`) changes nothing a dispatch does: a kernel with a
`[[stage_in]]` argument, which fetches by the region, is `Gap::KernelInput` at its state's
creation, and a kernel without one ignores the region, as Metal's does.
- `use_heap` is `useHeap:`, for the block a heap's memory is: the command buffer keeps the block
until it retires, as it keeps a used buffer's block, so a heap given back while the work runs
stays valid under it. It declares no access (Metal states no retention for it; keeping is the
+9 -1
View File
@@ -18,7 +18,7 @@ use crate::pipeline::{
use crate::record::Reach;
use crate::ring::CHUNK;
use crate::sampler::SamplerState;
use crate::texture::Texture;
use crate::texture::{Region, Texture};
use ash::vk;
use metal2vulkan::metal::format::integer_channels_word;
use metal2vulkan::pipeline::{
@@ -610,6 +610,14 @@ impl ComputeCommandEncoder {
self.set_sampler_state(sampler, index)
}
/// `setStageInRegion:`: it changes nothing a dispatch does. The region is what a kernel's
/// `[[stage_in]]` argument fetches by, and a kernel with one is [`Gap::KernelInput`] at its
/// state's creation, so no state this encoder dispatches has one; a dispatch of a kernel
/// without one ignores the region, as Metal's does.
pub fn set_stage_in_region(&mut self, region: Region) {
let _ = region;
}
/// `setBufferOffset:atIndex:`.
///
/// Err: [`Refusal::BufferIndex`] for an index of 31 or more; [`Refusal::NoBufferAtIndex`]
+9 -4
View File
@@ -1,9 +1,9 @@
//! Kernels that sample textures, under a device cfg on every device of the cfg's kind: the
//! harness's `sample_down`, through a runtime sampler state bound with LOD clamps that read as its
//! own, and `sample_up`, through a constexpr sampler at the index the consumer gives it, chained in
//! one serial encoder so the second samples what the first wrote. Each answer is checked against
//! the linear filter's, and the constexpr sampler's index is shared between the states that number
//! it there and freed with the last.
//! own, under a stage-in region it ignores, and `sample_up`, through a constexpr sampler at the
//! index the consumer gives it, chained in one serial encoder so the second samples what the first
//! wrote. Each answer is checked against the linear filter's, and the constexpr sampler's index is
//! shared between the states that number it there and freed with the last.
//! A texture of any usage is made at any index of a texture grant: `sample_down` samples a texture
//! of shader-read usage alone at an index below 4,096 and writes one of shader-write usage above
//! it, in one dispatch. An index belongs to the texture placed there last: sampling and writing
@@ -210,6 +210,11 @@ mod on_device {
encoder
.set_sampler_state_with_lod_clamps(Some(sampler), 0.0, 1000.0, 0)
.expect("sampler");
// A stage-in region, which a kernel without a `[[stage_in]]` argument ignores.
encoder.set_stage_in_region(Region {
origin: [1, 2, 0],
size: [3, 4, 1],
});
encoder
.dispatch_threads([SIDE / 2, SIDE / 2, 1], [4, 4, 1])
.unwrap_or_else(|error| panic!("{name}: sample_down: {error}"));
@@ -9513,6 +9513,7 @@ method metal2vulkan-rt::ComputeCommandEncoder::set_bytes pub fn set_bytes(&mut s
method metal2vulkan-rt::ComputeCommandEncoder::set_compute_pipeline_state pub fn set_compute_pipeline_state(&mut self, state: &ComputePipelineState) -> Result<(), Error>
method metal2vulkan-rt::ComputeCommandEncoder::set_sampler_state pub fn set_sampler_state(&mut self, sampler: Option<&SamplerState>, index: u32) -> Result<(), Error>
method metal2vulkan-rt::ComputeCommandEncoder::set_sampler_state_with_lod_clamps pub fn set_sampler_state_with_lod_clamps(&mut self, sampler: Option<&SamplerState>, lod_min_clamp: f32, lod_max_clamp: f32, index: u32) -> Result<(), Error>
method metal2vulkan-rt::ComputeCommandEncoder::set_stage_in_region pub fn set_stage_in_region(&mut self, region: Region)
method metal2vulkan-rt::ComputeCommandEncoder::set_texture pub fn set_texture(&mut self, texture: Option<&Texture>, index: u32) -> Result<(), Error>
method metal2vulkan-rt::ComputeCommandEncoder::set_threadgroup_memory_length pub fn set_threadgroup_memory_length(&mut self, length: u32, index: u32) -> Result<(), Error>
method metal2vulkan-rt::ComputeCommandEncoder::update_fence pub fn update_fence(&mut self, fence: &Fence) -> Result<(), Error>
Can't render this file because it is too large.