From 16c831165d140cb579d33a62fb32fea1b546bfa3 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 20 Nov 2026 08:51:00 -0800 Subject: [PATCH] Translator cutover: the old render key re-pinned at 2203; two tests take from_queries' answers (ninth part) From job m3-max-59194 (5aeee89a90, the rebased tree; clippy, the suites' test step and clippy --cfg m2v_gpu ran, then it was cancelled): - pipeline::compile::tests::the_old_render_descriptor_key_keeps_its_value: the old runtime's key at SEMANTICS_VERSION 2203 is 459a25436a3c9b02, as that job reported (it was 8953dc9fc0ccf3b0 at the branch's 2202, 325562c0e5657846 on development's 2202). - engine_render_target_slice: amp_fragment's keyed inputs carry the push base the keys give a fragment function, the vertex function's push end (36 there); the expected inputs take it. - engine_simd_emulated: the test keeps its name and claim. The flattened plan refuses a grid of [1, 1, 100] in threadgroups of [1, 1, 96] up front (LocalSize z, 96 past 64) and asks for the variant at [1, 1, 64], whose plan runs both regions. It no longer asks the variant's plan about [1, 1, 96]: on from_queries' profile that plan runs it in 2 regions (job m3-max-59194), which the up-front check refuses; that disagreement is reported for its owner. --- .../src/pipeline/compile/tests.rs | 2 +- .../src/tests/engine_render_target_slice.rs | 7 +++-- .../src/tests/engine_simd_emulated.rs | 31 ++++++++++++------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/crates/metal2vulkan/src/pipeline/compile/tests.rs b/crates/metal2vulkan/src/pipeline/compile/tests.rs index 80130d14a..b95d2d8a2 100644 --- a/crates/metal2vulkan/src/pipeline/compile/tests.rs +++ b/crates/metal2vulkan/src/pipeline/compile/tests.rs @@ -1274,7 +1274,7 @@ fn the_old_render_descriptor_key_keeps_its_value() { let key = device("moltenvk-m3").render_descriptor_key(&d); let hex: String = key.digest().iter().map(|b| format!("{b:02x}")).collect(); assert_eq!( - hex, "8953dc9fc0ccf3b0170cbcea480b9655fea79417273334e042cbf25d63c3b799", + hex, "459a25436a3c9b02635824eb9080912378e4fa120ace76b7a90f8e5e3709eb09", "the old runtime's key of the descriptor" ); } diff --git a/crates/metal2vulkan/src/tests/engine_render_target_slice.rs b/crates/metal2vulkan/src/tests/engine_render_target_slice.rs index 56d186707..57bb8f535 100644 --- a/crates/metal2vulkan/src/tests/engine_render_target_slice.rs +++ b/crates/metal2vulkan/src/tests/engine_render_target_slice.rs @@ -424,8 +424,8 @@ fn a_fragment_reads_the_slice_index_its_vertex_function_wrote() { // A fragment that does not read the slice keeps its key: its only output is the color 0 it // writes, which the pipeline has no attachment for. Its stage input `color` (`user(locn0)`), // which the vertex function does not write, reaches only that color, so the linking drops it - // and the fragment compiles with it absent: its key is the one with exactly that absent input, - // and not the one without. + // and the fragment compiles with it absent: its key is the one with exactly that absent input + // and its push fields from the vertex function's push end, and not the one without the input. let plain = function("amp_fragment"); let keys = dev .render_pipeline_key( @@ -439,6 +439,9 @@ fn a_fragment_reads_the_slice_index_its_vertex_function_wrote() { let fragment_inputs = keys.fragment_inputs.clone().expect("fragment inputs"); eprintln!("absent varyings: {:?}", fragment_inputs.absent_varyings); assert_eq!(fragment_inputs.absent_varyings, absent); + // Its push fields start at the vertex function's push end. + assert_ne!(fragment_inputs.push_base, 0); + unattached.push_base = fragment_inputs.push_base; let mut dropped = unattached.clone(); dropped.absent_varyings = absent; assert_eq!(fragment_inputs, dropped); diff --git a/crates/metal2vulkan/src/tests/engine_simd_emulated.rs b/crates/metal2vulkan/src/tests/engine_simd_emulated.rs index 7fbd53ba2..fb8511189 100644 --- a/crates/metal2vulkan/src/tests/engine_simd_emulated.rs +++ b/crates/metal2vulkan/src/tests/engine_simd_emulated.rs @@ -2085,14 +2085,14 @@ fn the_emulated_tiers_limits_stay_refused_for_partial_simdgroups() { ); } -/// A `dispatchThreads` grid whose edge is a partial simdgroup runs whole on the variant. On -/// nvidia-rtx50-linux (`Direct`, z at most 64) a threadgroup deeper than the device's z runs on -/// both pipelines, as every kernel whose workgroup is its threadgroup runs a deep threadgroup on -/// `Device::from_queries`' profile: an interior of `[1, 1, 96]` runs on the plan's own variant, -/// and a grid of `[1, 1, 100]` in threadgroups of `[1, 1, 96]` or `[1, 1, 64]` asks for the -/// variant, whose plan runs both regions. +/// A `dispatchThreads` grid whose edge is a partial simdgroup runs whole on the variant, so its +/// interior is checked against the variant's limits, not the flattened tier's. On +/// nvidia-rtx50-linux (`Direct`, z at most 64), an interior of `[1, 1, 96]`, which the flattened +/// pipeline runs alone, asks for no variant; a grid of `[1, 1, 100]` in threadgroups of +/// `[1, 1, 96]` is a `LocalSize` refusal up front, and one in threadgroups of `[1, 1, 64]` asks for +/// the variant, whose plan runs both regions. #[test] -fn a_mixed_dispatch_runs_on_the_variant() { +fn a_mixed_dispatch_is_checked_against_the_variants_limits() { let Some(bc) = assemble("simd_ops") else { return; }; @@ -2134,11 +2134,20 @@ fn a_mixed_dispatch_runs_on_the_variant() { }; assert_eq!(plan.dispatch_variant(&interior), Ok(VariantKey::new())); assert!(plan.instantiate_dispatch(&state, &interior).is_ok()); - for z in [96, 64] { - let variant = plan.dispatch_variant(&mixed(z)); - let regions = (vplan.instantiate_dispatch(&state, &mixed(z))).map(|c| c.regions.len()); - assert_eq!((variant, regions), (Ok(emulated_key()), Ok(2)), "z {z}"); + match plan.dispatch_variant(&mixed(96)) { + Err(BindError::Unsupported(u)) => assert_eq!( + u.feature, + Feature::LocalSize { + axis: Some(Axis::Z) + } + ), + other => panic!("{other:?}"), } + assert_eq!(plan.dispatch_variant(&mixed(64)), Ok(emulated_key())); + let c = vplan + .instantiate_dispatch(&state, &mixed(64)) + .expect("the variant runs both regions"); + assert_eq!(c.regions.len(), 2); } /// The committed moltenvk-m3 profile (32-lane subgroups that require whole subgroups).