runtime: a kernel refused for a runtime fact names the fact
A kernel whose module carries a RuntimeFact the compute encoder does not supply was refused as
Gap::KernelInput { kind: KernelInputKind::RuntimeFact }, and the error did not say which fact. A
guest's boot met it once, on a system kernel's compute pipeline, with no way to tell what to build.
- The translator gives each fact a name: RuntimeFact::name, the variant's name as a &'static str,
without its fields (crates/metal2vulkan/src/pipeline/facts.rs, one arm per variant).
- KernelInputKind::RuntimeFact becomes RuntimeFact { fact: &'static str }, so the kind stays Copy
and Hash. The catch-all of the runtime's fact match fills it, which also covers an address
alignment of a slot that is not a kernel's buffer or is not a power of two. Error's Display
prints the kind, so the refusal's text carries the name.
- The runtime README's two imageblock lines say which fact the refusal names.
- api_signatures.tsv blessed (the new method, the variant's new shape); docs/REFUSALS.md
regenerated, unchanged (it names the Gap, not the kind's variants).
The consumer names neither KernelInputKind nor RuntimeFact in its code
(consumer-uses.sh KernelInputKind RuntimeFact: 0 code hits on its development 62b3227c74 and its
steelbrain/* refs of the last day), so the variant's new shape breaks nothing there.
Test: the lavapipe test of an explicit-imageblock kernel (a4_imageblock_extent) now expects
KernelInputKind::RuntimeFact { fact: "ImageblockSize" }, and its text check reads the name in the
refusal. Without the change the kind carries no name and the test does not compile.
This commit is contained in:
1 parent
3674f98a66
commit
66f494156d
6 files changed
+147
-22
No files matched your search
@@ -2343,13 +2343,13 @@ while the driver's exit handler waited on a lock, with every runtime thread alre
|
||||
wide, and one that does not cannot tell its width. `imageblockMemoryLengthForDimensions:`
|
||||
(`imageblock_memory_length_for_dimensions`) answers 0 for a kernel that declares no imageblock, as
|
||||
Metal does. A kernel that reaches an imageblock has no state (`Gap::KernelInput` of
|
||||
`KernelInputKind::RuntimeFact`); one that declares an imageblock it never reaches, or whose
|
||||
compile kept no reflection to tell, answers `Gap::ImageblockLength`, as no case measures Metal's
|
||||
length. `requiredThreadsPerThreadgroup` (`required_threads_per_threadgroup`) is the descriptor's
|
||||
size, `[0, 0, 0]` where it set none, as the M3 recordings `pipeline-facts-compute-plain` and
|
||||
`pipeline-facts-compute-described` answer, and `supportIndirectCommandBuffers`
|
||||
(`support_indirect_command_buffers`) is false: a descriptor that asks for indirect command buffers
|
||||
is refused at the making (`Gap::IndirectCommandBuffers`).
|
||||
`KernelInputKind::RuntimeFact` naming `ImageblockSize`); one that declares an imageblock it never
|
||||
reaches, or whose compile kept no reflection to tell, answers `Gap::ImageblockLength`, as no case
|
||||
measures Metal's length. `requiredThreadsPerThreadgroup` (`required_threads_per_threadgroup`) is
|
||||
the descriptor's size, `[0, 0, 0]` where it set none, as the M3 recordings
|
||||
`pipeline-facts-compute-plain` and `pipeline-facts-compute-described` answer, and
|
||||
`supportIndirectCommandBuffers` (`support_indirect_command_buffers`) is false: a descriptor that
|
||||
asks for indirect command buffers is refused at the making (`Gap::IndirectCommandBuffers`).
|
||||
|
||||
### The cache directory
|
||||
|
||||
@@ -2513,12 +2513,12 @@ or does not check is rebuilt from the generations' names, with young counted ful
|
||||
is a first-use wait: on a cold play, `Metrics::first_use_waits` against
|
||||
`Metrics::made_ahead_variants` reads what the consumer's pre-pass left to the encoding threads.
|
||||
- A compute kernel with an explicit imageblock has no state (`Gap::KernelInput` of
|
||||
`KernelInputKind::RuntimeFact`). The Metal Shading Language specification supports imageblocks on
|
||||
macOS for Apple silicon only (sections 5.6 and 6.14), so a device that answers
|
||||
`supportsImageBlocks` NO gives a guest no imageblock to use. Over 34 recorded guest streams, one
|
||||
of them an arm64 macOS 27 boot, two such kernels are made, no dispatch binds one, and no stream
|
||||
calls `setImageblockWidth:height:`; the compute encoder has no counterpart for that call. One
|
||||
recording, the M3's, makes 10 states refused as `Gap::KernelInput`, the count of its
|
||||
`KernelInputKind::RuntimeFact` naming `ImageblockSize`). The Metal Shading Language specification
|
||||
supports imageblocks on macOS for Apple silicon only (sections 5.6 and 6.14), so a device that
|
||||
answers `supportsImageBlocks` NO gives a guest no imageblock to use. Over 34 recorded guest
|
||||
streams, one of them an arm64 macOS 27 boot, two such kernels are made, no dispatch binds one, and
|
||||
no stream calls `setImageblockWidth:height:`; the compute encoder has no counterpart for that
|
||||
call. One recording, the M3's, makes 10 states refused as `Gap::KernelInput`, the count of its
|
||||
explicit-imageblock makes; none is dispatched (jobs m3-max-58471, m3-max-58477, m3-max-58478 and
|
||||
m3-max-58483, and m3-max-57983 for the count).
|
||||
- An image-only kernel's first dispatch over a grid more than one deep at a tile no state of its
|
||||
|
||||
@@ -1370,9 +1370,13 @@ pub enum KernelInputKind {
|
||||
StageFlags,
|
||||
/// A fact of the module the encoder does not supply: a `RuntimeFact` the runtime does not
|
||||
/// name, such as an explicit imageblock's size (`RuntimeFact::ImageblockSize`), a resource's
|
||||
/// presence or a sampler's coordinates. Metal's counterpart is the dispatch's state the fact
|
||||
/// stands for: `setImageblockWidth:height:`, or the bound resource's own state.
|
||||
RuntimeFact,
|
||||
/// presence or a sampler's coordinates, or an address alignment of a slot that is not a
|
||||
/// kernel's buffer or that is not a power of two. Metal's counterpart is the dispatch's state
|
||||
/// the fact stands for: `setImageblockWidth:height:`, or the bound resource's own state.
|
||||
RuntimeFact {
|
||||
/// The fact's name (`RuntimeFact::name`), such as `"ImageblockSize"`.
|
||||
fact: &'static str,
|
||||
},
|
||||
/// An argument slot the encoder does not bind: a visible or an intersection function table
|
||||
/// at a buffer index, or a slot of another class or stage. Metal's counterparts are
|
||||
/// `setVisibleFunctionTable:atBufferIndex:` and `setIntersectionFunctionTable:atBufferIndex:`.
|
||||
|
||||
@@ -1225,8 +1225,10 @@ fn interface(
|
||||
// the device reads.
|
||||
RuntimeFact::CallStackDepth { .. } | RuntimeFact::OpenClMode => {}
|
||||
// `RuntimeFact` is non-exhaustive: a fact this match does not name is one the encoder
|
||||
// does not supply.
|
||||
_ => return Err(KernelInputKind::RuntimeFact),
|
||||
// does not supply, and the refusal names it.
|
||||
fact => {
|
||||
return Err(KernelInputKind::RuntimeFact { fact: fact.name() });
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut buffers = Vec::new();
|
||||
|
||||
@@ -88,16 +88,18 @@ mod on_device {
|
||||
|
||||
/// `a4_imageblock_extent`, a kernel over an explicit imageblock: its module states the
|
||||
/// imageblock's size as a runtime fact, which the encoder does not supply (it has no
|
||||
/// `setImageblockWidth:height:`).
|
||||
/// `setImageblockWidth:height:`), and the refusal names that fact.
|
||||
#[test]
|
||||
fn an_explicit_imageblock_kernel_is_refused_as_a_runtime_fact() {
|
||||
fn an_explicit_imageblock_kernel_is_refused_as_its_named_runtime_fact() {
|
||||
let Some(descriptor) = descriptor_of("a4_imageblock_extent", "a4_imageblock_extent") else {
|
||||
return;
|
||||
};
|
||||
refused_as(
|
||||
"kernel_input_imageblock",
|
||||
&descriptor,
|
||||
KernelInputKind::RuntimeFact,
|
||||
KernelInputKind::RuntimeFact {
|
||||
fact: "ImageblockSize",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -880,6 +880,122 @@ pub enum RuntimeFact {
|
||||
GridTiles,
|
||||
}
|
||||
|
||||
impl RuntimeFact {
|
||||
/// The fact's variant name, such as `"ImageblockSize"`: what a refusal names when the
|
||||
/// runtime does not supply the fact, without its fields.
|
||||
pub fn name(self) -> &'static str {
|
||||
match self {
|
||||
RuntimeFact::ThreadsPerThreadgroup => "ThreadsPerThreadgroup",
|
||||
RuntimeFact::ThreadgroupMemoryLength { .. } => "ThreadgroupMemoryLength",
|
||||
RuntimeFact::LocalSizeConstraint { .. } => "LocalSizeConstraint",
|
||||
RuntimeFact::LocalSizeLimits => "LocalSizeLimits",
|
||||
RuntimeFact::DispatchGrid => "DispatchGrid",
|
||||
RuntimeFact::IndirectGroupCount => "IndirectGroupCount",
|
||||
RuntimeFact::ResourcePresence { .. } => "ResourcePresence",
|
||||
RuntimeFact::SampleCount => "SampleCount",
|
||||
RuntimeFact::StorageTextureFormat { .. } => "StorageTextureFormat",
|
||||
RuntimeFact::SamplerCoordinates { .. } => "SamplerCoordinates",
|
||||
RuntimeFact::SamplerReduction { .. } => "SamplerReduction",
|
||||
RuntimeFact::ImageViewShape { .. } => "ImageViewShape",
|
||||
RuntimeFact::VertexFetch { .. } => "VertexFetch",
|
||||
RuntimeFact::VertexBufferStride { .. } => "VertexBufferStride",
|
||||
RuntimeFact::BaseVertexInstance => "BaseVertexInstance",
|
||||
RuntimeFact::DeviceAddresses { .. } => "DeviceAddresses",
|
||||
RuntimeFact::BufferRangeLimit { .. } => "BufferRangeLimit",
|
||||
RuntimeFact::TexelBufferRange { .. } => "TexelBufferRange",
|
||||
RuntimeFact::FramebufferFetch { .. } => "FramebufferFetch",
|
||||
RuntimeFact::ExecutionStatus => "ExecutionStatus",
|
||||
RuntimeFact::HeapNumericType { .. } => "HeapNumericType",
|
||||
RuntimeFact::SimdgroupEmulation { .. } => "SimdgroupEmulation",
|
||||
RuntimeFact::AmplificationCount => "AmplificationCount",
|
||||
RuntimeFact::EmulatedSimdgroups => "EmulatedSimdgroups",
|
||||
RuntimeFact::ImageblockSize { .. } => "ImageblockSize",
|
||||
RuntimeFact::RenderTargetArrayLength { .. } => "RenderTargetArrayLength",
|
||||
RuntimeFact::StageInRegion => "StageInRegion",
|
||||
RuntimeFact::StageInStride { .. } => "StageInStride",
|
||||
RuntimeFact::UniformViewRange { .. } => "UniformViewRange",
|
||||
RuntimeFact::UniformViewAliasing { .. } => "UniformViewAliasing",
|
||||
RuntimeFact::FragmentImageblock { .. } => "FragmentImageblock",
|
||||
RuntimeFact::TileFunction => "TileFunction",
|
||||
RuntimeFact::TileAttachmentFormat { .. } => "TileAttachmentFormat",
|
||||
RuntimeFact::StorageTextureNumericType { .. } => "StorageTextureNumericType",
|
||||
RuntimeFact::OutOfBoundsAlpha { .. } => "OutOfBoundsAlpha",
|
||||
RuntimeFact::BicubicTexels { .. } => "BicubicTexels",
|
||||
RuntimeFact::StorageTextureLevels { .. } => "StorageTextureLevels",
|
||||
RuntimeFact::StorageTextureLevelViews { .. } => "StorageTextureLevelViews",
|
||||
RuntimeFact::SparseTexture { .. } => "SparseTexture",
|
||||
RuntimeFact::AccelerationStructureInstanceCount { .. } => {
|
||||
"AccelerationStructureInstanceCount"
|
||||
}
|
||||
RuntimeFact::InterlockedFramebufferFetch { .. } => "InterlockedFramebufferFetch",
|
||||
RuntimeFact::ShadowStencil { .. } => "ShadowStencil",
|
||||
RuntimeFact::PredicationVote => "PredicationVote",
|
||||
RuntimeFact::TexelFormat { .. } => "TexelFormat",
|
||||
RuntimeFact::SrgbTexture { .. } => "SrgbTexture",
|
||||
RuntimeFact::UlongAtomicView { .. } => "UlongAtomicView",
|
||||
RuntimeFact::ViewportCount => "ViewportCount",
|
||||
RuntimeFact::AliasedImageblock { .. } => "AliasedImageblock",
|
||||
RuntimeFact::CallStackDepth { .. } => "CallStackDepth",
|
||||
RuntimeFact::OpenClMode => "OpenClMode",
|
||||
RuntimeFact::OpenClLineTexture { .. } => "OpenClLineTexture",
|
||||
RuntimeFact::RowLockstep => "RowLockstep",
|
||||
RuntimeFact::OneRow => "OneRow",
|
||||
RuntimeFact::UnitAxes { .. } => "UnitAxes",
|
||||
RuntimeFact::FlatGrid => "FlatGrid",
|
||||
RuntimeFact::CallThreadgroups => "CallThreadgroups",
|
||||
RuntimeFact::SparseTextureWrites { .. } => "SparseTextureWrites",
|
||||
RuntimeFact::TileThreadgroupMemory { .. } => "TileThreadgroupMemory",
|
||||
RuntimeFact::TextureSwizzle { .. } => "TextureSwizzle",
|
||||
RuntimeFact::TileImageblock { .. } => "TileImageblock",
|
||||
RuntimeFact::AmplificationDraws { .. } => "AmplificationDraws",
|
||||
RuntimeFact::FoldedGroups => "FoldedGroups",
|
||||
RuntimeFact::ReplayBindings => "ReplayBindings",
|
||||
RuntimeFact::MergedDraws => "MergedDraws",
|
||||
RuntimeFact::AbsentArgumentRead { .. } => "AbsentArgumentRead",
|
||||
RuntimeFact::ZeroedColor { .. } => "ZeroedColor",
|
||||
RuntimeFact::DroppedColor { .. } => "DroppedColor",
|
||||
RuntimeFact::DepthClampRange => "DepthClampRange",
|
||||
RuntimeFact::RotatedWeights => "RotatedWeights",
|
||||
RuntimeFact::MeshLastFirst => "MeshLastFirst",
|
||||
RuntimeFact::ConstantLanes { .. } => "ConstantLanes",
|
||||
RuntimeFact::FunctionTableRange { .. } => "FunctionTableRange",
|
||||
RuntimeFact::TestedStorageWrites { .. } => "TestedStorageWrites",
|
||||
RuntimeFact::MovableStorageWrites { .. } => "MovableStorageWrites",
|
||||
RuntimeFact::TileThreadgroup { .. } => "TileThreadgroup",
|
||||
RuntimeFact::ConstexprSampled { .. } => "ConstexprSampled",
|
||||
RuntimeFact::CubicSampler { .. } => "CubicSampler",
|
||||
RuntimeFact::CubicArgumentSampler { .. } => "CubicArgumentSampler",
|
||||
RuntimeFact::ShaderTests { .. } => "ShaderTests",
|
||||
RuntimeFact::HeapRawSamples { .. } => "HeapRawSamples",
|
||||
RuntimeFact::ShaderStencilTest { .. } => "ShaderStencilTest",
|
||||
RuntimeFact::ExtendedRangeInputBlend { .. } => "ExtendedRangeInputBlend",
|
||||
RuntimeFact::RotatedInputBlend { .. } => "RotatedInputBlend",
|
||||
RuntimeFact::WordInputMerge { .. } => "WordInputMerge",
|
||||
RuntimeFact::CrossClassReads { .. } => "CrossClassReads",
|
||||
RuntimeFact::StorageTextureWriteRounding { .. } => "StorageTextureWriteRounding",
|
||||
RuntimeFact::HeapWriteRounding { .. } => "HeapWriteRounding",
|
||||
RuntimeFact::HeapCrossClassNeutral { .. } => "HeapCrossClassNeutral",
|
||||
RuntimeFact::HeapResidency { .. } => "HeapResidency",
|
||||
RuntimeFact::HeapStorageReads { .. } => "HeapStorageReads",
|
||||
RuntimeFact::AnisotropicSampler { .. } => "AnisotropicSampler",
|
||||
RuntimeFact::StorageTextureIntegerChannels { .. } => "StorageTextureIntegerChannels",
|
||||
RuntimeFact::SynthesizedGeometry { .. } => "SynthesizedGeometry",
|
||||
RuntimeFact::ObjectThreadgroupArena { .. } => "ObjectThreadgroupArena",
|
||||
RuntimeFact::QuadPrimitiveIds => "QuadPrimitiveIds",
|
||||
RuntimeFact::PrivateList => "PrivateList",
|
||||
RuntimeFact::YCbCrInPlace { .. } => "YCbCrInPlace",
|
||||
RuntimeFact::TexelRows { .. } => "TexelRows",
|
||||
RuntimeFact::PartialObjectThreadgroups => "PartialObjectThreadgroups",
|
||||
RuntimeFact::BorderTexels { .. } => "BorderTexels",
|
||||
RuntimeFact::RegionViewports => "RegionViewports",
|
||||
RuntimeFact::PartialThreadgroups => "PartialThreadgroups",
|
||||
RuntimeFact::TexelBufferParts { .. } => "TexelBufferParts",
|
||||
RuntimeFact::AddressAlignment { .. } => "AddressAlignment",
|
||||
RuntimeFact::GridTiles => "GridTiles",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What one compile made of a slot of a `RuntimeFact::UniformViewRange`.
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
|
||||
@@ -8332,6 +8332,7 @@ method metal2vulkan::pipeline::ResourceSlot::separate_sampler_use pub fn separat
|
||||
method metal2vulkan::pipeline::ResourceSlot::separate_texture pub fn separate_texture(stage: Stage, texture: u32, c: CombinedSampler) -> Option<ResourceSlot>
|
||||
method metal2vulkan::pipeline::ResourceSlot::separate_texture_of pub fn separate_texture_of(&self) -> Option<(u32, CombinedSampler)>
|
||||
method metal2vulkan::pipeline::RuntimeDependency::new pub fn new(fact: RuntimeFact, mechanism: Mechanism) -> RuntimeDependency
|
||||
method metal2vulkan::pipeline::RuntimeFact::name pub fn name(self) -> &'static str
|
||||
method metal2vulkan::pipeline::SampledLevels::highest_lod pub fn highest_lod(&self) -> Option<f32>
|
||||
method metal2vulkan::pipeline::SampledLevels::level pub fn level(&self, s: SamplerLevels) -> Option<u32>
|
||||
method metal2vulkan::pipeline::SampledLevels::lowest pub fn lowest(&self, s: SamplerLevels) -> u32
|
||||
@@ -10357,7 +10358,7 @@ variant metal2vulkan-runtime::KernelInputKind::HandleTranslation HandleTranslati
|
||||
variant metal2vulkan-runtime::KernelInputKind::PointerTranslation PointerTranslation
|
||||
variant metal2vulkan-runtime::KernelInputKind::PushBytes PushBytes
|
||||
variant metal2vulkan-runtime::KernelInputKind::PushField PushField
|
||||
variant metal2vulkan-runtime::KernelInputKind::RuntimeFact RuntimeFact
|
||||
variant metal2vulkan-runtime::KernelInputKind::RuntimeFact RuntimeFact { fact: &'static str }
|
||||
variant metal2vulkan-runtime::KernelInputKind::Slot Slot
|
||||
variant metal2vulkan-runtime::KernelInputKind::Specialization Specialization
|
||||
variant metal2vulkan-runtime::KernelInputKind::StageFlags StageFlags
|
||||
|
||||
|
Can't render this file because it is too large.
|
Reference in new issue
Block a user