Validation: a 64-bit texture atomic is the runtime's limit

The translator lowers an atomic_min or atomic_max on a Metal ulong
texture to a 64-bit image atomic, which needs shaderImageInt64Atomics.
The runtime's floor enables no 64-bit image atomic on any device
(floor::Features has no such structure, and shader_enables tells the
translator only of the floor's features), so a pipeline that calls one
is Error::Translation of Unsupported{ImageAtomics} on every device.
Metal's feature set tables give the form to the Apple8 family and later
("GPU devices in the Apple8 family support 64-bit atomic minimum and
maximum using ulong, on both buffers and textures, only on macOS"). The
planner's ruling: the consumer's device claims no Apple family on any
host, so no guest following documented Metal reaches the form, as with
render function tables; the rows close as the runtime's limit with their
typed refusal, by the mechanism of the fence and function-table rows. It
re-opens if the consumer's family claim gains every Apple7 piece and
this is what holds Apple8 back, or when a guest meets it in a walk. The
requirement's doc comment and the README's gap line state the feature
set tables' basis.

Cherry-picked from cf3b11c0a8 (steelbrain/valexec2-ulong) onto
9a28de4736, where IndexBufferPastEnd already took the 28th place: this
is the 29th requirement.

ToolingRequirement::UlongTextureAtomic ("ulong_texture_atomic"):
Limit::Runtime, it stops the engine's candidate and keeps its cases
Metal-qualified (qualifies_on_metal). It is raised from the module's air
calls (executor_contract::unsupported_air_requirements, through the new
calls_ulong_texture_atomic: a ulong texture call whose operation is an
atomic), so census rows carry it too. executor_contract.rs is a
classifier input, so every cached triage recomputes. The runtime's
README states the gap among the known gaps of pipeline states, which is
the requirement's guard.

What lost execution: of the committed cases, the 9 whose source is the
public fixture unk_ulong_atomics.ll (3 of entry unk_ulong_atomic_rw, 6 of
unk_ulong_atomics). The 3 (828e1f10db, 8db749bbad, fec876391d) failed
through the runtime in the family D proof m3-max-61319 with
device_capability_missing ImageAtomics; the 6 bind a texture buffer, so
they ran on the old executor until now, and matched there. No other
committed case's name states a 64-bit texture atomic; private-sourced
cases were not scanned here.

Tests: requirement.rs's a_ulong_texture_atomic_stops_only_the_candidate
and both requirement lists; executor_contract's
ulong_texture_operations_are_named_by_their_texel (the atomics fixture
raises exactly this requirement, the read-write fixture none, and the
same calls on a 32-bit texel none).

Verified: cargo fmt; the compile gate follows as a potluck job.
This commit is contained in:
Anees Iqbal committed 2026-11-20 21:27:21 -08:00
1 parent 9a28de4736
commit 1d16171943
3 files changed
+79 -15

No files matched your search

+6
View File
@@ -2540,6 +2540,12 @@ or does not check is rebuilt from the generations' names, with young counted ful
-51726, -51757, -51772, -51839 and -51840. No tool translates every pipeline state of the
recorded streams under the identity domains without a GPU, so the count is of these streams
to these frames.
- A 64-bit texture atomic (`atomic_min` or `atomic_max` on a `ulong` texture), which Metal's
feature set tables give the Apple8 family and later ("GPU devices in the Apple8 family support
64-bit atomic minimum and maximum using ulong, on both buffers and textures, only on macOS"),
is lowered to a 64-bit image atomic, which needs `shaderImageInt64Atomics`. Device creation
enables no 64-bit image atomic, so a state over a function that calls one is
`Error::Translation` of `Unsupported{ImageAtomics}`, needing that feature, on every device.
- Every `VkPipeline` is made through the device's `VkPipelineCache` (The cache directory, above),
which is empty on a host's first run. Cold, the driver's time for a recorded session's render
pipelines made through it, against the same pipelines made past any cache (states-only plays):
@@ -155,7 +155,8 @@ fn encoder_operation_is_executable(operation: crate::air::calls::CommandEncoderO
}
/// The requirements a module's `air.*` calls state by their names alone: an implicit imageblock
/// texture whose format no literal names, and an indirect command no executor encodes.
/// texture whose format no literal names, an indirect command no executor encodes, and a 64-bit
/// texture atomic, which the runtime refuses ([`calls_ulong_texture_atomic`]).
pub fn unsupported_air_requirements(
calls: &BTreeMap<String, usize>,
) -> BTreeSet<ToolingRequirement> {
@@ -172,9 +173,26 @@ pub fn unsupported_air_requirements(
}) {
requirements.insert(ToolingRequirement::IndirectCommandBuffer);
}
if calls_ulong_texture_atomic(calls) {
requirements.insert(ToolingRequirement::UlongTextureAtomic);
}
requirements
}
/// Whether the module calls an atomic on a Metal `ulong` texture (`atomic_min` or `atomic_max`,
/// the only ones Apple's compiler takes of one): a [`ulong_texture_calls`] call whose operation is
/// an atomic, which the translator lowers to a 64-bit image atomic
/// ([`ToolingRequirement::UlongTextureAtomic`]).
pub fn calls_ulong_texture_atomic(calls: &BTreeMap<String, usize>) -> bool {
use metal2vulkan_air::intrinsics::{AirIntrinsic, TexOp};
ulong_texture_calls(calls).any(|name| {
matches!(
AirIntrinsic::parse(name),
Some(AirIntrinsic::Texture(texture)) if matches!(texture.op, TexOp::Atomic(_))
)
})
}
/// The module's `air.*` texture operations on a Metal `ulong` texture: those the product's
/// intrinsic table decodes with a 64-bit unsigned texel (`air::intrinsics::Texture::ulong`). A
/// `ulong` texture that is only queried spells no texel, so no call names it. Descriptive: every
@@ -2112,8 +2130,9 @@ mod tests {
}
/// Each texture operation on a `ulong` texel, in every shape the public fixtures spell, is a
/// `ulong` texture call, and no executor's gap. The same operations on a 32-bit texel are no
/// `ulong` texture call.
/// `ulong` texture call; a read or a write is no executor's gap, and an atomic is the runtime's
/// ([`ToolingRequirement::UlongTextureAtomic`]). The same operations on a 32-bit texel are no
/// `ulong` texture call and no gap.
#[test]
fn ulong_texture_operations_are_named_by_their_texel() {
let fixtures = [
@@ -2136,12 +2155,18 @@ mod tests {
.count()
);
operations += ulong.len();
assert!(unsupported_air_requirements(&calls).is_empty());
let atomic = ulong.iter().any(|name| name.contains("atomic_"));
assert_eq!(calls_ulong_texture_atomic(&calls), atomic);
assert_eq!(
unsupported_air_requirements(&calls),
BTreeSet::from_iter(atomic.then_some(ToolingRequirement::UlongTextureAtomic))
);
let narrow = calls
.keys()
.map(|name| (name.replace(".u.v4i64", ".u.v4i32"), 1))
.collect::<BTreeMap<_, _>>();
assert!(!calls_ulong_texture(&narrow));
assert!(unsupported_air_requirements(&narrow).is_empty());
}
// The distinct operations the two modules spell: reads, writes, and atomic minima and
// maxima of the six shapes, the 2D ones at 32- and 16-bit coordinates.
@@ -199,6 +199,17 @@ pub enum ToolingRequirement {
/// 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,
/// A 64-bit texture atomic its module calls (`executor_contract::unsupported_air_requirements`):
/// an `atomic_min` or `atomic_max` on a Metal `ulong` texture, an Apple8-family feature (Metal's
/// feature set tables: "GPU devices in the Apple8 family support 64-bit atomic minimum and
/// maximum using ulong, on both buffers and textures, only on macOS"). The translator lowers it
/// to a 64-bit image atomic, which needs `shaderImageInt64Atomics`, and the runtime enables no
/// 64-bit image atomic on any device (its floor's features), so it refuses the pipeline on
/// every device as `Unsupported{ImageAtomics}` needing that feature
/// (`device_capability_missing`), a known gap its README states, which is its guard: the limit
/// is the runtime's ([`Limit::Runtime`]) and the engine's candidate does not run the case. The
/// Metal oracle runs it, so a case of it stays Metal-qualified ([`Self::qualifies_on_metal`]).
UlongTextureAtomic,
}
/// Every executor (the requirement leaves no case to author, or none to observe).
@@ -206,7 +217,7 @@ const AUTHORING: &[Executor] = &Executor::ALL;
const ENGINE: &[Executor] = &[Executor::EngineCandidate];
impl ToolingRequirement {
pub const ALL: [Self; 28] = [
pub const ALL: [Self; 29] = [
Self::FunctionConstantLiteral,
Self::VertexAttributeLiteral,
Self::TessellationAttributeLiteral,
@@ -235,6 +246,7 @@ impl ToolingRequirement {
Self::SeqCstFence,
Self::RenderFunctionTable,
Self::IndexBufferPastEnd,
Self::UlongTextureAtomic,
];
pub const fn as_str(self) -> &'static str {
@@ -269,6 +281,7 @@ impl ToolingRequirement {
Self::SeqCstFence => "seq_cst_fence",
Self::RenderFunctionTable => "render_function_table",
Self::IndexBufferPastEnd => "index_buffer_past_end",
Self::UlongTextureAtomic => "ulong_texture_atomic",
}
}
@@ -290,9 +303,10 @@ 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, a render function's function table and an indexed
/// draw past its index buffer, which the runtime refuses ([`ToolingRequirement::SeqCstFence`],
/// [`ToolingRequirement::RenderFunctionTable`], [`ToolingRequirement::IndexBufferPastEnd`]).
/// and a sequentially consistent fence, a render function's function table, an indexed draw
/// past its index buffer and a 64-bit texture atomic, which the runtime refuses
/// ([`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::RenderFunctionTable`],
/// [`ToolingRequirement::IndexBufferPastEnd`], [`ToolingRequirement::UlongTextureAtomic`]).
///
/// The requirements that stopped only the old engine's candidate were retired with it.
pub const fn stops(self) -> &'static [Executor] {
@@ -324,7 +338,8 @@ impl ToolingRequirement {
| Self::ReplayedTemplateResources
| Self::SeqCstFence
| Self::RenderFunctionTable
| Self::IndexBufferPastEnd => ENGINE,
| Self::IndexBufferPastEnd
| Self::UlongTextureAtomic => ENGINE,
}
}
@@ -334,7 +349,8 @@ impl ToolingRequirement {
/// refuses it, typed. Only [`ToolingRequirement::MeshRenderPipeline`],
/// [`ToolingRequirement::TextureBufferMember`], [`ToolingRequirement::DepthOutsideUnitRange`],
/// [`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::RenderFunctionTable`] and
/// [`ToolingRequirement::IndexBufferPastEnd`]: their cases are qualified on Metal.
/// [`ToolingRequirement::IndexBufferPastEnd`] and [`ToolingRequirement::UlongTextureAtomic`]:
/// their cases are qualified on Metal.
pub const fn qualifies_on_metal(self) -> bool {
matches!(
self,
@@ -344,6 +360,7 @@ impl ToolingRequirement {
| Self::SeqCstFence
| Self::RenderFunctionTable
| Self::IndexBufferPastEnd
| Self::UlongTextureAtomic
)
}
@@ -351,8 +368,8 @@ impl ToolingRequirement {
/// [`ToolingRequirement::KernelMinLodClamp`], which Apple's compiler cannot build a pipeline
/// for, and [`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::TextureBufferMember`],
/// [`ToolingRequirement::DepthOutsideUnitRange`], [`ToolingRequirement::MeshRenderPipeline`],
/// [`ToolingRequirement::RenderFunctionTable`] and [`ToolingRequirement::IndexBufferPastEnd`],
/// which the runtime refuses.
/// [`ToolingRequirement::RenderFunctionTable`], [`ToolingRequirement::IndexBufferPastEnd`] and
/// [`ToolingRequirement::UlongTextureAtomic`], which the runtime refuses.
pub const fn limit(self) -> Limit {
match self {
Self::KernelMinLodClamp => Limit::Metal,
@@ -361,7 +378,8 @@ impl ToolingRequirement {
| Self::DepthOutsideUnitRange
| Self::MeshRenderPipeline
| Self::RenderFunctionTable
| Self::IndexBufferPastEnd => Limit::Runtime,
| Self::IndexBufferPastEnd
| Self::UlongTextureAtomic => Limit::Runtime,
_ => Limit::Tooling,
}
}
@@ -515,7 +533,8 @@ mod tests {
ToolingRequirement::MeshRenderPipeline,
ToolingRequirement::SeqCstFence,
ToolingRequirement::RenderFunctionTable,
ToolingRequirement::IndexBufferPastEnd
ToolingRequirement::IndexBufferPastEnd,
ToolingRequirement::UlongTextureAtomic
]
);
}
@@ -574,6 +593,19 @@ mod tests {
assert_eq!("index_buffer_past_end".parse(), Ok(requirement));
}
/// A 64-bit texture atomic: the Metal oracle runs it, so its cases stay Metal-qualified; the
/// runtime enables no 64-bit image atomic, so the engine's candidate runs none, the runtime's
/// limit, which closes its rows. The retired `ulong_texture` name stays retired.
#[test]
fn a_ulong_texture_atomic_stops_only_the_candidate() {
let requirement = ToolingRequirement::UlongTextureAtomic;
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!("ulong_texture_atomic".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
@@ -623,7 +655,8 @@ mod tests {
ToolingRequirement::MeshRenderPipeline,
ToolingRequirement::SeqCstFence,
ToolingRequirement::RenderFunctionTable,
ToolingRequirement::IndexBufferPastEnd
ToolingRequirement::IndexBufferPastEnd,
ToolingRequirement::UlongTextureAtomic
]
);
for executor in Executor::ALL {