Flat grid docs: the structural reason alone, no app or lab timings
PR #15's comments named an app's shader as the flat variant's motivating case and carried its lab timings. AGENTS.md keeps docs to what is true now and the tree names no app; the measurements stay in the PR's commit messages. The doc comments of KernelDecl::flat and divmod_64_by_32, the 64/32 division test and the ragged-dispatch lane now say the structural reason only: a device without a 64-bit divider (Intel's) lowers each 64-bit division to a software sequence per invocation, and ANV (Mesa 26.2) compiles a kernel holding 64-bit OpUDiv/OpUMod at SIMD8. The lane's grid is described by its size. Comments only; no code changes. The runtime-sources pin follows if the digest covers these files (it hashes their bytes; no RUNTIME_VERSION bump, nothing runs otherwise). Verified: cargo fmt clean; pin recomputed with pin-compute.py.
This commit is contained in:
1 parent
31358fc93c
commit
f287ca164e
4 files changed
+11
-13
No files matched your search
@@ -1 +1 @@
|
||||
3b44fe77f3530084e7eb3d901c082a245e958f8f13f29e83f33a425be12abff4
|
||||
fb5056c47393c8d8e0b064992636f33d06392c00334bea1c4d7d5da5e0fb5061
|
||||
@@ -710,9 +710,9 @@ fn an_indirect_threadgroup_dispatch_runs_on_the_gpu() {
|
||||
}
|
||||
|
||||
/// A direct `dispatchThreads:` of a ragged grid runs on the flat variant (one dispatch, no split)
|
||||
/// and each of Metal's threads runs once, at its own position: the Simulator's 1206 x 2622 screen
|
||||
/// in 32 x 32 threadgroups (its masked blit's dispatch, 3.16 M threads, the flat count's 32-bit
|
||||
/// form), and ragged 3-D grids. The expectation is computed here, not by another dispatch.
|
||||
/// and each of Metal's threads runs once, at its own position: a 1206 x 2622 grid in 32 x 32
|
||||
/// and 32 x 8 threadgroups (3.16 M threads, the flat count's 32-bit form), and ragged 3-D grids.
|
||||
/// The expectation is computed here, not by another dispatch.
|
||||
#[test]
|
||||
fn a_ragged_direct_dispatch_runs_each_thread_once_on_the_flat_variant() {
|
||||
on_device(|device, messages| {
|
||||
|
||||
@@ -1450,17 +1450,15 @@ impl KernelDecl {
|
||||
///
|
||||
/// - a workgroup with `wy = wz = 0` (group `wx`) whose last index `wx·N + N - 1` is below
|
||||
/// 2^32 counts in 32 bits from `wx·N`, its test and start read from the workgroup's id and
|
||||
/// `N` alone (every workgroup of a dispatch whose groups fit along `x`, as the Simulator's);
|
||||
/// `N` alone (every workgroup of a dispatch whose groups fit along `x`);
|
||||
/// - any other, of a dispatch of at most 2^32 invocations (`nx · ny · nz · N <= 2^32`, so
|
||||
/// every index is below 2^32), counts in 32 bits from `((wz · ny + wy) · nx + wx) · N`;
|
||||
/// - past that the index is 64-bit and divided by [`Self::divmod_64_by_32`].
|
||||
///
|
||||
/// Devices without a 64-bit divider (Intel's) lower each 64-bit division to a long software
|
||||
/// sequence: on Arrow Lake the Simulator's 1206 x 2622 masked blit ran 4.85 ms with the
|
||||
/// 64-bit form and 1.13 ms with the 32-bit one. Mesa 26.2 also compiled the whole kernel at
|
||||
/// SIMD8 while 64-bit `OpUDiv`/`OpUMod` sat in its last arm, and per invocation tested and
|
||||
/// counted with `NumWorkgroups`, which ANV merges from two sources per invocation: the first
|
||||
/// arm reads neither.
|
||||
/// sequence per invocation. ANV (Mesa 26.2) also compiles a whole kernel at SIMD8 while
|
||||
/// 64-bit `OpUDiv`/`OpUMod` sit in any arm of it, and merges `NumWorkgroups` from two sources
|
||||
/// per invocation: the first arm reads neither.
|
||||
fn flat(
|
||||
&self,
|
||||
fb: &mut FunctionBuilder<'_>,
|
||||
@@ -1594,8 +1592,8 @@ impl KernelDecl {
|
||||
///
|
||||
/// The flat variant's 64-bit arm divides by it rather than by a 64-bit `OpUDiv`/`OpUMod`:
|
||||
/// lowered on a device without a 64-bit divider (Intel's), four of those made the arm so large
|
||||
/// that the whole kernel compiled at a narrower SIMD width (SIMD8 for the Simulator's masked
|
||||
/// blit on Arrow Lake, Mesa 26.2), though the arm runs only past 2^32 invocations.
|
||||
/// that the whole kernel compiled at a narrower SIMD width (SIMD8 for SIMD16 on ANV, Mesa
|
||||
/// 26.2), though the arm runs only past 2^32 invocations.
|
||||
fn divmod_64_by_32(
|
||||
fb: &mut FunctionBuilder<'_>,
|
||||
[lo, hi]: [SValue; 2],
|
||||
|
||||
@@ -692,7 +692,7 @@ fn derivation_modules_are_valid() {
|
||||
/// The flat variant's 64-bit arm divides a `u64` by a `u32` in 32-bit operations
|
||||
/// ([`KernelDecl::divmod_64_by_32`]): on the CPU interpreter its quotient and remainder are Rust's
|
||||
/// for dividends at and around every power-of-two boundary of interest (2^16, 2^32, 2^58, 2^63,
|
||||
/// 2^64 - 1) and the Simulator screen's index range, and divisors 1, small, 1206 and 2622, and at
|
||||
/// 2^64 - 1) and a 1206 x 2622 grid's index range, and divisors 1, small, 1206 and 2622, and at
|
||||
/// both sides of 2^31 and 2^32 (where `2r + bit` carries past 32 bits).
|
||||
#[test]
|
||||
fn the_flat_variant_s_64_bit_division_is_exact() {
|
||||
|
||||
Reference in new issue
Block a user