From 4a4a9ddff81b716ea18bf3d030b9a66fce1eeec2 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 20 Nov 2026 17:02:24 -0800 Subject: [PATCH] Fix forward of 3a5c6bcfd4: the texture-buffer member's refusal as lavapipe answers it, a granted index, the mesh census test Gate m3-max-60884 at 3a5c6bcfd4 failed three of its own tests: - a_texture_buffer_member_is_refused_at_the_make_where_a_2d_member_is_made. lavapipe under the runtime answers the member's make with the translator's capability refusal, DeviceCapabilityMissing of Feature::ArgumentBufferTextures (the texel-buffer-array features). It is not Unsupported{IdentityDomains}: the capability query comes first. The test now matches the runtime's own typed error (make_kernel returns rt::Error) on either feature. The 2D member is still made. TextureBufferMember's doc names both forms. - a_texture_buffer_is_refused_where_a_2d_texture_is_made. The 2D texture was refused as Refused(TextureIndex { index: None }): a shader-read texture takes an index of a live grant. The test grants one and makes both textures at it. The texture buffer was already refused as Gap::TextureBuffer. - census::tests::object_and_mesh_rows_are_indexed_and_classified. Under Limit::Runtime the object row closes and the two mesh rows stay unresolved on mesh_companion (a tooling gap): unresolved 2, runtime_refused 3. The gate's fourth failure, enables::tests::every_committed_profiles_context_enables_its_pinned_chain, is not this branch's: opened_chains.txt pins chains that four contexts no longer enable. This branch touches neither the enables nor the profiles. Verified: the compile gate named in the lane's report. --- .../src/candidate/platform/runtime.rs | 13 ++++--- .../src/candidate/tests/engine_compute.rs | 39 ++++++++++++------- crates/metal2vulkan-validation/src/census.rs | 18 ++++++--- .../src/requirement.rs | 8 ++-- 4 files changed, 48 insertions(+), 30 deletions(-) diff --git a/crates/metal2vulkan-validation/src/candidate/platform/runtime.rs b/crates/metal2vulkan-validation/src/candidate/platform/runtime.rs index 3fbbe8b8f..5b65e6539 100644 --- a/crates/metal2vulkan-validation/src/candidate/platform/runtime.rs +++ b/crates/metal2vulkan-validation/src/candidate/platform/runtime.rs @@ -213,22 +213,23 @@ pub fn on_runtime_device( } } -/// The make of `entry`'s compute pipeline state from `bitcode` on `device`, as a run makes it -/// ([`make`]) with no constant and no linked function: the runtime's typed refusal as the -/// product's ([`product_refusal`]). +/// The make of `entry`'s compute pipeline state from `bitcode` on `device`, with no constant, no +/// linked function and no sampler it numbers: the runtime's own answer, a device test's to judge. #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd), target_os = "linux"))] pub fn make_kernel( device: &rt::Device, bitcode: &[u8], entry: &str, -) -> Result { +) -> Result { let function = Library::from_air(bitcode) .and_then(|library| library.function(entry)) - .map_err(|error| product_refusal(&error))?; + .map_err(rt::Error::Translation)?; let descriptor = ComputePipelineDescriptor::new(StageSource::Function( FunctionDescriptor::new(function).with_specialized(true), )); - make(device, &descriptor) + device.new_compute_pipeline_state(&descriptor, |samplers: &[NumberedSampler]| { + Ok(vec![0; samplers.len()]) + }) } /// What a row records of the device that ran it. diff --git a/crates/metal2vulkan-validation/src/candidate/tests/engine_compute.rs b/crates/metal2vulkan-validation/src/candidate/tests/engine_compute.rs index 61eec88b4..df3d67828 100644 --- a/crates/metal2vulkan-validation/src/candidate/tests/engine_compute.rs +++ b/crates/metal2vulkan-validation/src/candidate/tests/engine_compute.rs @@ -675,10 +675,14 @@ fn a_fence_of_another_order_is_made_through_the_runtime() { fn a_texture_buffer_is_refused_where_a_2d_texture_is_made() { use metal2vulkan_runtime as rt; platform::on_runtime_device(crate::gpu::TEST_DEVICE, |device| { + let index = rt::IndexClass::Texture.range().start; + let _grant = device + .grant_indices(rt::IndexClass::Texture, index, 1) + .unwrap(); let made = |texture_type| { let descriptor = rt::TextureDescriptor::new(texture_type, rt::PixelFormat::RGBA32Float, 16, 1); - device.new_texture(&descriptor, None).map(drop) + device.new_texture(&descriptor, Some(index)).map(drop) }; let refused = made(rt::TextureType::TextureBuffer); assert!( @@ -690,26 +694,31 @@ fn a_texture_buffer_is_refused_where_a_2d_texture_is_made() { .unwrap(); } -/// `ToolingRequirement::TextureBufferMember`'s limit at the pipeline, both ways: the runtime's -/// identity domains hold no texture buffer among an argument buffer's textures, so the make of -/// `rlm_runtime_limits`'s `rlm_member_texture_buffer`, which reads one, is refused, typed -/// (`Unsupported{IdentityDomains}`), where the same read of a 2D texture the argument buffer holds, -/// `rlm_member_texture`, is made. The day the runtime makes the first, this fails. +/// `ToolingRequirement::TextureBufferMember`'s limit at the pipeline, both ways: the make of +/// `rlm_runtime_limits`'s `rlm_member_texture_buffer`, which reads a texture buffer an argument +/// buffer holds, is refused, typed, where the same read of a 2D texture the argument buffer holds, +/// `rlm_member_texture`, is made. The refusal is the translator's: the runtime's identity domains +/// hold no texture buffer among an argument buffer's textures (`Unsupported{IdentityDomains}`), +/// and a device whose answer lacks the features an argument buffer's texel buffers are read +/// through is refused at that query first (`Feature::ArgumentBufferTextures`), as lavapipe's is +/// under the runtime. The day the runtime makes the first, this fails. #[cfg(target_os = "linux")] #[test] fn a_texture_buffer_member_is_refused_at_the_make_where_a_2d_member_is_made() { - use crate::check::admission::NotSupported; - use metal2vulkan::error::{Feature, Unsupported}; + use metal2vulkan::error::Feature; let bitcode = llvm_assemble(&engine_dir().join("rlm_runtime_limits.ll")).unwrap(); - let identity_domains = crate::engine::Outcome::from(&metal2vulkan::error::Error::from( - Unsupported::not_implemented(Feature::IdentityDomains), - )); platform::on_runtime_device(crate::gpu::TEST_DEVICE, |device| { match platform::make_kernel(device, &bitcode, "rlm_member_texture_buffer") { - Err(ExecutorError::NotSupported(NotSupported::Product { outcome, .. })) => { - assert_eq!(outcome, identity_domains) - } - Err(error) => panic!("not the identity domains' refusal: {error}"), + Err(metal2vulkan_runtime::Error::Translation( + metal2vulkan::error::Error::Unsupported(refused), + )) => assert!( + matches!( + refused.feature, + Feature::IdentityDomains | Feature::ArgumentBufferTextures + ), + "{refused:?}" + ), + Err(error) => panic!("not the translator's typed refusal: {error}"), Ok(_) => panic!("the runtime made a texture buffer member's pipeline"), } platform::make_kernel(device, &bitcode, "rlm_member_texture").unwrap(); diff --git a/crates/metal2vulkan-validation/src/census.rs b/crates/metal2vulkan-validation/src/census.rs index eac78fc57..54fb3fdfe 100644 --- a/crates/metal2vulkan-validation/src/census.rs +++ b/crates/metal2vulkan-validation/src/census.rs @@ -552,11 +552,12 @@ mod tests { /// Object and mesh functions are rows like any other, read through the one stage vocabulary /// (`case::Stage`): a public module declaring one of each is two entry rows of those stages, /// and a private module declaring a mesh function is its shard's row. A cold census reflects - /// and classifies all three: each carries `mesh_render_pipeline` (no candidate draws a mesh - /// render pipeline), the object function draws with the generated launch observer of its - /// payload, and each mesh function, which sets its primitive's ID but no position and writes no - /// device memory, also carries `mesh_companion` (a fragment stage no executor generates), so - /// each is classified and unresolved, never skipped; a warm pass selects and reads nothing. + /// and classifies all three: each carries `mesh_render_pipeline` (the runtime has no mesh call, + /// so the runtime refuses it and closes the row), the object function draws with the generated + /// launch observer of its payload, and each mesh function, which sets its primitive's ID but no + /// position and writes no device memory, also carries `mesh_companion` (a fragment stage no + /// executor generates, a tooling gap), so the two mesh rows stay unresolved and the object row + /// closes, none skipped; a warm pass selects and reads nothing. #[test] fn object_and_mesh_rows_are_indexed_and_classified() { let scratch = ScratchDir::new("census-mesh-rows").unwrap(); @@ -631,7 +632,12 @@ mod tests { assert_eq!(cold.summary.total_sources, 3); assert_eq!(cold.summary.classified_sources, 3); assert_eq!(cold.summary.remaining_sources(), 0); - assert_eq!(cold.summary.unresolved_sources, 3, "{:?}", cold.summary); + assert_eq!(cold.summary.unresolved_sources, 2, "{:?}", cold.summary); + assert_eq!( + cold.summary.runtime_refused_sources, 3, + "{:?}", + cold.summary + ); assert_eq!( cold.summary.requirements, BTreeMap::from([ diff --git a/crates/metal2vulkan-validation/src/requirement.rs b/crates/metal2vulkan-validation/src/requirement.rs index c60efa00b..76b2a19d8 100644 --- a/crates/metal2vulkan-validation/src/requirement.rs +++ b/crates/metal2vulkan-validation/src/requirement.rs @@ -89,9 +89,11 @@ pub enum ToolingRequirement { /// element of a texture-handle array (`executor_contract`). The engine's candidate runs /// neither. The runtime makes no texture buffer (`metal2vulkan_runtime::Gap::TextureBuffer` /// at `new_texture`), and its identity domains hold no texture buffer among an argument - /// buffer's textures, so it refuses such a function's pipeline at its make - /// (`Unsupported{IdentityDomains}`): the limit is the runtime's ([`Limit::Runtime`]), held - /// both ways by the device tests + /// buffer's textures, so it refuses such a function's pipeline at its make, typed + /// (`Unsupported{IdentityDomains}`, or, on a device whose answer lacks the features an + /// argument buffer's texel buffers are read through, `Feature::ArgumentBufferTextures` at + /// that query first): the limit is the runtime's ([`Limit::Runtime`]), held both ways by the + /// device tests /// `candidate::tests::engine_compute::a_texture_buffer_is_refused_where_a_2d_texture_is_made` /// and `..::a_texture_buffer_member_is_refused_at_the_make_where_a_2d_member_is_made`. The /// Metal oracle makes and binds both, so a case of either stays Metal-qualified