Translator docs: the nine private links G1 left unresolved say what the one form does

What: rustdoc's private pass (cargo doc -p metal2vulkan --all-features
--no-deps --document-private-items, -D warnings) found nine links to items
G1 deleted. Each sentence is rewritten to what is true now; nothing is
re-added or re-exported.
- lower/access/dynamic.rs: the module doc's wide pointers are the device
  address they hold (a u64, their Metal address), a wide parameter its
  slot's address read where it is needed; the root table, resident-set
  search, sink and containment paragraphs go, and loads, stores, compares,
  null constants, atomics and memory intrinsics through a wide pointer are
  described at the address, unchecked. param_value's doc says it reads the
  slot's address (emit_entry is gone).
- lower/access/handle.rs: a heap texture handle is the resource ID's index
  masked below the set-1 arrays' length, with the alpha flag and the
  texture-buffer word bits where the function uses them, and a heap
  sampler handle is its resource ID with an out-of-range index replaced by
  0; no handle or sampler table is searched (HandleTable::lookup is gone).
- lower/access/psb.rs: Reach::Rounded is the 4-aligned address PsbMem::at
  takes, for a wide pointer's access and a function table's entry
  (psb::prepare is gone).
- lower/sampler/bicubic.rs: an 8-bit sRGB texture's bicubic taps are the
  device's decode through the slot's sRGB view (the raw-code path behind
  Bicubic::raw is gone).
- lower/texture/emit.rs: the three swizzle helpers name swizzle_lanes,
  whose doc now states the swizzle word's fields (swizzled is gone).

runtime-sources.sha256 does not move: none of these files is a pinned
runtime source.

Verified by job m3-max-84530 at this commit's tree: the private pass
(RUSTDOCFLAGS=-Dwarnings, CARGO_TERM_COLOR=never, cargo doc -p <crate>
--all-features --no-deps --document-private-items) is EXIT=0 with 0
diagnostics for each of metal2vulkan, metal2vulkan-air,
metal2vulkan-runtime, metal2vulkan-validation, metal2vulkan-conformance,
metal2vulkan-devtools and metal2vulkan-harness, and the public rustdoc
(cargo doc --workspace --all-features --no-deps, -D warnings) is EXIT=0.
At the parent, job m3-max-84501 listed the nine (metal2vulkan EXIT=101,
9 diagnostics; every other crate 0).
This commit is contained in:
Anees Iqbal committed 2026-12-03 09:35:53 -08:00
1 parent 7e0f98c09d
commit da29ee6b55
5 files changed
+60 -89

No files matched your search

