Fix forward of 14dca89bf9: lint, a float depth stays on the executor's context, a format the device lacks is not_enabled
What: the compile gate m3-max-60907 at 14dca89bf9 failed clippy twice and Rustdoc twice:
- `usage = usage | ...` becomes `usage |= ...`;
- `dispatched` takes its dispatch and threadgroup size as one argument;
- the public docs of `runs_through_runtime` and `RuntimeKernel` named private items as links.
The family's public proof (m3-max-60908, 218 cases on lavapipe against committed Metal, before
and after) showed 17 rows failing through the runtime:
- 15 bind a Depth32Float texture, whose bytes the runtime takes no upload of
(Gap::FloatDepthUpload). The executor cannot fill one, and a guest fills one by drawing.
`runtime_texture` now keeps such a texture on the executor's own context, where these rows
ran before.
- 2 bind R8Unorm_sRGB, which lavapipe's format query lacks. The runtime refuses it as
Gap::TextureFormat; before, the executor's own context recorded not_supported{not_enabled}.
`runtime_error` now maps that gap to NotSupported::NotEnabled with the gap's text. Every
other runtime gap still fails the row.
ENGINE_EXECUTOR_ABI is now vulkan-engine-v188. docs/VALIDATION.md's "Through the runtime" now
names textures and samplers, what keeps a case off the runtime, and the not_enabled mapping.
Tests: the routing test adds a Depth32Float texture, which is not routed. A new unit test
covers runtime_error's two mappings.
Verified: in the lane's report (compile gate and the focused rerun of the 17 rows).
This commit is contained in:
1 parent
0054bddacb
commit
47d782f3a5
4 files changed
+67
-20
No files matched your search
@@ -49,7 +49,8 @@ use crate::case::out_of_bounds::{OutOfBoundsResource, OutOfBoundsTarget};
|
||||
use crate::case::{
|
||||
AccelerationStructureKind, ArgumentBufferSamplerResource, AuthoredCase,
|
||||
ImplicitImageblockCoverage, IntersectionFunctionTableEntry, IntersectionFunctionTableResource,
|
||||
OutputSelection, RateMapLiteral, ResourceRole, SamplerResource, Stage, TextureType,
|
||||
OutputSelection, RateMapLiteral, ResourceRole, SamplerResource, Stage, TextureFormat,
|
||||
TextureType,
|
||||
};
|
||||
use crate::check::admission::{
|
||||
admit, AdmittedCase, ExecutionRequest, ExecutorError, NotSupported, VenueMismatch,
|
||||
@@ -123,7 +124,7 @@ use tables::{function_tables, table_buffers, FunctionTable, TableBuffers};
|
||||
/// how it decides a match. A change no recorded row can observe (a case kind no earlier executor
|
||||
/// ran, or one it refused) needs no bump; its commit says why. The commit that bumps it says what
|
||||
/// changed; this comment keeps no history.
|
||||
pub const ENGINE_EXECUTOR_ABI: &str = "vulkan-engine-v187";
|
||||
pub const ENGINE_EXECUTOR_ABI: &str = "vulkan-engine-v188";
|
||||
|
||||
/// One kernel case in the terms the binder takes: what this executor supports of an
|
||||
/// [`AuthoredCase`] (buffers, device buffer arrays, argument-buffer buffers and textures, command
|
||||
@@ -1172,7 +1173,7 @@ pub fn runtime_fingerprint() -> String {
|
||||
/// Whether `case`, mapped from `authored`, runs through the runtime (`metal2vulkan-runtime`'s
|
||||
/// public API, `platform::execute_runtime`) in place of the executor's own context: a kernel
|
||||
/// case of buffers (each device buffer array's elements among them), bound textures the runtime
|
||||
/// makes ([`runtime_texture`]) and bound samplers, threadgroup memory lengths, function
|
||||
/// makes (`runtime_texture`) and bound samplers, threadgroup memory lengths, function
|
||||
/// constants and linked functions, dispatched by `dispatchThreads` or `dispatchThreadgroups`,
|
||||
/// and observing a buffer, a bound texture or nothing. Decided by the case's structure alone:
|
||||
/// every field the mapping fills is named here, so a new one is decided when it is added.
|
||||
@@ -1231,9 +1232,11 @@ pub fn runs_through_runtime(authored: &AuthoredCase, case: &ComputeCase) -> bool
|
||||
}
|
||||
|
||||
/// Whether the runtime makes `texture` as the Metal oracle makes it: one sample and no sparse
|
||||
/// mapping (multisampled and sparse textures stay on the executor's own context), and of a type
|
||||
/// the runtime builds, so neither a texture buffer (`Gap::TextureBuffer`) nor a cube array
|
||||
/// (`Gap::CubeArrayTexture`).
|
||||
/// mapping (multisampled and sparse textures stay on the executor's own context), of a type the
|
||||
/// runtime builds, so neither a texture buffer (`Gap::TextureBuffer`) nor a cube array
|
||||
/// (`Gap::CubeArrayTexture`), and not a 32-bit float depth, whose bytes the runtime takes no
|
||||
/// upload of (`Gap::FloatDepthUpload`): a guest fills one by drawing, which a kernel case does
|
||||
/// not, so it stays on the executor's own context too.
|
||||
fn runtime_texture(texture: &LiteralTexture) -> bool {
|
||||
texture.sample_count == 1
|
||||
&& texture.sparse.is_none()
|
||||
@@ -1241,6 +1244,7 @@ fn runtime_texture(texture: &LiteralTexture) -> bool {
|
||||
texture.texture_type,
|
||||
TextureType::Buffer | TextureType::CubeArray
|
||||
)
|
||||
&& texture.format != TextureFormat::Depth32Float
|
||||
}
|
||||
|
||||
/// The bytes of each buffer a run through the runtime binds, by Metal index, as the Metal oracle
|
||||
@@ -1349,7 +1353,7 @@ fn runtime_texture_usages(
|
||||
declared_texture_writable(interface, texture.binding),
|
||||
);
|
||||
if declared_texture_atomic(interface, texture.binding) {
|
||||
usage = usage | TextureUsage::SHADER_ATOMIC;
|
||||
usage |= TextureUsage::SHADER_ATOMIC;
|
||||
}
|
||||
usages.insert(texture.binding, usage);
|
||||
}
|
||||
@@ -1371,7 +1375,7 @@ fn runtime_texture_usages(
|
||||
/// What a run through the runtime makes its kernel and binds from, beside its mapped case: the
|
||||
/// row's AIR, the modules it links, its buffers' bytes by Metal index (each bound buffer padded to
|
||||
/// its declared size, as the oracle makes it), the usage of each texture slot it binds
|
||||
/// ([`runtime_texture_usages`]), and the float reductions it executes
|
||||
/// (`runtime_texture_usages`), and the float reductions it executes
|
||||
/// (`check::interface::float_reductions`).
|
||||
pub struct RuntimeKernel<'a> {
|
||||
pub bitcode: &'a [u8],
|
||||
|
||||
@@ -2573,7 +2573,8 @@ fn plain_kernel() -> ComputeCase {
|
||||
/// makes and bound samplers, dispatched by threads or threadgroups and observing a buffer, a bound
|
||||
/// texture or nothing; a case with anything else (a pipeline state in an argument buffer, an
|
||||
/// explicit imageblock, an indirect dispatch, a texture the runtime does not make: multisampled,
|
||||
/// sparse, a texture buffer or a cube array) stays on the executor's own context.
|
||||
/// sparse, a texture buffer or a cube array, or one it takes no upload of: a 32-bit float depth)
|
||||
/// stays on the executor's own context.
|
||||
#[test]
|
||||
fn a_plain_kernel_case_and_only_one_runs_through_the_runtime() {
|
||||
use crate::case::{
|
||||
@@ -2634,6 +2635,11 @@ fn a_plain_kernel_case_and_only_one_runs_through_the_runtime() {
|
||||
}),
|
||||
..texture(TextureType::D2, 1)
|
||||
};
|
||||
let depth = LiteralTexture {
|
||||
format: TextureFormat::Depth32Float,
|
||||
bytes: vec![0; 64],
|
||||
..texture(TextureType::D2, 1)
|
||||
};
|
||||
let others = [
|
||||
object,
|
||||
ComputeCase {
|
||||
@@ -2648,6 +2654,7 @@ fn a_plain_kernel_case_and_only_one_runs_through_the_runtime() {
|
||||
textured(sparse),
|
||||
textured(texture(TextureType::Buffer, 1)),
|
||||
textured(texture(TextureType::CubeArray, 1)),
|
||||
textured(depth),
|
||||
];
|
||||
for other in &others {
|
||||
assert!(!runs_through_runtime(&authored, other), "{other:?}");
|
||||
|
||||
@@ -33,7 +33,7 @@ use crate::candidate::engine::{
|
||||
RefusedOn, RunAttempt, RuntimeKernel,
|
||||
};
|
||||
use crate::case::Stage;
|
||||
use crate::check::admission::ExecutorError;
|
||||
use crate::check::admission::{ExecutorError, NotSupported};
|
||||
use crate::coverage::{ExecutedCensus, ExecutionClass, HostClass, Leg, ModuleCensus};
|
||||
use crate::gpu::wait::new_runtime::{wait_until_retired, Retired};
|
||||
use crate::gpu::wait::{with_submission_label, SubmissionBackend, SubmissionLabel};
|
||||
@@ -324,11 +324,16 @@ fn environment(identity: &Identity, tools: &[ActiveTool]) -> serde_json::Value {
|
||||
})
|
||||
}
|
||||
|
||||
/// The runtime's `error` as the executor's: the translator's refusal as the product's, every
|
||||
/// other error a failure ([`execute_runtime`]).
|
||||
/// The runtime's `error` as the executor's: the translator's refusal as the product's, a pixel
|
||||
/// format the runtime makes no image of on this device as the device's (`NotEnabled`, as the
|
||||
/// executor's own context records a format its query lacks), every other error a failure
|
||||
/// ([`execute_runtime`]).
|
||||
fn runtime_error(what: &str, error: rt::Error) -> ExecutorError {
|
||||
match error {
|
||||
rt::Error::Translation(error) => product_refusal(&error),
|
||||
rt::Error::Unsupported(gap @ rt::Gap::TextureFormat { .. }) => {
|
||||
ExecutorError::NotSupported(NotSupported::NotEnabled(vec![format!("{what}: {gap}")]))
|
||||
}
|
||||
rt::Error::Unsupported(gap) => ExecutorError::Failed(format!(
|
||||
"{what}: the runtime refused a case its structure classifies as one it runs \
|
||||
({gap:?})"
|
||||
@@ -414,8 +419,7 @@ fn run(
|
||||
&buffers,
|
||||
&bound,
|
||||
case,
|
||||
dispatch,
|
||||
threads_per_group,
|
||||
(dispatch, threads_per_group),
|
||||
)
|
||||
})?;
|
||||
// A texture output is read back as the oracle reads one; a run through the runtime binds no
|
||||
@@ -630,8 +634,7 @@ fn dispatched(
|
||||
buffers: &BTreeMap<u32, Placed>,
|
||||
bound: &super::runtime_textures::Bound,
|
||||
case: &ComputeCase,
|
||||
dispatch: rt::Dispatch,
|
||||
threads_per_group: [u32; 3],
|
||||
(dispatch, threads_per_group): (rt::Dispatch, [u32; 3]),
|
||||
) -> Result<(), ExecutorError> {
|
||||
let fail = |what: &'static str| move |error: rt::Error| runtime_error(what, error);
|
||||
let queue = device.new_command_queue(1).map_err(fail("the queue"))?;
|
||||
@@ -692,3 +695,31 @@ fn dispatched(
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{rt, runtime_error};
|
||||
use crate::check::admission::{ExecutorError, NotSupported};
|
||||
|
||||
/// A pixel format the runtime makes no image of on the device is the device's refusal, as the
|
||||
/// executor's own context records a format its query lacks; another gap of the runtime fails
|
||||
/// the row, as the case's structure classifies it as one the runtime runs.
|
||||
#[test]
|
||||
fn a_format_the_runtime_makes_no_image_of_is_the_devices_refusal() {
|
||||
let format = rt::Error::Unsupported(rt::Gap::TextureFormat {
|
||||
pixel_format: rt::PixelFormat::R8UnormSRGB,
|
||||
});
|
||||
assert!(matches!(
|
||||
runtime_error("texture 1", format),
|
||||
ExecutorError::NotSupported(NotSupported::NotEnabled(gaps))
|
||||
if gaps.len() == 1 && gaps[0].starts_with("texture 1: ")
|
||||
));
|
||||
let depth = rt::Error::Unsupported(rt::Gap::FloatDepthUpload {
|
||||
pixel_format: rt::PixelFormat::Depth32Float,
|
||||
});
|
||||
assert!(matches!(
|
||||
runtime_error("texture 0 level 0", depth),
|
||||
ExecutorError::Failed(_)
|
||||
));
|
||||
}
|
||||
}
|
||||
+9
-4
@@ -456,10 +456,15 @@ cargo run -p metal2vulkan-validation --release --bin corpus-moltenvk -- \
|
||||
`robustness-off` leg none, so both encodings of a buffer-slot access's bounds run (the
|
||||
device's robustness and the shader's check).
|
||||
- **Through the runtime.** On Linux, in the stated leg and without a profile restriction, a kernel
|
||||
case of buffers (device buffer arrays included), threadgroup memory, function constants and
|
||||
linked functions, dispatched by threads or threadgroups and observing a buffer, runs through
|
||||
`metal2vulkan-runtime`'s public API instead, as a consumer runs it (`engine::runs_through_runtime`
|
||||
decides it from the case's structure). Its device worker enables the validation layer through the
|
||||
case of buffers (device buffer arrays included), bound textures and samplers, threadgroup
|
||||
memory, function constants and linked functions, dispatched by threads or threadgroups and
|
||||
observing a buffer, a bound texture or nothing, runs through `metal2vulkan-runtime`'s public API
|
||||
instead, as a consumer runs it (`engine::runs_through_runtime` decides it from the case's
|
||||
structure). Each texture is made as the Metal oracle makes it, Shared and written with
|
||||
`replace_region`, at an index the run grants; a multisampled, sparse, texture-buffer or
|
||||
cube-array texture, or a 32-bit float depth (which the runtime takes no upload of), keeps the
|
||||
case on the executor's own context. A pixel format the runtime makes no image of on the device
|
||||
records `not_enabled`, as the executor's own context records a format its query lacks. 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 and the runtime's fingerprint, and no SPIR-V, status, subgroup shape,
|
||||
|
||||
Reference in new issue
Block a user