⬆️ Build on metal2vulkan 63232a93ee's runtime

Pin 62 moves metal2vulkan from 0c0cdf0b12 (RUNTIME_VERSION 2165,
SEMANTICS_VERSION 2064, ARTIFACT_FORMAT_VERSION 509) to 63232a93ee (2176,
SEMANTICS_VERSION 2072, ARTIFACT_FORMAT_VERSION 512), the golden tables
and the authored compile census re-blessed. It carries:
- a device recovery carrying the textures of new_texture (made new, their
  contents lost; those over carried buffers keep their bytes), binary
  archives and dynamic libraries, compute, tile, render and mesh pipeline
  states (made again from what their creations compiled; a bind of one
  whose making failed is refused, RemadeAfterRecoveryFailed), sampler
  states, Private buffers in exportable memory (over their own memory,
  not zeroed), and no-copy heaps with the buffers and textures placed in
  them (2166-2170, 2173, 2174, 2176);
- every batch the lost generation still holds failed as GpuRecoveryVictim
  in commit order, and a queue's new place running its handlers only after
  the old place's, so no command buffer committed around a recovery waits
  for good (2172);
- a Managed buffer's didModifyRange bytes reaching only the command buffer
  that committed them and later ones, on a device whose memory is not the
  host's (2171);
- a rate-mapped pass recorded at the host step drawing each command that
  is safe to fan out once, with a copy per region it touches, where it drew
  it once per region (SEMANTICS 2072, RUNTIME 2175; REIMS_VGPU_EXACT's new
  name rate_map_regions keeps every draw region by region, and the
  accuracy ledger has its row);
- a 16-byte vector access placed at its address unless its offset is
  proven a multiple of 16, as Metal places it: a float4 read through a
  float pointer only 4-byte aligned read k floats low (Geekbench 7 Metal's
  workload 302 softmax rows) (SEMANTICS 2069), and the reach of a pointer
  through a base not yet reached kept unknown (SEMANTICS 2070), which
  6164d3a66a's tree took as reached and so refused 124 MPS NDArray kernels
  of an Iris Xe's pipeline records that 0c0cdf0b12 made;
- flat simdgroups, the rate map's fan-out variant, generic pointers and
  matmul2d's macOS 27 runs (SEMANTICS 2065-2068, 2071).

The runtime's objects answer their device as an owned handle of the
generation serving them, not a borrow: six call sites here take a
reference to it, and two fence devices drop a clone that is now one.
No degradation kind changes. RuntimeGap gains RemadeAfterRecoveryFailed,
which a bind answers as it answers MadeBeforeRecovery.

What the guest sees changes: after a device recovery, pipeline and
sampler states, exportable Private buffers and no-copy heaps made before
it serve again, and command buffers committed around it complete; Managed
buffers' modified bytes on a dGPU reach only their own and later command
buffers; rate-mapped passes take far less GPU time; and kernels reading
16-byte vectors at addresses not 16-aligned read what Metal reads. The
device's answers do not change.

Cargo.lock keeps its lines.
This commit is contained in:
Anees Iqbal committed 2026-11-12 18:55:13 -08:00
1 parent 5565153337
commit a4b6ade41b
7 files changed
+36 -23

No files matched your search

