From 77226504f06b2c4d954ec977feba5d1158ef1881 Mon Sep 17 00:00:00 2001 From: designgears Date: Thu, 3 Dec 2026 21:07:20 +0100 Subject: [PATCH 1/2] Runtime: VK_EXT_extended_dynamic_state and its feature enabled where listed, for RADV's fragment epilogs RADV of Mesa 26.3.1 draws a fragment function's depth or stencil output under a dynamic depth or stencil test enable (Vulkan 1.3 core state, which every render pipeline takes) through a fragment epilog, but makes the device's epilog cache only where the device enables extendedDynamicState, graphics pipeline libraries, shader objects or a few extended dynamic state 3 features. With none enabled, the first such draw dereferenced the cache's null operations in vkCmdDraw*: the guest died in RenderCommandEncoder::draw at first app launch on a Radeon 610M, and the runtime's stencil_export, depth_stencil_route and opengl_mode device tests segfaulted on that GPU. Mesa's main makes the cache on every device since its commit 108edde0 (2026-11-24). The extension is one of OPTIONAL_EXTENSIONS, its feature enabled where reported (DYNAMIC_STATE_EPILOGS); the translator is told of both, which it already counts on every 1.3 device, so no answer changes. README tables and a floor test. Not run here: this port was made in an environment without the tree's Rust 1.98 toolchain, so cargo fmt/clippy and the tests still have to run before it lands. (cherry picked from x86sim/metal2vulkan commit 584f3ad52) Co-Authored-By: Claude 5.5 --- crates/metal2vulkan-runtime/README.md | 19 +++++++ crates/metal2vulkan-runtime/src/device.rs | 4 ++ crates/metal2vulkan-runtime/src/floor.rs | 40 +++++++++++++- .../metal2vulkan-runtime/src/tests/floor.rs | 53 +++++++++++++++++-- 4 files changed, 110 insertions(+), 6 deletions(-) diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 381df8e4f..408b53c37 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -6401,6 +6401,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported. | `VK_EXT_device_fault` | device, where listed | a lost device's fault report, read once at its first loss (`DeviceLoss::fault`), through the fault-report feature below | | `VK_EXT_pipeline_robustness` | device, where listed | a kernel's buffers bound as storage buffers of set 0, contained by its pipeline's robust buffer access 2, through the pipeline-robustness feature below (Bound kernel buffers) | | `VK_KHR_maintenance8` | device, where listed | a sample at a texel offset the shader computes, with the offset as the sample's own `Offset` operand, through the optional feature `maintenance8` below | +| `VK_EXT_extended_dynamic_state` | device, where listed | no state of its own (every render pipeline's dynamic state is Vulkan 1.3's): RADV of Mesa 26.3.1 makes its fragment epilogs' cache only on a device that enables a few features, its `extendedDynamicState` among them, and without it crashes at a draw whose fragment function writes a depth or stencil output (Dynamic-state epilogs, below) | | `VK_EXT_sample_locations` | device, where listed | a render pass's sample positions (`RenderPassDescriptor::sample_positions`), as the dynamic sample locations of pipelines made for them, where its properties hold what `Device::programmable_sample_positions_supported` asks; it has no feature | | `VK_EXT_custom_border_color` | device, where reported from the image | Vulkan requires it of a device that enables the border swizzle below; none of its features is enabled | | `VK_EXT_border_color_swizzle` | device, where reported from the image | an opaque-black border sampled through a view whose component mapping is not the identity, defined and read through that mapping (Border swizzle, below) | @@ -6862,6 +6863,24 @@ does their `DRM_FORMAT_MOD_LINEAR` modifier for each of those formats it is list |---|---|---| | `linearColorAttachment` | `VkPhysicalDeviceLinearColorAttachmentFeaturesNV` | a `LINEAR` surface plane rendered as a linear colour attachment | +### Dynamic-state epilogs + +Where the device lists `VK_EXT_extended_dynamic_state`, device creation enables it, and its feature +below where the device reports it. It adds no form and no state: the depth and stencil test +enables every render pipeline takes as dynamic are Vulkan 1.3's, which need no feature. RADV of +Mesa 26.3.1 draws a fragment function's `[[depth]]` or `[[stencil]]` output under those dynamic +enables through a fragment epilog, and makes the device's cache of epilogs only where the device +enables this feature, graphics pipeline libraries, shader objects or one of a few extended +dynamic state 3 features; on a device that enables none, the first such draw dereferenced the +cache's null operations inside `vkCmdDrawIndexed` (a Ryzen 9800X3D's Radeon 610M, visionOS's +RealityKit drawing at its first app launch). Mesa's main makes the cache on every device since its +commit 108edde0 (2026-11-24). The translator's description states the extension and the feature, +which it already counts on every Vulkan 1.3 device, so no answer changes. + +| Dynamic-state-epilog feature | Structure | Used for | +|---|---|---| +| `extendedDynamicState` | `VkPhysicalDeviceExtendedDynamicStateFeaturesEXT` | RADV's cache of fragment epilogs, which a depth or stencil output under a dynamic test enable draws through | + ### Fault reports Where the device lists `VK_EXT_device_fault`, device creation enables it, and its feature below, diff --git a/crates/metal2vulkan-runtime/src/device.rs b/crates/metal2vulkan-runtime/src/device.rs index 77887e8df..a0f15b5d1 100644 --- a/crates/metal2vulkan-runtime/src/device.rs +++ b/crates/metal2vulkan-runtime/src/device.rs @@ -647,6 +647,7 @@ impl Device { mut maintenance5, mut maintenance8, mut pipeline_robustness, + mut extended_dynamic_state, } = enabled_features; // `sparseBinding` for imports over several dma-bufs (`Device::import_dma_bufs`), only where // the device's queries offer that import: it changes no other path, as only that import @@ -719,6 +720,9 @@ impl Device { if enabled(ash::ext::pipeline_robustness::NAME) { features = features.push_next(&mut pipeline_robustness); } + if enabled(ash::ext::extended_dynamic_state::NAME) { + features = features.push_next(&mut extended_dynamic_state); + } // SAFETY: as for the floor check. let listed = unsafe { vk_instance.enumerate_device_extension_properties(raw) } .map_err(Error::vulkan("vkEnumerateDeviceExtensionProperties"))?; diff --git a/crates/metal2vulkan-runtime/src/floor.rs b/crates/metal2vulkan-runtime/src/floor.rs index 4e0b10562..c5a08e177 100644 --- a/crates/metal2vulkan-runtime/src/floor.rs +++ b/crates/metal2vulkan-runtime/src/floor.rs @@ -62,7 +62,11 @@ pub const TIME_DOMAINS: [vk::TimeDomainKHR; 2] = /// `VK_EXT_pipeline_robustness`, with its `pipelineRobustness` feature where the device reports it, /// through which a kernel's pipeline contains its buffer arguments' storage buffers by robust /// buffer access 2, `VK_KHR_maintenance8` ([`MAINTENANCE8`]), for the -/// optional feature of its own, and `VK_EXT_sample_locations`, which has no feature, through which +/// optional feature of its own, `VK_EXT_extended_dynamic_state`, with its `extendedDynamicState` +/// feature where the device reports it, for no state of its own: every render pipeline's dynamic +/// state is Vulkan 1.3's, and a device that enables this feature (or a few others) is one whose +/// fragment epilogs the driver caches (`DYNAMIC_STATE_EPILOGS`), and `VK_EXT_sample_locations`, +/// which has no feature, through which /// a render pass rasterizes at the sample positions its descriptor sets, where its properties /// hold them ([`Device::programmable_sample_positions_supported`](crate::Device::programmable_sample_positions_supported)). pub const OPTIONAL_EXTENSIONS: &[&CStr] = &[ @@ -84,6 +88,7 @@ pub const OPTIONAL_EXTENSIONS: &[&CStr] = &[ ash::ext::device_fault::NAME, ash::ext::pipeline_robustness::NAME, MAINTENANCE8, + ash::ext::extended_dynamic_state::NAME, ash::ext::sample_locations::NAME, ]; @@ -241,6 +246,8 @@ pub(crate) fn shader_extension(name: &CStr) -> Option { Some(VkExtension::ExtExternalMemoryHost) } else if name == ash::ext::pipeline_robustness::NAME { Some(VkExtension::ExtPipelineRobustness) + } else if name == ash::ext::extended_dynamic_state::NAME { + Some(VkExtension::ExtExtendedDynamicState) } else if name == ash::ext::sample_locations::NAME { Some(VkExtension::ExtSampleLocations) } else { @@ -440,6 +447,9 @@ pub struct Features { /// `VkPhysicalDevicePipelineRobustnessFeaturesEXT`, of `VK_EXT_pipeline_robustness`: read and /// enabled only where the device lists it ([`OPTIONAL_EXTENSIONS`]). pub pipeline_robustness: vk::PhysicalDevicePipelineRobustnessFeaturesEXT<'static>, + /// `VkPhysicalDeviceExtendedDynamicStateFeaturesEXT`, of `VK_EXT_extended_dynamic_state`: read + /// and enabled only where the device lists it ([`DYNAMIC_STATE_EPILOGS`]). + pub extended_dynamic_state: vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT<'static>, } /// One feature: the Vulkan structure that reports it, its member as ash spells it, the member, and @@ -515,6 +525,9 @@ macro_rules! feature { (@structure pipeline_robustness) => { "VkPhysicalDevicePipelineRobustnessFeaturesEXT" }; + (@structure extended_dynamic_state) => { + "VkPhysicalDeviceExtendedDynamicStateFeaturesEXT" + }; (@translator) => { None }; @@ -844,6 +857,19 @@ pub(crate) const FAULT_REPORTS: &[Feature] = &[feature!(fault.device_fault)]; pub(crate) const PIPELINE_ROBUSTNESS: &[Feature] = &[feature!(pipeline_robustness.pipeline_robustness => PipelineRobustness)]; +/// The feature of `VK_EXT_extended_dynamic_state` (one of [`OPTIONAL_EXTENSIONS`]): enabled where +/// the device lists the extension and reports it. It adds no form and no state: the dynamic state +/// every render pipeline takes is Vulkan 1.3's own, which needs no feature. RADV (Mesa 26.3.1; +/// Mesa's main makes the cache on every device since its commit 108edde0, 2026-11-24) draws a +/// fragment function's depth or stencil output under a dynamic depth or stencil test enable +/// through a fragment epilog, and makes the device's cache of epilogs only where a device enables +/// one of a few features, this among them: a device that enables none of them dereferences the +/// cache's null operations at such a draw, in `vkCmdDraw*`, and takes the process down. The +/// translator's description states it and the extension, which it already counts on every Vulkan +/// 1.3 device: no answer changes. +pub(crate) const DYNAMIC_STATE_EPILOGS: &[Feature] = + &[feature!(extended_dynamic_state.extended_dynamic_state => ExtendedDynamicState)]; + /// The features of [`INDIRECT_COMMANDS`]: enabled together where the device offers indirect /// command buffers ([`IndirectCommandLimits`]), and neither otherwise. The translator is told of /// neither `maintenance5` nor `VK_KHR_maintenance5`: told, it would hold `A8Unorm` in `A8_UNORM` @@ -875,6 +901,7 @@ pub(crate) const ENABLED: &[&[Feature]] = &[ LINEAR_ATTACHMENTS, FAULT_REPORTS, PIPELINE_ROBUSTNESS, + DYNAMIC_STATE_EPILOGS, INDIRECT_COMMAND_FEATURES, ]; @@ -1274,6 +1301,7 @@ unsafe fn query( let maintenance5_listed = listed(ash::khr::maintenance5::NAME); let maintenance8_listed = listed(MAINTENANCE8); let pipeline_robustness_listed = listed(ash::ext::pipeline_robustness::NAME); + let extended_dynamic_state_listed = listed(ash::ext::extended_dynamic_state::NAME); let Features { core, @@ -1297,6 +1325,7 @@ unsafe fn query( maintenance5, maintenance8, pipeline_robustness, + extended_dynamic_state, } = &mut queried.features; let mut features = vk::PhysicalDeviceFeatures2::default() .push_next(&mut *vulkan11) @@ -1353,6 +1382,9 @@ unsafe fn query( if pipeline_robustness_listed { features = features.push_next(&mut *pipeline_robustness); } + if extended_dynamic_state_listed { + features = features.push_next(&mut *extended_dynamic_state); + } instance.get_physical_device_features2(physical, &mut features); *core = features.features; vulkan11.p_next = std::ptr::null_mut(); @@ -1375,6 +1407,7 @@ unsafe fn query( maintenance5.p_next = std::ptr::null_mut(); maintenance8.p_next = std::ptr::null_mut(); pipeline_robustness.p_next = std::ptr::null_mut(); + extended_dynamic_state.p_next = std::ptr::null_mut(); queried.families = instance.get_physical_device_queue_family_properties(physical); queried.memory = instance.get_physical_device_memory_properties(physical); @@ -1509,6 +1542,11 @@ pub(crate) fn decide(device: &Queried) -> Result { *(feature.field)(&mut features) = *(feature.field)(&mut reported); } } + if listed(ash::ext::extended_dynamic_state::NAME) { + for feature in DYNAMIC_STATE_EPILOGS { + *(feature.field)(&mut features) = *(feature.field)(&mut reported); + } + } let indirect_commands = indirect_commands(device, &mut features); Ok(Capabilities { float16: features.vulkan12.shader_float16 == vk::TRUE, diff --git a/crates/metal2vulkan-runtime/src/tests/floor.rs b/crates/metal2vulkan-runtime/src/tests/floor.rs index 75787014a..102b5e6fd 100644 --- a/crates/metal2vulkan-runtime/src/tests/floor.rs +++ b/crates/metal2vulkan-runtime/src/tests/floor.rs @@ -8,11 +8,11 @@ use crate::floor::{ choose, decide, flag_names, limits, vulkan_name, BelowFloor, Features, IndirectCommandLimits, MemoryTypes, Missing, Queried, ALPHA_TO_ONE, ATTACHMENT_READS, ATTACHMENT_READ_EXTENSIONS, BARYCENTRICS, BARYCENTRIC_EXTENSIONS, BORDER_SWIZZLE, BORDER_SWIZZLE_EXTENSIONS, - DEVICE_EXTENSIONS, FAULT_REPORTS, FILL_MODES, INDIRECT_COMMANDS, INSTANCE_EXTENSIONS, - LINEAR_ATTACHMENTS, MEMORY_FLAG_NAMES, MIN_LOD_CLAMPS, OPTIONAL, OPTIONAL_EXTENSIONS, - OPTIONAL_INSTANCE_EXTENSIONS, PIPELINE_ROBUSTNESS, PIXEL_INTERLOCK, PORTABILITY, - PORTABILITY_STATED, PRIVATE_MEMORY, QUAD_CONTROL, REQUIRED, RING_MEMORY, SHARED_MEMORY, - STEP_RATES, TIMESTAMP_BITS, TIME_DOMAINS, VERSION, + DEVICE_EXTENSIONS, DYNAMIC_STATE_EPILOGS, FAULT_REPORTS, FILL_MODES, INDIRECT_COMMANDS, + INSTANCE_EXTENSIONS, LINEAR_ATTACHMENTS, MEMORY_FLAG_NAMES, MIN_LOD_CLAMPS, OPTIONAL, + OPTIONAL_EXTENSIONS, OPTIONAL_INSTANCE_EXTENSIONS, PIPELINE_ROBUSTNESS, PIXEL_INTERLOCK, + PORTABILITY, PORTABILITY_STATED, PRIVATE_MEMORY, QUAD_CONTROL, REQUIRED, RING_MEMORY, + SHARED_MEMORY, STEP_RATES, TIMESTAMP_BITS, TIME_DOMAINS, VERSION, }; use ash::vk; use std::collections::BTreeSet; @@ -1820,6 +1820,41 @@ fn the_fault_report_is_enabled_where_listed_and_reported() { assert_eq!(answer(&device), (true, true), "listed and reported"); } +/// A device that lists `VK_EXT_extended_dynamic_state` is given it, and `extendedDynamicState` +/// where it reports it: RADV of Mesa 26.3.1 makes the cache of the fragment epilogs a depth or +/// stencil output under a dynamic test enable draws through only with that feature (or a few +/// others) enabled, and without it crashes at such a draw. One that reports the feature without +/// listing the extension is given neither. +#[test] +fn the_extended_dynamic_state_is_enabled_where_listed_and_reported() { + let name = ash::ext::extended_dynamic_state::NAME; + let answer = |device: &Queried| { + let capabilities = decide(device).unwrap_or_else(|below| panic!("{below}")); + ( + capabilities.extensions.contains(&name), + capabilities + .features + .extended_dynamic_state + .extended_dynamic_state + == vk::TRUE, + ) + }; + let mut device = at_the_floor(); + assert_eq!(answer(&device), (false, false), "at the floor"); + device + .features + .extended_dynamic_state + .extended_dynamic_state = vk::TRUE; + assert_eq!(answer(&device), (false, false), "reported, not listed"); + device.extensions.push(name.to_owned()); + assert_eq!(answer(&device), (true, true), "listed and reported"); + device + .features + .extended_dynamic_state + .extended_dynamic_state = vk::FALSE; + assert_eq!(answer(&device), (true, false), "listed, not reported"); +} + /// A device that lists `VK_KHR_maintenance8` and reports `maintenance8` has both enabled, and the /// translator is told of both, so a sample at a texel offset the shader computes takes it as its /// own `Offset` operand; a device at the floor has neither, and the translator, told of neither, @@ -2146,6 +2181,10 @@ fn the_readme_states_the_floor() { ["Pipeline-robustness feature", "Structure", "Used for"], PIPELINE_ROBUSTNESS, ), + ( + ["Dynamic-state-epilog feature", "Structure", "Used for"], + DYNAMIC_STATE_EPILOGS, + ), ] { let stated: BTreeSet<(String, String)> = table(§ion, &header) .into_iter() @@ -2331,6 +2370,7 @@ fn every_device_the_loader_lists_is_above_the_floor() { mut maintenance5, mut maintenance8, mut pipeline_robustness, + mut extended_dynamic_state, } = capabilities.features; let mut features = vk::PhysicalDeviceFeatures2::default() .features(core) @@ -2386,6 +2426,9 @@ fn every_device_the_loader_lists_is_above_the_floor() { if enabled(ash::ext::pipeline_robustness::NAME) { features = features.push_next(&mut pipeline_robustness); } + if enabled(ash::ext::extended_dynamic_state::NAME) { + features = features.push_next(&mut extended_dynamic_state); + } let extensions: Vec<*const c_char> = capabilities .extensions .iter() From 6e25c20f6d0ffe6b66085d6767545f2cd0e8b841 Mon Sep 17 00:00:00 2001 From: designgears Date: Thu, 3 Dec 2026 21:08:29 +0100 Subject: [PATCH 2/2] Translator: a select of two constant globals' addresses selects their blob offsets Both arms of such a select are blob addresses, and the strategy held them as plain operands, so the case was refused (Apple's PVRTC decoder in MTLSimDriver's default.metallib picks its modulation table this way). BlobStrategy::Select now holds the arms as LocalPtrs, each taken through blob_ptr at selection and emitted through ptr_value, as BlobStrategy::Copy already does. SEMANTICS_VERSION 2355: a module that refused before now compiles, with the select over the two globals' blob offsets. Test a_select_of_constant_globals_selects_their_blob_offsets: a kernel selecting between two 4-byte constant globals and loading through the result, run on every committed profile. Taken from x86sim/metal2vulkan's a980409cd, whose other parts are either already here (program scope buffer bindings, 058fd25a7; an i8 [[front_facing]] argument, 7c6e9d1fc) or a consumer's preference (memory::leaf's vector units). Not run here: this port was made in an environment without the tree's Rust 1.98 toolchain, so cargo fmt/clippy and the tests still have to run before it lands. (cherry picked from x86sim/metal2vulkan commit a980409cd) Co-Authored-By: Claude 5.5 --- crates/metal2vulkan/src/cache/mod.rs | 2 +- crates/metal2vulkan/src/lower/access/blob.rs | 14 +++--- crates/metal2vulkan/src/tests/engine_arena.rs | 50 +++++++++++++++++++ 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index b1bb42a1d..e5e06c13a 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -60,7 +60,7 @@ mod tests; /// unchanged version, and its bless records the version. Independent of the crate's version and of /// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no /// history. -pub const SEMANTICS_VERSION: u32 = 2354; +pub const SEMANTICS_VERSION: u32 = 2355; /// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the /// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another diff --git a/crates/metal2vulkan/src/lower/access/blob.rs b/crates/metal2vulkan/src/lower/access/blob.rs index 996b17e00..85f0b3fa7 100644 --- a/crates/metal2vulkan/src/lower/access/blob.rs +++ b/crates/metal2vulkan/src/lower/access/blob.rs @@ -56,11 +56,11 @@ pub enum BlobStrategy { Copy { of: LocalPtr, }, - /// `select c, t, f` of two blob pointers. + /// `select c, t, f` of two blob pointers; either may be a blob global's address itself. Select { c: ValueId, - t: ValueId, - f: ValueId, + t: LocalPtr, + f: LocalPtr, }, Load(BlobLoad), } @@ -254,8 +254,8 @@ pub fn select( use_blob(cx)?; BlobStrategy::Select { c: operand(cx, *c)?, - t: operand(cx, *t)?, - f: operand(cx, *f)?, + t: blob_ptr(cx, *t)?, + f: blob_ptr(cx, *f)?, } } InstKind::Load { @@ -372,8 +372,8 @@ pub fn emit( BlobStrategy::Copy { of } => ptr_value(cx, fb, *of)?, BlobStrategy::Select { c, t, f } => { let c = cx.operand(fb, *c)?; - let t = cx.operand(fb, *t)?; - let f = cx.operand(fb, *f)?; + let t = ptr_value(cx, fb, *t)?; + let f = ptr_value(cx, fb, *f)?; fb.select(c, t, f)? } BlobStrategy::Load(l) => { diff --git a/crates/metal2vulkan/src/tests/engine_arena.rs b/crates/metal2vulkan/src/tests/engine_arena.rs index ac7743cf0..2979ea35e 100644 --- a/crates/metal2vulkan/src/tests/engine_arena.rs +++ b/crates/metal2vulkan/src/tests/engine_arena.rs @@ -903,6 +903,56 @@ fn a_select_of_threadgroup_globals_selects_their_offsets() { } } +/// A `select` between two constant globals' addresses, then a dynamic byte load through it: both +/// arms are blob addresses, which the select takes as their offsets. +#[test] +fn a_select_of_constant_globals_selects_their_blob_offsets() { + let globals = "@std = internal unnamed_addr addrspace(2) constant [4 x i8] c\"\\00\\03\\05\\08\", align 1\n\ + @pun = internal unnamed_addr addrspace(2) constant [4 x i8] c\"\\00\\04\\84\\08\", align 1"; + let body = r#" %odd = trunc i32 %t to i1 + %tab = select i1 %odd, ptr addrspace(2) @std, ptr addrspace(2) @pun + %i = and i32 %t, 3 + %q = getelementptr inbounds i8, ptr addrspace(2) %tab, i32 %i + %b = load i8, ptr addrspace(2) %q, align 1 + %v0 = zext i8 %b to i32 + %v1 = add i32 %t, 1"#; + let Some(bc) = assemble("blob_select", &two_word_kernel("blob_select", globals, body)) else { + return; + }; + let std_t = [0u32, 3, 5, 8]; + let pun_t = [0u32, 4, 0x84, 8]; + let want: Vec = (0..16u32) + .flat_map(|t| { + let v = if t % 2 == 1 { std_t } else { pun_t }[(t & 3) as usize]; + [v, t + 1] + }) + .collect(); + for stem in PROFILES { + let prof = p(stem); + l3(&bc, "blob_select", &prof, stem); + let (plan, m) = typed_module(&bc, "blob_select", &prof).expect("module"); + let b = plan + .families + .access + .blob + .as_ref() + .expect("the tables are in the blob"); + let mut res = resources(&plan, 0, 32, 16, &[]); + let mut bytes = b.bytes.to_vec(); + bytes.resize(bytes.len().next_multiple_of(16), 0); + res.buffers.push(Buffer { + slot: Some(ResourceSlot { + stage: Stage::Kernel, + kind: ResourceKind::Synthetic(SyntheticBinding::ConstantBlob), + index: 0, + }), + address: None, + bytes, + }); + assert_eq!(run_both(&m, &res).expect("run"), want, "{stem}"); + } +} + /// Constant `getelementptr`s address their exact displacement from their global: into a threadgroup /// global placed before a second one (in the arena, where a byte read of its words keeps it), /// through a nested aggregate, with a negative index, and into a closed constant global in its