⬆️ Build on metal2vulkan v0.2.0 (d9236a8a11)'s runtime

Moves the runtime from ce54ad8b25 to the v0.2.0 release, d9236a8a11
(RUNTIME_VERSION 2342, SEMANTICS_VERSION 2122, ARTIFACT_FORMAT_VERSION
523). It adds no degradation kind. Two of our tests follow its answers:
the policy's exact forms name its new indirect_records field, and the
two-plane YCbCr argument-buffer write test checks 500 like the other
formats now that the runtime writes those slots through. The accuracy
ledger gains the row for the indirect-records policy.

Checked, at the owner's word, with one cold boot of the x86-64 macOS 26
guest on the RTX 5080 over this tree and vendor/qemu's 2026-11-13 move.
This commit is contained in:
Anees Iqbal committed 2026-11-15 02:35:03 -08:00
1 parent 80a3c295f0
commit b157365a1e
5 files changed
+30 -32

No files matched your search

Generated
-2
View File
@@ -353,10 +353,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d"
dependencies = [
"bitflags",
"libc",
"objc2",
"objc2-core-foundation",
"objc2-foundation",
]
[[package]]
+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 = "ce54ad8b25a3f3da36fffdce268117df43b950d8" }
metal2vulkan-runtime = { git = "https://github.com/steelbrain/metal2vulkan", rev = "d9236a8a11d3b90a1aa27b54e2d74d3891c4d2e5" }
# Its translator, for the Metal enums and descriptor values the runtime's calls take.
metal2vulkan = { git = "https://github.com/steelbrain/metal2vulkan", rev = "ce54ad8b25a3f3da36fffdce268117df43b950d8" }
metal2vulkan = { git = "https://github.com/steelbrain/metal2vulkan", rev = "d9236a8a11d3b90a1aa27b54e2d74d3891c4d2e5" }
# 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
@@ -383,14 +383,14 @@ fn writes_over_surface_planes_are_stored() {
/// Metal's GPU drops on this host, leaves them as they were. A `BGRA8Unorm` texture over a buffer
/// written so completes, its bytes written.
///
/// 500's is checked as the process runs by default, not strict. Where the device's own sampler
/// Y′CbCr conversion reads 500's planes (Iris Xe; the Mac's runtime reads them in place), the
/// dispatch announces `ycbcr-filter-not-exact` for the texture the argument buffer holds, though
/// the kernel only writes it: strict, that dies at the dispatch, and the test takes that death
/// and no other.
/// A kernel that only writes 500's texture announces nothing, so strict too it completes, where
/// the device's own sampler Y′CbCr conversion reads 500's planes (Iris Xe) as where the runtime
/// reads them in place (the Mac): the runtime converts the planes of such a texture only for a
/// command that reads it (its RUNTIME 2312).
#[test]
fn writes_through_argument_buffers_of_two_plane_ycbcr_textures_are_the_slots() {
for (format, ostype, stored) in [
(500, b"420v", false),
(503, b"444v", true),
(523, b"444v", true),
(542, b"444v", true),
@@ -401,20 +401,6 @@ fn writes_through_argument_buffers_of_two_plane_ycbcr_textures_are_the_slots() {
let got = changed(Op::Held, format, ostype, HELD);
assert_eq!(got, Ok(stored), "{format}");
}
let got = crate::answer::relaxed(|| changed(Op::Held, 500, b"420v", HELD));
assert_eq!(got, Ok(false), "500");
match changed(Op::Held, 500, b"420v", HELD) {
Ok(changed) => assert!(!changed, "500 strict"),
Err((site, line)) => {
assert_eq!(
site, "dispatchThreads:threadsPerThreadgroup:",
"500 strict: {line}"
);
let named =
"the Vulkan runtime degraded it (metal2vulkan-degrade-ycbcr-filter-not-exact)";
assert!(line.starts_with(named), "500 strict: {line}");
}
}
let (w, h) = HELD;
let row = 256;
let buffer = (dev().new_buffer_of_length(OnFault::Die, row * h, 0))
+22 -9
View File
@@ -497,13 +497,19 @@ pub(crate) fn device_options() -> &'static rt::DeviceOptions {
/// so a CPU write after the commit never reaches a command buffer committed before it, as on the
/// Radeon Pro 5300M, where the default has the GPU copy the range from the host copy as the
/// submission runs, so such a write may be read, as on the UHD 630 (`managed_copy_in`,
/// `ManagedCopyInPolicy::AtCommit`). [`EXACT_ALL`] names every one. The
/// `ManagedCopyInPolicy::AtCommit`), and an indirect command buffer's records in the runtime's
/// own pages imported by their pointer wherever the device imports host pointers, so a recovery
/// of the device keeps them as the CPU and the GPU left them, as Metal does, where the default
/// lays them in pooled host-visible memory on a device where a held pointer import costs every
/// submission (RADV; ANV on i915), whose recovery loses them and writes them again as a new
/// buffer's (`indirect_records`, `IndirectRecordsPolicy::Carried`). [`EXACT_ALL`] names every
/// one. The
/// policy's `completion` is no name of these: every device takes its exact form
/// ([`exact_policy`]). Nor is its `heap_compression`, whose uncompressed form [`EXACT_ALL`]
/// alone takes. 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; 13] = [
pub const EXACT_FORMS: [&str; 14] = [
"batch_order",
"host_page_textures",
"half_chains",
@@ -517,6 +523,7 @@ pub const EXACT_FORMS: [&str; 13] = [
"heap_answers",
"rate_map_regions",
"managed_copy_in",
"indirect_records",
];
/// The name `REIMS_VGPU_EXACT` takes for the runtime's `DevicePolicy::exact_answers()`: every
@@ -574,8 +581,9 @@ fn exact_policy(exact: Option<&str>) -> metal2vulkan::device::DevicePolicy {
use metal2vulkan::device::{
BatchOrderPolicy, CompletionPolicy, DevicePolicy, DontCareColorPolicy,
ExtendedRangeBlitPolicy, HalfChainPolicy, HeapAnswerPolicy, HostPageTexturePolicy,
ManagedCopyInPolicy, PipelineWaitPolicy, QueueSharingPolicy, RateMapRegionPolicy,
UnstoredDontCarePolicy, VertexReachPolicy, WideLinePolicy, YCbCrInPlacePolicy,
IndirectRecordsPolicy, ManagedCopyInPolicy, PipelineWaitPolicy, QueueSharingPolicy,
RateMapRegionPolicy, UnstoredDontCarePolicy, VertexReachPolicy, WideLinePolicy,
YCbCrInPlacePolicy,
};
let mut policy = DevicePolicy::default();
policy.completion = CompletionPolicy::Exact;
@@ -600,6 +608,7 @@ fn exact_policy(exact: Option<&str>) -> metal2vulkan::device::DevicePolicy {
"heap_answers" => policy.heap_answers = HeapAnswerPolicy::Metal,
"rate_map_regions" => policy.rate_map_regions = RateMapRegionPolicy::Exact,
"managed_copy_in" => policy.managed_copy_in = ManagedCopyInPolicy::AtCommit,
"indirect_records" => policy.indirect_records = IndirectRecordsPolicy::Carried,
other => {
let line = format!(
"reims-vgpu: REIMS_VGPU_EXACT names {other:?}, none of {EXACT_ALL}, {}: \
@@ -873,9 +882,9 @@ pub(crate) mod tests {
use metal2vulkan::device::{
BatchOrderPolicy, CompletionPolicy, DevicePolicy, DontCareColorPolicy,
ExtendedRangeBlitPolicy, HalfChainPolicy, HeapAnswerPolicy, HeapCompressionPolicy,
HostPageTexturePolicy, ManagedCopyInPolicy, PipelineWaitPolicy, QueueSharingPolicy,
RateMapRegionPolicy, UnstoredDontCarePolicy, VertexReachPolicy, WideLinePolicy,
YCbCrInPlacePolicy,
HostPageTexturePolicy, IndirectRecordsPolicy, ManagedCopyInPolicy, PipelineWaitPolicy,
QueueSharingPolicy, RateMapRegionPolicy, UnstoredDontCarePolicy, VertexReachPolicy,
WideLinePolicy, YCbCrInPlacePolicy,
};
let runtimes = DevicePolicy::default();
assert_eq!(runtimes.completion, CompletionPolicy::Grouped);
@@ -900,6 +909,7 @@ pub(crate) mod tests {
assert_eq!(fast.vertex_reach, VertexReachPolicy::Bounded);
assert_eq!(fast.rate_map_regions, RateMapRegionPolicy::FanOut);
assert_eq!(fast.managed_copy_in, ManagedCopyInPolicy::AtSubmission);
assert_eq!(fast.indirect_records, IndirectRecordsPolicy::Untaxed);
for unchanged in [
None,
Some(""),
@@ -915,7 +925,7 @@ pub(crate) mod tests {
}
let one = |name| exact_policy(Some(name));
type Set = fn(&mut DevicePolicy);
let alone: [(&str, Set); 13] = [
let alone: [(&str, Set); 14] = [
("batch_order", |p| p.batch_order = BatchOrderPolicy::Exact),
("host_page_textures", |p| {
p.host_page_textures = HostPageTexturePolicy::Shadow;
@@ -949,6 +959,9 @@ pub(crate) mod tests {
("managed_copy_in", |p| {
p.managed_copy_in = ManagedCopyInPolicy::AtCommit;
}),
("indirect_records", |p| {
p.indirect_records = IndirectRecordsPolicy::Carried;
}),
];
assert_eq!(alone.map(|(name, _)| name), EXACT_FORMS);
let mut every = fast;
@@ -961,7 +974,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,rate_map_regions,managed_copy_in";
vertex_reach,heap_answers,rate_map_regions,managed_copy_in,indirect_records";
assert_eq!(exact_policy(Some(named)), every);
assert_eq!(exact_policy(Some(&EXACT_FORMS.join(","))), every);
assert_eq!(every.heap_compression, HeapCompressionPolicy::Compressed);
+1
View File
@@ -74,6 +74,7 @@ of 25).
| 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) |
| A Managed buffer's range the guest names modified (`didModifyRange:`) copied into the device's copy by the GPU, from the buffer's host copy (the import of the guest's pages), as the command buffer's submission runs, with no CPU copy | `managed_copy_in` (the range copied on the CPU into staging memory at the commit, as the host copy holds it then) | a CPU write of the range after the commit, before the GPU runs the command buffer, may be read by it, as on the UHD 630 (metal2vulkan's lane measured both oracles: the Radeon Pro 5300M keeps the commit's bytes, the UHD 630 reads the later write) | a CPU copy of the range's bytes at each commit; not measured on the 5080 |
| An indirect command buffer's records, on a device where a held pointer import costs every submission (RADV; ANV on i915), laid in pooled host-visible memory, as the runtime's other buffers lie there; elsewhere in the runtime's own pages imported by their pointer | `indirect_records` (the records in the runtime's own pages imported by their pointer wherever the device imports host pointers) | a recovery of such a device loses the records with its `VkDevice` and writes them again as a new buffer's, its header and every command reset, where Metal keeps them; the `device-recovered` notice counts such buffers | the held import in every submission while the buffer lives: on the Radeon 780M (Mesa 26.2.6, Linux 7.3.3) windows of 65 to 140 ms in which every submission waited or failed with `EAGAIN` while the kernel's compaction moved the records' pages (metal2vulkan's `IndirectRecordsPolicy`); not measured on the 5080 |
| 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 |