diff --git a/crates/metal2vulkan-air/src/canon/aggregates.rs b/crates/metal2vulkan-air/src/canon/aggregates.rs index dd84809d7..741866218 100644 --- a/crates/metal2vulkan-air/src/canon/aggregates.rs +++ b/crates/metal2vulkan-air/src/canon/aggregates.rs @@ -3,22 +3,22 @@ //! An LLVM `load` or `store` may move a whole array or struct (`load [4 x <4 x float>], ptr //! addrspace(2) %p`): Metal's own linker emits one where it passes a field of a buffer's struct to //! a function by value, and a converter-built vertex function's return value is one stored to and -//! loaded from a stack allocation. Lowering reads and writes buffer, threadgroup and stack memory -//! a scalar or vector at a time. After SCCP, [`expand`] replaces each such access, in its place, by its members' (the -//! scalars and vectors the type holds, in layout order): a `getelementptr i8` at the member's -//! constant byte distance from the access's pointer (none at distance 0), and a load chained into -//! the aggregate by `insertvalue`, starting from `undef`; a store's members are each an -//! `extractvalue` and a store. A member's alignment is the access's, lowered to the largest power -//! of two dividing its distance; an access that states none leaves its members' unstated (each -//! member's ABI alignment, which its offset in the layout honours). +//! loaded from a stack allocation. Lowering reads and writes buffer, threadgroup and stack memory a +//! scalar or vector at a time. After SCCP, [`expand`] replaces each such access, in its place, by +//! its members' (the scalars and vectors the type holds, in layout order): a `getelementptr i8` at +//! the member's constant byte distance from the access's pointer (none at distance 0), and a load +//! chained into the aggregate by `insertvalue`, starting from `undef`; a store's members are each +//! an `extractvalue` and a store. A member's alignment is the access's, lowered to the largest +//! power of two dividing its distance; an access that states none leaves its members' unstated +//! (each member's ABI alignment, which its offset in the layout honours). //! //! What is split: a non-volatile, non-atomic access in `device`, `constant`, `threadgroup` or //! `thread` memory of an array or struct that holds no pointer, with at least one and at most //! [`MAX_MEMBERS`] members, nested at most [`MAX_DEPTH`] deep. The rest stays whole: a pointer //! member (a handle or a resource) is lowering's to follow, and lowering holds no larger -//! aggregate, so it refuses the access. A stack allocation's whole-aggregate access is split like -//! the rest because lowering holds only scalars and vectors there too: left whole, it was refused -//! as `Lowering(Access)` `AccessType`. +//! aggregate, so it refuses the access (`Lowering(Access)` `AccessType`). A stack allocation's +//! whole-aggregate access is split like the rest because lowering holds only scalars and vectors +//! there too. use crate::budget::Meter; use crate::error::Error; diff --git a/crates/metal2vulkan-air/src/canon/mod.rs b/crates/metal2vulkan-air/src/canon/mod.rs index 880e1488e..66f049cc9 100644 --- a/crates/metal2vulkan-air/src/canon/mod.rs +++ b/crates/metal2vulkan-air/src/canon/mod.rs @@ -84,8 +84,8 @@ //! through the call's map pointer and Apple's arithmetic. **AIR 2.7 simdgroup-matrix block loads and //! stores** take their AIR 2.8 form, their extent, stride and origin built from the elements per //! row, the origin and the constant transpose flag (`legacy_matrix`). **Aggregate accesses**: a -//! load or store of a whole array or struct in buffer, threadgroup or stack memory becomes its scalar -//! and vector members' accesses, joined by `insertvalue` or split by `extractvalue` +//! load or store of a whole array or struct in buffer, threadgroup or stack memory becomes its +//! scalar and vector members' accesses, joined by `insertvalue` or split by `extractvalue` //! (`aggregates`). **Constant references**: in a kernel, each plain load of a scalar or vector //! from a `constant T&` parameter's object, at an offset fixed at translation time, is made in //! the entry block where nothing on any path before it may write device memory and no other @@ -764,7 +764,8 @@ pub fn specialize_dynamic( // in plain AIR, each OpenCL C `mad` call its multiply and addition, and each `mul24` and // `mad24` call the 32-bit product of its operands' low 24 bits (and the addition). let body = routine::expand(body, &mut parts, m)?; - // Aggregate loads and stores of buffer, threadgroup and stack memory as their members' accesses. + // Aggregate loads and stores of buffer, threadgroup and stack memory as their members' + // accesses. let body = aggregates::expand(body, &mut parts, func, m)?; // A kernel's plain loads of its constant references, made in its entry block where nothing // before them may write device memory. diff --git a/crates/metal2vulkan-air/src/canon/tests/aggregates.rs b/crates/metal2vulkan-air/src/canon/tests/aggregates.rs index 1719caa72..75bb89c22 100644 --- a/crates/metal2vulkan-air/src/canon/tests/aggregates.rs +++ b/crates/metal2vulkan-air/src/canon/tests/aggregates.rs @@ -1,5 +1,5 @@ -//! Aggregate loads and stores of buffer, threadgroup and stack memory, split into their members' accesses -//! (`canon::aggregates`). +//! Aggregate loads and stores of buffer, threadgroup and stack memory, split into their members' +//! accesses (`canon::aggregates`). use super::*; diff --git a/crates/metal2vulkan/src/tests/engine_stack_return_aggregate.rs b/crates/metal2vulkan/src/tests/engine_stack_return_aggregate.rs index 0bbbf2bd9..5a883eca8 100644 --- a/crates/metal2vulkan/src/tests/engine_stack_return_aggregate.rs +++ b/crates/metal2vulkan/src/tests/engine_stack_return_aggregate.rs @@ -1,9 +1,11 @@ -//! A vertex function that builds its return value in a stack slot compiles. +//! A vertex function that builds its return value in a stack slot compiles on one profile. //! //! The owned fixture `vertex_stack_return_aggregate` stores a zeroinitializer struct to an //! alloca, writes its members, and loads the whole struct back, the shape seen in modules Apple's -//! Metal shader converter wrote. `llvm-as` assembles the fixture; a missing tool skips -//! visibly. +//! Metal shader converter wrote. This test compiles, links and validates it on +//! `nvidia-rtx50-linux` alone; its row in `tests/public_fixture_expectations_engine.tsv` holds it to +//! `ok` on every committed profile (`public_fixtures_engine`). `llvm-as` assembles the fixture; a +//! missing tool skips visibly. use crate::pipeline::testing::{ compile, fixtures_dir, link_and_validate, llvm_assemble, profile, AssembleError,