From 7be9f00a3f684c2a9d4b560a2138ac9c53a2d22c Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 3 Dec 2026 00:23:31 -0800 Subject: [PATCH] Docs: only tests build the resident-table domains The docs of DevicePolicy::RESIDENT_TABLES, PointerDomain::ResidentTable, HandleDomain::Table, the lockstep module, docs/API.md and three test comments said the resident form was the validation executor's alone and that the executor builds the resident root and handle table itself, or called it "the old runtime's, until the cutover deletes it". Neither is true: the validation executor (engine.rs), the runtime, the command line and the compile worker all build their device under DevicePolicy::default(), and every RESIDENT_TABLES in the tree sits in a test (the translator's src/tests and device tests, the validation crate's #[cfg(test)] modules including coverage::tier_table, the harness's tests and the validation integration tests). The comments now say that: nothing outside tests builds the form, and the runtime, the tools and the validation executor take the default. Comments and docs only; no code changes. Verified: git grep of RESIDENT_TABLES, PointerDomain::ResidentTable and HandleDomain::Table at 8140229b9c, each hit outside the translator's own tests read for its #[cfg(test)] scope; cargo fmt --all; the workspace rustdoc check with -D warnings, doc 0 and private-items doc 0 on all seven crates (job m3-max-82621). --- crates/metal2vulkan-runtime/src/tests/one_path.rs | 4 ++-- .../metal2vulkan-validation/src/companion/tests.rs | 4 ++-- .../src/specialization/attempt.rs | 6 +++--- crates/metal2vulkan/src/device/policy.rs | 14 +++++++------- crates/metal2vulkan/src/device/profile.rs | 14 +++++++------- crates/metal2vulkan/src/lower/simd/lockstep.rs | 4 ++-- docs/API.md | 6 +++--- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/one_path.rs b/crates/metal2vulkan-runtime/src/tests/one_path.rs index cb85a13cd..f6585b89b 100644 --- a/crates/metal2vulkan-runtime/src/tests/one_path.rs +++ b/crates/metal2vulkan-runtime/src/tests/one_path.rs @@ -159,8 +159,8 @@ const ALLOWED: &[(&str, &str)] = &[ "metal2vulkan/src/device/khronos.rs", "desc.device_type = p.enum_value(\"deviceType\", vk::PhysicalDeviceType::from_name)?;", ), - // The translator's `DevicePolicy`: its default is the runtime's, and its one other value the - // validation executor's. + // The translator's `DevicePolicy`: its default is the runtime's, and its one other value only + // tests build. ( "metal2vulkan/src/device/policy.rs", "pub struct DevicePolicy {", diff --git a/crates/metal2vulkan-validation/src/companion/tests.rs b/crates/metal2vulkan-validation/src/companion/tests.rs index 2f070afa2..4b855120e 100644 --- a/crates/metal2vulkan-validation/src/companion/tests.rs +++ b/crates/metal2vulkan-validation/src/companion/tests.rs @@ -867,8 +867,8 @@ fn an_integer_observation_takes_its_sign_from_the_target() { } /// Every companion links with the stage it completes in one engine render pipeline: by user -/// key, at the types the two sides state. Under the resident-table domains, the executor's own -/// context's, which compile the mesh and object stages the identity domains refuse. +/// key, at the types the two sides state. Under the resident-table domains, which compile the +/// mesh and object stages the identity domains refuse. #[test] fn generated_companions_link_with_their_cases_in_the_engine() { use metal2vulkan::library::Library; diff --git a/crates/metal2vulkan-validation/src/specialization/attempt.rs b/crates/metal2vulkan-validation/src/specialization/attempt.rs index 110ae93bc..58b575dc4 100644 --- a/crates/metal2vulkan-validation/src/specialization/attempt.rs +++ b/crates/metal2vulkan-validation/src/specialization/attempt.rs @@ -884,9 +884,9 @@ mod tests { replay_specialized(bitcode, entry, constants, &profile, None, None).attempt } - /// `description`'s profile under the resident-table domains, the executor's own context's: the - /// inputs the binder supplies (a storage texture's format, a tile function's member formats) - /// are theirs, and the identity domains refuse what needs them. + /// `description`'s profile under the resident-table domains: the inputs the binder supplies (a + /// storage texture's format, a tile function's member formats) are theirs, and the identity + /// domains refuse what needs them. fn resident_tables( description: metal2vulkan::device::DeviceDescription, ) -> metal2vulkan::device::DeviceProfile { diff --git a/crates/metal2vulkan/src/device/policy.rs b/crates/metal2vulkan/src/device/policy.rs index fe64df91e..a6d19835b 100644 --- a/crates/metal2vulkan/src/device/policy.rs +++ b/crates/metal2vulkan/src/device/policy.rs @@ -7,24 +7,24 @@ use crate::device::profile::{HandleDomain, PointerDomain}; /// carries it and its fingerprint covers it. /// /// [`DevicePolicy::default`] is the one constructor: the runtime compiles under it, and the -/// command line, the compile worker and every validation tool take their policy from it, so a -/// tool compiles what the runtime does. [`DevicePolicy::RESIDENT_TABLES`] is the validation -/// executor's alone. +/// command line, the compile worker, the validation executor and every validation tool take +/// their policy from it, so a tool compiles what the runtime does. Nothing in the tree builds +/// [`DevicePolicy::RESIDENT_TABLES`] outside tests. #[non_exhaustive] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct DevicePolicy { /// How pointer values resolve to resources: `Identity` with `handle_domain` `Identity` (the - /// default), or `ResidentTable` with `Table` (the validation executor's). + /// default), or `ResidentTable` with `Table` (`RESIDENT_TABLES`, which only tests build). pub pointer_domain: PointerDomain, /// How resource handles resolve: `Identity` with `pointer_domain` `Identity` (the default), or - /// `Table` with `ResidentTable` (the validation executor's). + /// `Table` with `ResidentTable` (`RESIDENT_TABLES`, which only tests build). pub handle_domain: HandleDomain, } impl DevicePolicy { - /// A resident table of pointers and a handle table, for the validation executor alone, which - /// builds the resident root and the handle table itself. + /// A resident table of pointers and a handle table. Nothing in the tree builds it outside + /// tests: the runtime, the tools and the validation executor take the default. pub const RESIDENT_TABLES: DevicePolicy = DevicePolicy { pointer_domain: PointerDomain::ResidentTable, handle_domain: HandleDomain::Table, diff --git a/crates/metal2vulkan/src/device/profile.rs b/crates/metal2vulkan/src/device/profile.rs index 4ad135a87..a07eb3e3f 100644 --- a/crates/metal2vulkan/src/device/profile.rs +++ b/crates/metal2vulkan/src/device/profile.rs @@ -489,10 +489,10 @@ pub enum BufferAccess { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum PointerDomain { - /// The sorted resident set of bound arguments and used resources. It exists for the - /// validation executor only - /// ([`DevicePolicy::RESIDENT_TABLES`](crate::device::DevicePolicy::RESIDENT_TABLES)), which - /// builds the resident root itself. + /// The sorted resident set of bound arguments and used resources. Nothing in the tree + /// builds it outside tests + /// ([`DevicePolicy::RESIDENT_TABLES`](crate::device::DevicePolicy::RESIDENT_TABLES)): the + /// runtime, the tools and the validation executor take `Identity`. ResidentTable, /// Pointers are device addresses used directly: a `device` or `constant` pointer is the /// 64-bit Vulkan device address of the byte it names, as Metal's `gpuAddress` is, and a @@ -511,9 +511,9 @@ pub enum PointerDomain { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum HandleDomain { - /// The handle table plus the set-1 heap. It exists for the validation executor only - /// ([`DevicePolicy::RESIDENT_TABLES`](crate::device::DevicePolicy::RESIDENT_TABLES)), which - /// builds the handle table itself. + /// The handle table plus the set-1 heap. Nothing in the tree builds it outside tests + /// ([`DevicePolicy::RESIDENT_TABLES`](crate::device::DevicePolicy::RESIDENT_TABLES)): the + /// runtime, the tools and the validation executor take `Identity`. Table, /// A texture's or sampler's handle is its `gpuResourceID`: the low 32 bits index the /// pipeline's descriptor arrays and the high 32 bits are the word of its Metal descriptor diff --git a/crates/metal2vulkan/src/lower/simd/lockstep.rs b/crates/metal2vulkan/src/lower/simd/lockstep.rs index 94eca3571..c3d4f0618 100644 --- a/crates/metal2vulkan/src/lower/simd/lockstep.rs +++ b/crates/metal2vulkan/src/lower/simd/lockstep.rs @@ -1,8 +1,8 @@ //! Lockstep made explicit (device memory too): barriers that order the threadgroup-memory and //! device-memory accesses a kernel leaves to the lockstep of Apple's simdgroups. //! -//! **Where it runs.** Under the resident-table domains, the old runtime's, until the cutover -//! deletes it. Under the identity domains (`lower::access::identity`, the runtime's) no kernel +//! **Where it runs.** Under the resident-table domains, which nothing in the tree builds outside +//! tests. Under the identity domains (`lower::access::identity`, the runtime's) no kernel //! is ordered ([`OrderKey::of`]'s key orders nothing): documented Metal orders the threads of a //! simdgroup only through barriers and atomics, and calls their conflicting accesses between //! barriers a data race (docs/API.md, accepted differences). The pairs are still found there, and diff --git a/docs/API.md b/docs/API.md index 0bc5f0755..4a335ee7e 100644 --- a/docs/API.md +++ b/docs/API.md @@ -345,9 +345,9 @@ and so do the command line, the compile worker and every validation tool. It hol the bind offset to be a multiple of that alignment. Every render stage keeps addresses. Of the committed profiles, lavapipe's (a `maxStorageBufferRange` of 128 MiB) answers no. - **The resident-table domains** (`DevicePolicy::RESIDENT_TABLES`: `PointerDomain::ResidentTable` - with `HandleDomain::Table`) exist for the validation executor alone, which builds the resident - root and the handle table itself. Besides it, only the translator's own tests of that lowering - compile under them. + with `HandleDomain::Table`) are built only by tests: the translator's own tests of that + lowering and some validation tests compile under them. The runtime, the command line, the + compile worker and the validation executor take the default. Loops run as written: no execution bound is translated in.