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).