Validation: an indexed draw past its index buffer is the runtime's limit
The runtime refuses an indexed draw whose indices leave its index buffer
as Refusal::IndexBufferOffset, as Metal's validation stops the draw
(render_encoder's draw path checks offset + count * size against the
buffer's length; the runtime's README states the refusal among those
Metal's validation makes). A case that declares a draw's index buffer an
out-of-bounds target is such a draw, so no run through the runtime draws
it. The planner's ruling: record these rows as the runtime's limit with
that typed refusal, by the function-table precedent.
ToolingRequirement::IndexBufferPastEnd ("index_buffer_past_end"):
Limit::Runtime, it stops the engine's candidate and keeps its cases
Metal-qualified (qualifies_on_metal). The case checker raises it from the
case's literals (executor_contract::case_requirements: an out-of-bounds
target of OutOfBoundsResource::IndexBuffer), never from a source's
structure, so no census row carries it. executor_contract.rs is a
classifier input, so every cached triage recomputes.
What lost execution: of the committed cases, the 2 public index-buffer
cases d900a10225 and da4185d2a2, which ran on the old executor's padded
copy until now. The old executor's padded index copy is now reached by
no committed case; it goes with the old executor's tables.
Tests: requirement.rs's an_index_buffer_past_its_end_stops_only_the_candidate
and both requirement lists; executor_contract's case test (a vertex
case's index-buffer target raises it alone, an attribute-buffer target
raises nothing).
Verified: cargo fmt; the compile gate follows as a potluck job.
This commit is contained in:
1 parent
67b55af6ff
commit
9a28de4736
4 files changed
+89
-16
No files matched your search
@@ -2758,7 +2758,8 @@ fn a_plain_draw_and_only_one_runs_through_the_runtime() {
|
||||
};
|
||||
assert!(runs_render_through_runtime(&authored, &unrasterized));
|
||||
// An attribute buffer's out-of-bounds target draws through the runtime, whose facts refuse or
|
||||
// run it (`runtime_bounds::drawn`); an index buffer's stays on the executor's own context.
|
||||
// run it (`runtime_bounds::drawn`); no other target does (an index buffer's case carries the
|
||||
// runtime's limit, `index_buffer_past_end`, which stops it before either context).
|
||||
use crate::case::out_of_bounds::ContainmentForm;
|
||||
let bounded = |resource, form| RenderCase {
|
||||
out_of_bounds: vec![OutOfBoundsTarget {
|
||||
|
||||
@@ -19,6 +19,7 @@ use crate::air::reflect::{
|
||||
ResourceKind, ShaderInterface, ShaderStage, TextureDimension,
|
||||
TextureFormat as ReflectedTextureFormat,
|
||||
};
|
||||
use crate::case::out_of_bounds::OutOfBoundsResource;
|
||||
use crate::case::{
|
||||
AuthoredCase, DeviceBufferArrayResource, OutputSelection, Primitive, Stage, TextureFormat,
|
||||
ThreadgroupMemoryResource,
|
||||
@@ -787,7 +788,8 @@ pub fn engine_source_requirements(reflection: &ShaderInterface) -> BTreeSet<Tool
|
||||
/// ([`mesh::mesh_requirements`]); each of them a case authors is also named here, so a case that
|
||||
/// was checked against an older reflection is refused all the same. A depth outside `[0, 1]` the
|
||||
/// case gives a depth image is the runtime's limit on every device
|
||||
/// ([`depth_range::depth_range_requirement`]).
|
||||
/// ([`depth_range::depth_range_requirement`]), and so is an indexed draw past its index buffer
|
||||
/// (its out-of-bounds target, [`ToolingRequirement::IndexBufferPastEnd`]).
|
||||
pub fn case_requirements(case: &AuthoredCase) -> BTreeSet<ToolingRequirement> {
|
||||
let render = matches!(case.stage, Stage::Vertex | Stage::Fragment);
|
||||
let drawn = render || case.stage.is_mesh_pipeline_stage();
|
||||
@@ -836,6 +838,15 @@ pub fn case_requirements(case: &AuthoredCase) -> BTreeSet<ToolingRequirement> {
|
||||
case.is_rasterization_disabled_vertex() && !case.render_targets.is_empty(),
|
||||
ToolingRequirement::RasterizationDisabledRenderTarget,
|
||||
),
|
||||
(
|
||||
case.out_of_bounds.iter().any(|declaration| {
|
||||
declaration
|
||||
.targets
|
||||
.iter()
|
||||
.any(|target| target.resource == OutOfBoundsResource::IndexBuffer)
|
||||
}),
|
||||
ToolingRequirement::IndexBufferPastEnd,
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.filter_map(|(present, requirement)| present.then_some(requirement))
|
||||
@@ -2918,6 +2929,34 @@ entry:
|
||||
vertex.stage = Stage::Vertex;
|
||||
vertex.vertex_observation = Some(VertexObservation::Position);
|
||||
assert!(case_requirements(&vertex).is_empty());
|
||||
// An indexed draw past its index buffer is the runtime's limit; a vertex fetch past its
|
||||
// vertex buffer is no requirement.
|
||||
let past = |resource, form| {
|
||||
let mut past = vertex.clone();
|
||||
past.out_of_bounds = Some(crate::case::out_of_bounds::OutOfBounds {
|
||||
targets: vec![crate::case::out_of_bounds::OutOfBoundsTarget {
|
||||
resource,
|
||||
form,
|
||||
reach_before: 0,
|
||||
reach_after: 8,
|
||||
}],
|
||||
reads: Vec::new(),
|
||||
});
|
||||
past
|
||||
};
|
||||
use crate::case::out_of_bounds::ContainmentForm;
|
||||
only(
|
||||
&past(
|
||||
OutOfBoundsResource::IndexBuffer,
|
||||
ContainmentForm::IndexBuffer,
|
||||
),
|
||||
ToolingRequirement::IndexBufferPastEnd,
|
||||
);
|
||||
assert!(case_requirements(&past(
|
||||
OutOfBoundsResource::AttributeBuffer { location: 0 },
|
||||
ContainmentForm::VertexInput
|
||||
))
|
||||
.is_empty());
|
||||
vertex.depth_stencil = Some(DepthStencilResource {
|
||||
dimensions: [1, 1],
|
||||
initial_depth_b64: Some("AAAAAA==".into()),
|
||||
|
||||
@@ -190,6 +190,15 @@ pub enum ToolingRequirement {
|
||||
/// candidate does not run the case. The Metal oracle draws it, so a case of it stays
|
||||
/// Metal-qualified ([`Self::qualifies_on_metal`]).
|
||||
RenderFunctionTable,
|
||||
/// An indexed draw that reads past its index buffer: a case's out-of-bounds target of a draw's
|
||||
/// index buffer (`executor_contract::case_requirements`). The runtime refuses a draw whose
|
||||
/// indices run past the buffer, as Metal's validation stops it
|
||||
/// (`metal2vulkan_runtime::Refusal::IndexBufferOffset`, a refusal its README states, which is
|
||||
/// its guard), so the limit is the runtime's ([`Limit::Runtime`]) and the engine's candidate
|
||||
/// does not run the case. The case checker raises it from the case's literals, never a
|
||||
/// source's structure, so no census row carries it. The Metal oracle draws it, so a case of it
|
||||
/// stays Metal-qualified ([`Self::qualifies_on_metal`]).
|
||||
IndexBufferPastEnd,
|
||||
}
|
||||
|
||||
/// Every executor (the requirement leaves no case to author, or none to observe).
|
||||
@@ -197,7 +206,7 @@ const AUTHORING: &[Executor] = &Executor::ALL;
|
||||
const ENGINE: &[Executor] = &[Executor::EngineCandidate];
|
||||
|
||||
impl ToolingRequirement {
|
||||
pub const ALL: [Self; 27] = [
|
||||
pub const ALL: [Self; 28] = [
|
||||
Self::FunctionConstantLiteral,
|
||||
Self::VertexAttributeLiteral,
|
||||
Self::TessellationAttributeLiteral,
|
||||
@@ -225,6 +234,7 @@ impl ToolingRequirement {
|
||||
Self::ReplayedTemplateResources,
|
||||
Self::SeqCstFence,
|
||||
Self::RenderFunctionTable,
|
||||
Self::IndexBufferPastEnd,
|
||||
];
|
||||
|
||||
pub const fn as_str(self) -> &'static str {
|
||||
@@ -258,6 +268,7 @@ impl ToolingRequirement {
|
||||
Self::ReplayedTemplateResources => "replayed_template_resources",
|
||||
Self::SeqCstFence => "seq_cst_fence",
|
||||
Self::RenderFunctionTable => "render_function_table",
|
||||
Self::IndexBufferPastEnd => "index_buffer_past_end",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,9 +290,9 @@ impl ToolingRequirement {
|
||||
/// template it does not draw or replay ([`ToolingRequirement::MeshRenderPipeline`],
|
||||
/// [`ToolingRequirement::ReplayedTemplateResources`]), and a texture buffer an argument
|
||||
/// buffer or a texture-handle array holds ([`ToolingRequirement::TextureBufferMember`]),
|
||||
/// and a sequentially consistent fence and a render function's function table, which the
|
||||
/// runtime refuses ([`ToolingRequirement::SeqCstFence`],
|
||||
/// [`ToolingRequirement::RenderFunctionTable`]).
|
||||
/// and a sequentially consistent fence, a render function's function table and an indexed
|
||||
/// draw past its index buffer, which the runtime refuses ([`ToolingRequirement::SeqCstFence`],
|
||||
/// [`ToolingRequirement::RenderFunctionTable`], [`ToolingRequirement::IndexBufferPastEnd`]).
|
||||
///
|
||||
/// The requirements that stopped only the old engine's candidate were retired with it.
|
||||
pub const fn stops(self) -> &'static [Executor] {
|
||||
@@ -312,7 +323,8 @@ impl ToolingRequirement {
|
||||
| Self::TextureBufferMember
|
||||
| Self::ReplayedTemplateResources
|
||||
| Self::SeqCstFence
|
||||
| Self::RenderFunctionTable => ENGINE,
|
||||
| Self::RenderFunctionTable
|
||||
| Self::IndexBufferPastEnd => ENGINE,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,8 +333,8 @@ impl ToolingRequirement {
|
||||
/// accepts it with no candidate (`executor_contract::evidence_gap`), and the engine's candidate
|
||||
/// refuses it, typed. Only [`ToolingRequirement::MeshRenderPipeline`],
|
||||
/// [`ToolingRequirement::TextureBufferMember`], [`ToolingRequirement::DepthOutsideUnitRange`],
|
||||
/// [`ToolingRequirement::SeqCstFence`] and [`ToolingRequirement::RenderFunctionTable`]: their
|
||||
/// cases are qualified on Metal.
|
||||
/// [`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::RenderFunctionTable`] and
|
||||
/// [`ToolingRequirement::IndexBufferPastEnd`]: their cases are qualified on Metal.
|
||||
pub const fn qualifies_on_metal(self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
@@ -331,14 +343,16 @@ impl ToolingRequirement {
|
||||
| Self::DepthOutsideUnitRange
|
||||
| Self::SeqCstFence
|
||||
| Self::RenderFunctionTable
|
||||
| Self::IndexBufferPastEnd
|
||||
)
|
||||
}
|
||||
|
||||
/// Whose limit this requirement records. Every requirement is this crate's tooling's except
|
||||
/// [`ToolingRequirement::KernelMinLodClamp`], which Apple's compiler cannot build a pipeline
|
||||
/// for, and [`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::TextureBufferMember`],
|
||||
/// [`ToolingRequirement::DepthOutsideUnitRange`], [`ToolingRequirement::MeshRenderPipeline`]
|
||||
/// and [`ToolingRequirement::RenderFunctionTable`], which the runtime refuses.
|
||||
/// [`ToolingRequirement::DepthOutsideUnitRange`], [`ToolingRequirement::MeshRenderPipeline`],
|
||||
/// [`ToolingRequirement::RenderFunctionTable`] and [`ToolingRequirement::IndexBufferPastEnd`],
|
||||
/// which the runtime refuses.
|
||||
pub const fn limit(self) -> Limit {
|
||||
match self {
|
||||
Self::KernelMinLodClamp => Limit::Metal,
|
||||
@@ -346,7 +360,8 @@ impl ToolingRequirement {
|
||||
| Self::TextureBufferMember
|
||||
| Self::DepthOutsideUnitRange
|
||||
| Self::MeshRenderPipeline
|
||||
| Self::RenderFunctionTable => Limit::Runtime,
|
||||
| Self::RenderFunctionTable
|
||||
| Self::IndexBufferPastEnd => Limit::Runtime,
|
||||
_ => Limit::Tooling,
|
||||
}
|
||||
}
|
||||
@@ -499,7 +514,8 @@ mod tests {
|
||||
ToolingRequirement::DepthOutsideUnitRange,
|
||||
ToolingRequirement::MeshRenderPipeline,
|
||||
ToolingRequirement::SeqCstFence,
|
||||
ToolingRequirement::RenderFunctionTable
|
||||
ToolingRequirement::RenderFunctionTable,
|
||||
ToolingRequirement::IndexBufferPastEnd
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -545,6 +561,19 @@ mod tests {
|
||||
assert_eq!("render_function_table".parse(), Ok(requirement));
|
||||
}
|
||||
|
||||
/// An indexed draw past its index buffer: the Metal oracle draws it, so its cases stay
|
||||
/// Metal-qualified; the runtime refuses the draw as Metal's validation does, so the engine's
|
||||
/// candidate runs none, the runtime's limit, which closes its rows.
|
||||
#[test]
|
||||
fn an_index_buffer_past_its_end_stops_only_the_candidate() {
|
||||
let requirement = ToolingRequirement::IndexBufferPastEnd;
|
||||
assert_eq!(requirement.stops(), [Executor::EngineCandidate]);
|
||||
assert_eq!(requirement.limit(), Limit::Runtime, "{requirement}");
|
||||
assert!(!requirement.blocks_closure(), "{requirement}");
|
||||
assert!(requirement.qualifies_on_metal(), "{requirement}");
|
||||
assert_eq!("index_buffer_past_end".parse(), Ok(requirement));
|
||||
}
|
||||
|
||||
/// Every requirement stops some executor, and an executor's name is as stable as a
|
||||
/// requirement's. A requirement that stops the Metal oracle stops every executor: when Metal
|
||||
/// cannot run a case, no candidate has an observation to be compared with. Only a tooling gap
|
||||
@@ -593,7 +622,8 @@ mod tests {
|
||||
ToolingRequirement::DepthOutsideUnitRange,
|
||||
ToolingRequirement::MeshRenderPipeline,
|
||||
ToolingRequirement::SeqCstFence,
|
||||
ToolingRequirement::RenderFunctionTable
|
||||
ToolingRequirement::RenderFunctionTable,
|
||||
ToolingRequirement::IndexBufferPastEnd
|
||||
]
|
||||
);
|
||||
for executor in Executor::ALL {
|
||||
|
||||
+5
-2
@@ -493,8 +493,11 @@ cargo run -p metal2vulkan-validation --release --bin corpus-moltenvk -- \
|
||||
`not_supported{uncontained:unchecked vertex_input}`. A rasterization-disabled vertex case renders
|
||||
into the oracle's 1x1 `R8Unorm` attachment. A depth/stencil attachment, more samples, layered rendering, a dynamic vertex
|
||||
stride, an argument-buffer member, tessellation, an imageblock, a rasterization-rate map, an
|
||||
index buffer's out-of-bounds target or a fragment pass with no color target (the runtime makes
|
||||
no pass without an attachment) keeps the case on the executor's own context. Its device worker enables the
|
||||
out-of-bounds target other than an attribute buffer or a fragment pass with no color target (the
|
||||
runtime makes no pass without an attachment) keeps the case on the executor's own context. An
|
||||
indexed draw past its index buffer, which the runtime refuses as Metal's validation does
|
||||
(`Refusal::IndexBufferOffset`), carries `index_buffer_past_end`, the runtime's limit, and runs
|
||||
on Metal alone. Its device worker enables the
|
||||
validation layer through the loader's and the layer's variables, and any message the layer logs
|
||||
fails the row. The pipeline state's make is held to 500 MiB of peak live allocations and 20 s.
|
||||
Its row records the state's precision notes, the runtime's fingerprint and an out-of-bounds
|
||||
|
||||
Reference in new issue
Block a user