Block collectives of a multi-warp mesh node in a fixed, bit-reproducible order (reduce, scan, broadcast), and typed shared memory
$ sexc add @ajax/mesh-rt-block- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 03:26v/# 1 version
- drwxr-xr-x-Oct 27 03:26files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 03:26 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/mesh-abi-base ^0.1.0, @ajax/mesh-abi-fault ^0.1.0, @ajax/mesh-rt-prim ^0.1.0, @ajax/mesh-rt-view ^0.1.0
- dependents
- @ajax/mesh-rt, @ajax/mesh-rt-ctx, @ajax/mesh-rt-linalg, @ajax/mesh-rt-loop
- keywords
- mesh alphaos gpu runtime collectives deterministic
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-rt-block
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-rt-block 2 3The block collectives of a multi-warp mesh node, in a fixed order that makes float results bitwise the 4same on every GPU and in the CPU reference (`mesh_ref::block`): warp butterfly reductions, Hillis-Steele 5warp scans, block reductions and scans over the 1024-leaf tree, broadcasts, and the fixed f32 operations 6(sum with identity -0.0, max in the IEEE total order). Also `mesh_shared`, a typed, bounds-checked window 7of the node's shared memory. 8 9Rust's generic `Word` and closures become one function per type (`_u32`, `_f32`, `_u64`) taking the 10operation as a function pointer: `mesh_rt_block_reduce_f32(v, MESH_RT_SUM_F32_ID, mesh_rt_add_f32)`. Every call is 11inlined, so the operation is too. 12 13- **Ported from:** alpha-rust-mesh `crates/mesh-rt/src/block.rs`. 14- **Tests:** programs/blocks runs every collective on 1..32-warp nodes on the simulator and compares with 15 the Rust reference's vectors (@ajax/mesh-ref-block).