+2 -2
View File
@@ -33,9 +33,9 @@ reims-vgpu-graphics = { path = "crates/reims-vgpu-graphics" }
reims-vgpu-video = { path = "crates/reims-vgpu-video" }
# The Vulkan platform's runtime (architecture D1): a Metal-shaped API on Vulkan, from
# metal2vulkan's public repository at the commit both name.
metal2vulkan-runtime = { git = "https://github.com/steelbrain/metal2vulkan", rev = "0c0cdf0b12948012474abe97dabc475e145a53a3" }
metal2vulkan-runtime = { git = "https://github.com/steelbrain/metal2vulkan", rev = "63232a93eeabe92184e4a4aac73156e413f9c6e7" }
# Its translator, for the Metal enums and descriptor values the runtime's calls take.
metal2vulkan = { git = "https://github.com/steelbrain/metal2vulkan", rev = "0c0cdf0b12948012474abe97dabc475e145a53a3" }
metal2vulkan = { git = "https://github.com/steelbrain/metal2vulkan", rev = "63232a93eeabe92184e4a4aac73156e413f9c6e7" }
# The hashes of the Vulkan platform's metallib sources (reims-vgpu-vulkan/build.rs).
sha2 = "0.10.9"
# A display window's swapchain on Linux (reims-vgpu-vulkan/src/swapchain.rs), at the runtime's
+3 -3
View File
@@ -58,7 +58,7 @@ impl std::fmt::Debug for Generation {
/// The generation of `device`'s line that serves now: the device of a fence made on it.
fn generation_serving(device: &rt::Device) -> rt::Device {
device.new_fence().device().clone()
device.new_fence().device()
}
/// The `VkDevice` of `generation`, a generation handle (an object's device, or one
@@ -173,7 +173,7 @@ mod tests {
let before = device.new_fence();
// The runtime carries a fence across a recovery, so its `device()` later answers the
// generation it was carried to: the handle taken now is the old generation's.
let before_device = before.device().clone();
let before_device = before.device();
assert!(first.is_of(&before_device));
device.recover_for_test().expect("the recovery");
@@ -195,7 +195,7 @@ mod tests {
Some(second.queue)
);
let after = device.new_fence();
assert!(second.is_of(after.device()));
assert!(second.is_of(&after.device()));
assert!(!second.is_of(&before_device));
// The old generation's handles still answer its own `VkDevice` while it is held.
// SAFETY: only the handle is read, while `first` lives.
+2 -2
View File
@@ -1319,7 +1319,7 @@ impl Buffer<VulkanPlatform> for VulkanBuffer {
)
}
})?;
made.made(self.raw.device());
made.made(&self.raw.device());
Ok(())
},
)
@@ -2125,7 +2125,7 @@ impl Heap<VulkanPlatform> for VulkanHeap {
)
}
})?;
made.made(self.raw.device());
made.made(&self.raw.device());
Ok(())
},
)
@@ -814,7 +814,7 @@ fn destination(
) -> Result<(vk::Buffer, u64), CopyError> {
let refused = |why: String| CopyError::Refused(why);
let buffer = &copy.to.raw;
if !generation.is_of(buffer.device()) {
if !generation.is_of(&buffer.device()) {
return Err(refused(
"the buffer was made on the device's VkDevice before its recovery".to_owned(),
));
@@ -963,7 +963,7 @@ mod tests {
);
let objects = copier.objects.as_ref().expect("the copier's objects");
assert!(objects.generation.serves(&copier.queue));
assert!(objects.generation.is_of(device.raw.new_fence().device()));
assert!(objects.generation.is_of(&device.raw.new_fence().device()));
assert!(copier.copy(&[], Box::new(())).is_ok());
assert_eq!(copier.generations(), 2, "made again once");
}
+25 -13
View File
@@ -465,12 +465,17 @@ pub(crate) fn device_options() -> &'static rt::DeviceOptions {
/// size and alignment answered by Metal's own model, the texture refitted to an image that fits
/// that answer or kept as a shadow of Metal's tiles, where the default answers the larger of
/// Metal's model and the device's image and lays the texture in that image (`heap_answers`,
/// `HeapAnswerPolicy::Metal`). [`EXACT_ALL`] names every one. The policy's `completion` and
/// `heap_compression` are no names of these: every device takes their exact forms
/// ([`exact_policy`]). The rest of Metal's values the runtime answers
/// with the device's own arithmetic, sampling and conversions, each difference a precision note
/// it records, with no exact form to name.
pub const EXACT_FORMS: [&str; 11] = [
/// `HeapAnswerPolicy::Metal`), and a rasterization-rate-mapped pass's draws drawn region by
/// region, each running its vertex function once per region of the map, where the default draws
/// once each draw a host step records that the runtime's probe finds safe, a geometry stage
/// emitting a copy of each triangle for each region it touches, so a pixel centre within a
/// rounding error of a triangle's edge may be covered by one route and not the other
/// (`rate_map_regions`, `RateMapRegionPolicy::Exact`). [`EXACT_ALL`] names every one. The
/// policy's `completion` and `heap_compression` are no names of these: every device takes their
/// exact forms ([`exact_policy`]). The rest of Metal's values the runtime answers with the
/// device's own arithmetic, sampling and conversions, each difference a precision note it
/// records, with no exact form to name.
pub const EXACT_FORMS: [&str; 12] = [
"batch_order",
"host_page_textures",
"half_chains",
@@ -482,6 +487,7 @@ pub const EXACT_FORMS: [&str; 11] = [
"unstored_dont_care_loads",
"vertex_reach",
"heap_answers",
"rate_map_regions",
];
/// The name `REIMS_VGPU_EXACT` takes for the runtime's `DevicePolicy::exact_answers()`: every
@@ -519,14 +525,15 @@ pub const EXACT_ALL: &str = "all";
/// pipeline until it is made, `wide_lines`' band variant of each pipeline that draws a line
/// the device's own lines would draw otherwise than Metal, `extended_range_blits`' rewrite of
/// each extended-range blit to Metal's encoding, and `heap_answers`' heap texture sizes and
/// alignments by Metal's model. A name of neither changes nothing,
/// alignments by Metal's model, and `rate_map_regions`' region-by-region draws of each
/// rate-mapped pass. A name of neither changes nothing,
/// and a line on stderr says so.
fn exact_policy(exact: Option<&str>) -> metal2vulkan::device::DevicePolicy {
use metal2vulkan::device::{
BatchOrderPolicy, CompletionPolicy, DevicePolicy, DontCareColorPolicy,
ExtendedRangeBlitPolicy, HalfChainPolicy, HeapAnswerPolicy, HeapCompressionPolicy,
HostPageTexturePolicy, PipelineWaitPolicy, QueueSharingPolicy, UnstoredDontCarePolicy,
VertexReachPolicy, WideLinePolicy, YCbCrInPlacePolicy,
HostPageTexturePolicy, PipelineWaitPolicy, QueueSharingPolicy, RateMapRegionPolicy,
UnstoredDontCarePolicy, VertexReachPolicy, WideLinePolicy, YCbCrInPlacePolicy,
};
let mut policy = DevicePolicy::default();
policy.completion = CompletionPolicy::Exact;
@@ -550,6 +557,7 @@ fn exact_policy(exact: Option<&str>) -> metal2vulkan::device::DevicePolicy {
}
"vertex_reach" => policy.vertex_reach = VertexReachPolicy::Exact,
"heap_answers" => policy.heap_answers = HeapAnswerPolicy::Metal,
"rate_map_regions" => policy.rate_map_regions = RateMapRegionPolicy::Exact,
other => {
let line = format!(
"reims-vgpu: REIMS_VGPU_EXACT names {other:?}, none of {EXACT_ALL}, {}: \
@@ -851,8 +859,8 @@ pub(crate) mod tests {
use metal2vulkan::device::{
BatchOrderPolicy, CompletionPolicy, DevicePolicy, DontCareColorPolicy,
ExtendedRangeBlitPolicy, HalfChainPolicy, HeapAnswerPolicy, HeapCompressionPolicy,
HostPageTexturePolicy, PipelineWaitPolicy, QueueSharingPolicy, UnstoredDontCarePolicy,
VertexReachPolicy, WideLinePolicy, YCbCrInPlacePolicy,
HostPageTexturePolicy, PipelineWaitPolicy, QueueSharingPolicy, RateMapRegionPolicy,
UnstoredDontCarePolicy, VertexReachPolicy, WideLinePolicy, YCbCrInPlacePolicy,
};
let runtimes = DevicePolicy::default();
assert_eq!(runtimes.completion, CompletionPolicy::Grouped);
@@ -875,6 +883,7 @@ pub(crate) mod tests {
UnstoredDontCarePolicy::Driver
);
assert_eq!(fast.vertex_reach, VertexReachPolicy::Bounded);
assert_eq!(fast.rate_map_regions, RateMapRegionPolicy::FanOut);
for unchanged in [
None,
Some(""),
@@ -890,7 +899,7 @@ pub(crate) mod tests {
}
let one = |name| exact_policy(Some(name));
type Set = fn(&mut DevicePolicy);
let alone: [(&str, Set); 11] = [
let alone: [(&str, Set); 12] = [
("batch_order", |p| p.batch_order = BatchOrderPolicy::Exact),
("host_page_textures", |p| {
p.host_page_textures = HostPageTexturePolicy::Shadow;
@@ -918,6 +927,9 @@ pub(crate) mod tests {
p.vertex_reach = VertexReachPolicy::Exact;
}),
("heap_answers", |p| p.heap_answers = HeapAnswerPolicy::Metal),
("rate_map_regions", |p| {
p.rate_map_regions = RateMapRegionPolicy::Exact;
}),
];
assert_eq!(alone.map(|(name, _)| name), EXACT_FORMS);
let mut every = fast;
@@ -930,7 +942,7 @@ pub(crate) mod tests {
}
let named = " half_chains,wide_lines,pipeline_waits,host_page_textures , batch_order,\
queue_sharing,extended_range_blits,dont_care_colors,unstored_dont_care_loads,\
vertex_reach,heap_answers";
vertex_reach,heap_answers,rate_map_regions";
assert_eq!(exact_policy(Some(named)), every);
assert_eq!(exact_policy(Some(&EXACT_FORMS.join(","))), every);
assert_eq!(one(EXACT_ALL), fast.exact_answers());
+1 -1
View File
@@ -1355,7 +1355,7 @@ impl Swapchain {
};
// A recovery as the texture was made puts it on the new `VkDevice`, over an image of
// the old one.
if !self.generation.is_of(texture.device()) {
if !self.generation.is_of(&texture.device()) {
drop(texture);
return Err(undo(
images,
+1
View File
@@ -62,6 +62,7 @@ samplers, the default filter, `YCBCR10_420_2P` under every mode).
| A colour attachment of a texture's own image that a pass stores `DontCare` stored as the driver stores it: `DONT_CARE` on a driver measured to keep one of Metal's two answers (the texels before the pass, or the rendered ones) or to store as Metal's own, else `STORE`, the rendered texels, Metal's answer where its tiler overflows; announced `dont-care-store` at the first such pass a driver does not store as Metal's own | `dont_care_colors` (the pass renders through a backing its command queue keeps, so the texture keeps the texels it held before the pass, as Apple's GPU leaves them) | the texels a `DontCare` store leaves: Metal's documentation leaves them open, and Apple's GPU keeps the earlier ones unless its tiler overflows | a `Load` pass's copy into the backing, about 19 us a pass at 1920x1080 and 10 us at 256x256 (metal2vulkan's measure); a `Clear` or `DontCare` load about none |
| An attachment (not memoryless; an aspect of separate depth and stencil textures in the scratch image the pass renders them through) that a pass loads `DontCare` and does not store, in a pass whose draws reach a tile, left to the driver's `DONT_CARE` load on a driver not measured to clear it no slower, and cleared, Metal's answer, on one that is (MoltenVK on the M3 Max, RADV on the Radeon 780M); announced `dont-care-unstored-load` once per device where it is left | `unstored_dont_care_loads` (cleared over the render area on every device, by the pass's first render pass instance's load, or before the pass where that instance leaves the attachment out) | what the pass's draws read of the attachment: what the driver's `DONT_CARE` load leaves (lavapipe: its earlier texels), where an M3 Max's draws read zero (a colour) or the clear value (depth, stencil) (metal2vulkan's `runtime_lane::dont_care_unstored`); the pass stores none of it | 3.2 µs of GPU time a frame of eight 3648x2038 passes (74.4 and 74.6 µs against 71.2 and 71.4); on ANV's Iris Xe 29 to 785 µs a frame more (metal2vulkan's measure) |
| A vertex buffer layout a draw fetches in fixed function where its `uint` indices or indirect arguments state how far it fetches, on a driver whose fixed-function vertex input takes an element's displacement modulo 2^32 (lavapipe): kept in fixed function; a layout whose reach the draw's own values bound is pulled where that reach passes 2^32, and reads zero; announced `vertex-fetch-may-wrap` once per device where a draw is left so | `vertex_reach` (such a layout pulled too, the pipeline's pulled-vertex-buffer variant, so every element reads Metal's bytes) | an element 2^32 bytes or more past the buffer's bind offset reads the bytes at its displacement's low 32 bits, where Metal reads zero past a buffer that ends before them (metal2vulkan's `runtime_lane::far_vertex_fetches`); every other driver reads zero under either value | none on the 5080 (the defect is lavapipe's); on lavapipe a pass of one draw of 65,536 `uint`-indexed points takes 2.3 to 2.8 times as long pulled, and the state makes a second pipeline (metal2vulkan's measure) |
| A rasterization-rate-mapped pass's draw that a host step records (an execution whose records the GPU writes), on a device with `geometryShader`, `shaderClipDistance` and `vertexPipelineStoresAndAtomics`: drawn once, a geometry stage emitting a copy of each triangle for each region of the map it touches through one viewport over the whole target, clip distances keeping each copy to its region's pixels; a probe submitted first sends a draw a triangle of which crosses `w = 0` or touches more regions than the copies hold region by region, as every other draw is | `rate_map_regions` (every draw region by region, its vertex function run once per region) | a pixel centre within a rounding error of a triangle's edge covered by one route and not the other: a copy's window coordinates are the region viewport's computed in the geometry stage | not measured on the 5080; on an RTX 3090 a guest-sized pass of 117 pieces takes 332 ms of GPU region by region and 174 ms fanned out (metal2vulkan's lane, m3-max-23744) |
| An extended-range blend source rounded as a loaded colour | none yet: parked (the 5080 effort first; no 5080 boot reaches it) | 1 code | not measured |
| Bicubic near-tie rounding | none yet: parked (the 5080 effort first; no 5080 boot reaches it) | 1 grid step (1/4080) within 2^-21 of a tie | not measured |