There is one runtime, so the prose of the harness, validation, devtools,
the translator's lockstep module, .config/nextest.toml and the refusal
surface and conformance coverage generators says "the runtime"
(scratch newrt.py: a word replacement, identifiers such as new_runtime
and NewRuntime untouched). docs/REFUSALS.md and
docs/CONFORMANCE-COVERAGE.md are regenerated from the edited scripts.
Four harness passages said the runtime makes no heap and no texture
over a buffer, and has no Managed mode. The runtime has all three
(Device::new_heap_buffer and heap textures, Buffer::new_texture,
Device::new_managed_buffer); the harness's own backend refuses the two
texture sources. They now say the harness makes neither on the runtime,
and the Managed note names Device::new_managed_buffer. The refusal
strings keep the words the harness's described test matches ("makes no
heap", "makes no texture over a buffer").
Left: three fixture comments (.metal under validation's public
fixtures, whose text keys the golden tables and the committed AIR) and
scripts/matrix, whose keys (harness-new) carry the same naming.
Verified locally: the refusal surface, Metal coverage, conformance
coverage and API signature checks pass.
44 lines
2.5 KiB
Rust
44 lines
2.5 KiB
Rust
//! The owned fixture `tgz_reads`: every thread reads its words of a declared threadgroup array and
|
|
//! of a `[[threadgroup(0)]]` region before any thread of its threadgroup writes them, then stores a
|
|
//! nonzero pattern into both and reads its neighbour's words back (the fixture's source says what
|
|
//! each thread does). The dispatches a run makes ([`GROUPS`] threadgroups of each of [`SIZES`]
|
|
//! threads, [`DISPATCHES`] times each, the region [`REGION_BYTES`] long), and what each dispatch
|
|
//! answers where threadgroup memory reads zero until the program writes it ([`answer`]): the
|
|
//! conformance case `compute-threadgroup-memory-reads-zero` records Metal's answer and holds it
|
|
//! equal to [`answer`], and the runtime's device test holds its own equal to it.
|
|
|
|
/// The fixture, and its kernel.
|
|
pub const FIXTURE: &str = "tgz_reads";
|
|
/// The words of the fixture's declared threadgroup array, its `WORDS`.
|
|
pub const WORDS: u32 = 2048;
|
|
/// The bytes a run sets for the `[[threadgroup(0)]]` region: as many words as the array.
|
|
pub const REGION_BYTES: u32 = 4 * WORDS;
|
|
/// The threadgroups of each dispatch: many waves of threadgroups of 16 KiB on every GPU, so later
|
|
/// threadgroups run where earlier ones stored their patterns.
|
|
pub const GROUPS: u32 = 2048;
|
|
/// The threads of a threadgroup, one dimension: whole SIMD groups of 32, then two sizes that are
|
|
/// not (a last SIMD group of 26 threads, and one SIMD group of 30).
|
|
pub const SIZES: [u32; 3] = [256, 250, 30];
|
|
/// The dispatches of each size, one after the other in one compute pass.
|
|
pub const DISPATCHES: usize = 2;
|
|
|
|
/// What one dispatch of `groups` threadgroups of `size` threads writes to its four output words
|
|
/// where threadgroup memory reads zero until the program writes it: no word read nonzero before a
|
|
/// write (words 0 and 1), the wrapping sum over every threadgroup's words of the pattern stored in
|
|
/// the array plus twice the one stored in the region (word 2), and the sum of the squares of the
|
|
/// threads of each SIMD group, Metal's SIMD groups of 32 in thread order (word 3).
|
|
pub fn answer(groups: u32, size: u32) -> [u32; 4] {
|
|
let mut sum = 0u32;
|
|
for word in 0..groups * WORDS {
|
|
let pattern = 0x8000_0000 | (word & 0x3fff_ffff);
|
|
sum = sum
|
|
.wrapping_add(pattern)
|
|
.wrapping_add((pattern | 0x4000_0000).wrapping_mul(2));
|
|
}
|
|
let shape: u32 = (0..size)
|
|
.step_by(32)
|
|
.map(|first| (size - first).min(32).pow(2))
|
|
.sum();
|
|
[0, 0, sum, groups * shape]
|
|
}
|