+30 -59
View File
@@ -1,65 +1,39 @@
//! Dynamic buffer roots and stored pointers.
//!
//! **Wide pointers.** A buffer pointer whose root set meets the component of the dynamic root
//! (`memory::roots`) is the wide fat pointer `u64vec4(root, at, host, size)`: `root` indexes the
//! root table (0 null or a resident-set miss, `2 + n` for `[[buffer(n)]]`, `R0 + k` for resident
//! entry `k`), `at` is the Metal displacement from the allocation's start (the entry's
//! `bind_offset` plus the displacement from it) in wrapping 64-bit arithmetic (exact, unlike a
//! static pointer's `u32` offset), and `host` and `size` are the entry's, read once where the
//! pointer is formed, so no access reads the root table: a driver that cannot prove a store
//! leaves the table alone would read it again after every store. A parameter is `(2 + n,
//! bind_offset, host, size)` of its entry, read in the function's first block ([`emit_entry`]); a
//! GEP adds its 64-bit datalayout offset to `at` (`access::gep_offset_wide`, reading indices
//! through the index-extension rule, and extending each by its [`IndexForm`]); casts and `freeze`
//! copy the vector and `select` selects it. The root table is read-only to the dispatch: the binder
//! writes it before submission and no lowering stores to it, so a field read where the pointer is
//! formed is the field an access would read.
//! (`memory::roots`) is a wide pointer: the device address of the byte it names, a `u64`
//! (`DemoteTy::Address`), which is also its Metal address. A wide buffer parameter is its slot's
//! address (`SlotGuestBase`, the bias added back), read where it is needed ([`param_value`]); a
//! GEP adds its 64-bit datalayout offset to the address in wrapping arithmetic
//! (`access::gep_offset_wide`, reading indices through the index-extension rule, and extending
//! each by its [`IndexForm`]); casts and `freeze` copy it and `select` selects it.
//!
//! **Where dynamic roots come from.** A load of a device or constant pointer from memory reads
//! its 8-byte guest address (stored pointers are guest addresses): from a buffer through a static
//! its 8-byte Metal address (stored pointers are Metal addresses): from a buffer through a static
//! or a wide pointer, or from a **pointer cell** in the threadgroup arena or an open one in the
//! private arena (an alloca holding a pointer is an arena object, never typed; a closed private
//! cell forwards its pointers instead, `access::cell`); and `inttoptr` takes one from an `i64`. The
//! resident-set search (`memory::roots::resolve_wide`) turns the address into `(root, i − guest,
//! host, size)` of the entry that holds it, a miss into `(0, i, 0, 0)` (the null root's fields).
//! cell forwards its pointers instead, `access::cell`); and `inttoptr` takes one from an `i64`.
//! The loaded word or the `inttoptr` operand is the pointer itself, with no search.
//!
//! **Stored and converted pointers**. A buffer pointer stored as a value (into a buffer, a wide
//! pointer's allocation, or a pointer cell) is its guest address, an 8-byte leaf, and `ptrtoint` is
//! the same address truncated to the integer's width: `guest + at` of its root entry, 0 for the
//! null constant. The memory plan puts every buffer root whose pointer escapes
//! this way in the dynamic component (`memory::plan`), so such a pointer is wide, its 64-bit offset
//! exact, and its slot's root entry written (a slot that is only stored has the window `Whole`:
//! pointers recovered from its address may reach any byte). Profile F has no root entries, so its
//! escaping roots stay static and a stored or converted static pointer is `SlotGuestBase` plus its
//! displacement (`access::pointer`). A pointer into the constant blob has no guest address (the
//! blob is no resident allocation) and is refused.
//! pointer's memory, or a pointer cell) is its Metal address, an 8-byte leaf, and `ptrtoint` is
//! the same address truncated to the integer's width, 0 for the null constant. A slot root whose
//! pointer escapes this way stays static (`memory::plan`), so a stored or converted slot pointer
//! is `SlotGuestBase` plus its displacement (`access::pointer`). A pointer into the constant blob
//! has no Metal address and is refused.
//!
//! **Accesses** through a wide pointer compute from the fields it carries (no switch: every
//! candidate, static or resident, is one code path): the leaf's words at `host + (at & ~3)`, and
//! the sink's address, read once in the function's first block. Every such access is bounded
//! (robustness does not cover device addresses): the normative check `size ≥ n ∧ at ≤ size − n` in
//! `u64`, the access at `select(inb, address, sink)`, and a load's value `select(inb, v, 0)`; an
//! out-of-bounds store lands in the write-only sink. Every static slot a wide access may reach
//! becomes `BufferForm::Psb` (`access::finish_slots`), so the binder writes its root entry.
//!
//! **Under the identity domains** there is no root table: a pointer is the device address of the
//! byte it names, so a loaded word or an `inttoptr` operand is the pointer itself, with no search.
//! A wide pointer there is its address `a` alone, a `u64` (`DemoteTy::Address`): the `at` of a
//! miss's fields `(0, a, 0, 0)`, whose Metal address is `at` and whose accesses are at `host + at`,
//! with no field but `at` held, extracted or rebuilt (a GEP is the address's own arithmetic). A
//! wide buffer parameter is its slot's address (`SlotGuestBase`, the bias added back). No access
//! through a wide pointer is contained or counted: a stored address is used as it is, unchecked,
//! and no resident set exists to miss. No root table is read and no `RootTableAddress` pushed. An
//! escaping slot root stays static there (`memory::plan`), so a converted or stored slot pointer is
//! `access::pointer`'s.
//! **Accesses** through a wide pointer are at the address it holds: the leaf's words from the
//! 4-aligned address below it ([`wide_at`]). No access through a wide pointer is checked or
//! counted: a loaded address is used as it is. Every slot a wide pointer may reach is reached by
//! its device address (`BufferForm::Psb`, `access::finish_slots`), on a device that binds a
//! kernel's buffers too.
//!
//! **Compares.** `icmp` of wide pointers, or of a wide pointer and the null constant, compares
//! their Metal addresses: `guest + at` of each pointer's root entry, the null root's fields being
//! 0 (so a miss `(0, i, 0, 0)` is address `i`, and null is 0). A compare of a wide
//! pointer with a static one is `access::pointer`'s.
//! the addresses they hold, null being 0. A compare of a wide pointer with a static one is
//! `access::pointer`'s.
//!
//! **Null constants** (`null`, `undef`, `poison`) are the null root: `(0, 0, 0, 0)` as a `select`
//! side or a phi's incoming value.
//! **Null constants** (`null`, `undef`, `poison`) are address 0 as a `select` side or a phi's
//! incoming value.
//!
//! **Coherent accesses** (`air.{load,store}.{device,system}_coherent`) through a wide pointer are
//! the wide leaf access with `NonPrivatePointer` and `MakePointerVisible` (a load) or
@@ -67,13 +41,12 @@
//! through a static-root pointer.
//!
//! **Atomics** through a wide pointer are `access::atomic`'s, at the device address
//! `atomic_address` computes from the root entry, contained and counted like a leaf access.
//! [`atomic_address`] computes from the address the pointer holds, unchecked as a leaf access is.
//!
//! **Memory intrinsics** (`access::copy`) resolve a wide endpoint once (`wide_base`: the root
//! entry's fields, and the miss counted when the length is nonzero) and access each unit at its
//! displacement from it (`wide_at`), contained like a leaf access. A `memmove` that may alias
//! compares the endpoints' Metal addresses: a wide pointer's `guest_address`, and a static-root
//! pointer's `static_guest_address` (`SlotGuestBase` plus its displacement).
//! **Memory intrinsics** (`access::copy`) take a wide endpoint's address once ([`wide_base`]) and
//! access each unit at its displacement from it ([`wide_at`]), unchecked as a leaf access is. A
//! `memmove` that may alias compares the endpoints' Metal addresses: a wide pointer's address, and
//! a static-root pointer's `static_guest_address` (`SlotGuestBase` plus its displacement).
//!
//! A volatile access (a leaf, or a pointer's guest address) is the same access whose words carry
//! `Volatile` (`access::volatile_form`).
@@ -447,10 +420,8 @@ fn param_slot(entry: &crate::air::Entry, b: &ParamBinding) -> Option<SlotRef> {
}
}
/// The value of a wide buffer parameter, `[2 + n, bind_offset, host, size]` of its root entry
/// (read where the value is first needed: [`emit_entry`] holds it from the function's first
/// block), or `None` when `b` is not one. Under the identity domains it is its slot's address,
/// read where it is needed.
/// The value of a wide buffer parameter, its slot's address (`pointer::slot_address`), read where
/// it is needed, or `None` when `b` is not one.
pub fn param_value(
cx: &mut EmitCx<'_>,
fb: &mut FunctionBuilder<'_>,
+17 -20
View File
@@ -40,27 +40,24 @@
//! the phi's class (the null handle, a constexpr sampler), as a handle `select` does.
//!
//! **Heap handles** (`memory::handles`). A texture handle loaded from an argument buffer is its
//! set-1 heap element: the load reads the member's 8-byte guest resource id as two words through
//! the argument buffer's slot (an ordinary contained leaf access) and searches the stage's handle
//! table for it ([`HandleStrategy::Lookup`], `access.handle.lookup`) by calling the module's one
//! search function ([`HandleTable::lookup`]); a miss is the neutral element 0, the null handle.
//! Merges of heap handles are the integer operations above; a texture operation on one indexes its
//! group's heap array ([`heap_target`], the texture family). The function then reads the handle
//! table, one more storage descriptor of the stage. Where a shader-checked heap read observes its
//! alpha, the search also carries the entry's out-of-bounds-alpha flag in the handle's bit 31,
//! where a heap access reads its texel class the class's index in bits 16 to 28, and where a heap
//! storage access converts by its red-blue order that flag in bit 30
//! (`memory::handles::Lookup::Flagged`); where a heap read through a sampler may hand back its
//! border texels, the search carries the entry's index in bits 16 to 31 instead, and every use
//! reads the entry's flags it needs from the table (`memory::handles::Lookup::Indexed`).
//! set-1 array element: the load reads the member's 8-byte resource ID (`docs/RESOURCE-ID.md`) as
//! two words through the argument buffer's slot, an ordinary leaf access
//! ([`HandleStrategy::Lookup`], `access.handle.lookup`), and the handle is the ID's index masked
//! below the arrays' length (`pipeline::link::IDENTITY_TEXTURES`), no table searched
//! (`emit_identity_handle`). Where a shader-checked heap read observes its alpha, the handle also
//! carries the texture word's out-of-bounds-alpha flag in `HANDLE_ALPHA_ONE` (bit 31,
//! `memory::handles::Lookup::Flagged`), and where the function reaches an argument buffer's
//! texture buffer held as words, the word's low bits above the index while the stage's
//! `SpecKey::TexelBufferWords` holds (`lower::texture`'s `HANDLE_WORD`). Merges of heap handles
//! are the integer operations above; a texture operation on one indexes its group's array
//! ([`heap_target`], the texture family).
//!
//! **Heap samplers** (the sampler half). A sampler handle loaded from an argument buffer is
//! searched the same way in the stage's sampler table ([`HandleStrategy::SamplerLookup`],
//! `access.handle.sampler_lookup`), the handle table's layout over the argument buffers' samplers,
//! by the module's one search of it, in its entry form: the handle is the index of the sampler's
//! table entry, 0 (the null entry) for a miss (`memory::handles::Lookup::Entry`). The sampler
//! family reads the entry's element, which indexes the sampler array of each sampling's use, and
//! its state word (`metal::sampler::SamplerWord`) where the sampling reads the sampler's state.
//! **Heap samplers** (the sampler half). A sampler handle loaded from an argument buffer is its
//! resource ID itself, a `uvec2` read the same way ([`HandleStrategy::SamplerLookup`],
//! `access.handle.sampler_lookup`): its index replaced by 0, the default sampler, where it is not
//! below the set-1 sampler arrays' length (`pipeline::link::IDENTITY_SAMPLERS`), and its word, the
//! sampler's state (`metal::sampler::SamplerWord`), as the program wrote it
//! (`emit_identity_sampler`).
//!
//! Every other use of a handle value here (a store, a compare, `ptrtoint`, a load through a handle)
//! is refused. A static handle parked in a forwarding private cell is its index there, and a heap
+3 -2
View File
@@ -134,8 +134,9 @@ pub struct PsbAccess {
/// How a device-address memory reaches its units.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Reach {
/// From the 4-aligned device address below one access ([`prepare`]): each unit at that
/// address plus its index times its size, in 64 bits.
/// From a 4-aligned `u64` device address ([`PsbMem::at`]): the word below one access through
/// a wide pointer (`dynamic::wide_at`), or a function table's entry (`function_table`). Each
/// unit is at that address plus its index times its size, in 64 bits.
Rounded,
/// From the 4-aligned device address below one access of a slot under the identity domains
/// ([`prepare_at`]): each unit at that address plus its index times its size, the product in
@@ -57,9 +57,8 @@
//! Metal's own datapath (its fixed-point weight table, exact integer sums rounded half up onto the
//! format's grid, its float accumulators and its `half` rounding of a half format's sum) is not
//! reproduced: the sample records `PrecisionNote::BicubicFilterArithmetic`. An 8-bit sRGB
//! texture held as its UNORM twin reads the raw codes through a UNORM view under its
//! `SrgbTexture` variant ([`Bicubic::raw`]) and decodes each tap by the device's transfer
//! (`PrecisionNote::SrgbTexelDecode`) before the sum.
//! texture's taps are the device's decode of its codes through the slot's sRGB view
//! (`metal::texel_format`'s sRGB rule, `PrecisionNote::SrgbTexelDecode`), which the filter sums.
//!
//! Everything else above is Metal's reading, except inferences:
//! - The signed clamp's lower bound comes from the format's range (no reading went below `-1`).
@@ -1355,8 +1355,8 @@ fn held_lane(
/// `texel`, a four-lane held texel of `form` read from a storage slot of
/// `LoweringInputs::swizzled_storage`, swizzled by `word` (the slot's `TextureSwizzle`
/// specialization) as plain Metal swizzles a storage read of a swizzled texture: each lane `c` is
/// the source its three bits at `3c` name, as [`swizzled`] takes it, of the texel as the slot
/// converts it, the out-of-bounds texel included.
/// the source its three bits at `3c` name ([`swizzle_lanes`]), of the texel as the slot converts
/// it, the out-of-bounds texel included.
fn swizzled_texel(
cx: &mut EmitCx<'_>,
fb: &mut FunctionBuilder<'_>,
@@ -1409,7 +1409,7 @@ fn unswizzled(
/// `texel`, a `vec4` of `f32` an extended-range sampled slot of
/// `LoweringInputs::swizzled_storage` decodes for a sample or a gather tap (a border texel
/// included), swizzled by `word` (the slot's `TextureSwizzle` specialization) as plain Metal
/// swizzles a sampled texture's decoded texels ([`swizzled`]).
/// swizzles a sampled texture's decoded texels ([`swizzle_lanes`]).
pub(crate) fn swizzled_float(
fb: &mut FunctionBuilder<'_>,
texel: SValue,
@@ -1443,7 +1443,7 @@ fn sampled_lane(
/// `texel`, the four-lane held texel a sample of a packed normalized slot of
/// `LoweringInputs::swizzled_storage` converts by its class, swizzled by `word` (the slot's
/// `TextureSwizzle` specialization) as plain Metal swizzles a sampled texture's texels
/// ([`swizzled`]).
/// ([`swizzle_lanes`]).
pub(crate) fn swizzled_held(
cx: &mut EmitCx<'_>,
fb: &mut FunctionBuilder<'_>,
@@ -1486,7 +1486,10 @@ pub(crate) fn swizzled_gather(
Ok(out)
}
/// `texel`, a `vec4` of `elem` (one: the bits of its 1), swizzled by `word` ([`swizzled`]).
/// `texel`, a `vec4` of `elem` (`one`: the bits of its 1), swizzled by `word` (a slot's
/// `TextureSwizzle` specialization): each lane `c` is the source its three bits at `3c` name,
/// `MTLTextureSwizzle`'s raw value: 0 zero, 1 one, 2 to 5 the texel's red, green, blue, or alpha.
/// Selects on the word's fields, so one module serves every swizzle.
fn swizzle_lanes(
fb: &mut FunctionBuilder<'_>,
(elem, one): (TypeId, u64),