mesh-rt's device primitives on NVIDIA GPUs as inline PTX: special registers, sys-scope ordering, atomics, warp shuffles, the block barrier
$ sexc add @ajax/mesh-rt-ptx- 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
- none
- dependents
- @ajax/mesh-rt-prim
- keywords
- mesh alphaos gpu ptx cuda runtime
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-rt-ptx
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-rt-ptx 2 3mesh-rt's device primitives on NVIDIA GPUs, as inline PTX in C (`mesh/rt/ptx.h`): special registers 4(`%tid`, `%ctaid`, `%ntid`, `%smid`, `%globaltimer`, `%dynamic_smem_size`), system-scope loads and stores 5(acquire, release, relaxed), atomics (`atom.add/or/and/cas`, `red.add`), fences, `nanosleep`, warp 6shuffles and ballot, the warp and block barriers, the node's dynamic shared memory (`mesh_smem`), and 7`trap`. Every asm has a `"memory"` clobber, as Rust's `asm!` without `nomem` is a compiler barrier. 8 9The header is empty unless compiled for nvptx64 (`clang --target=nvptx64-nvidia-cuda`). Programs include 10`mesh/rt/prim.h` (@ajax/mesh-rt-prim), which picks this or the CPU simulator. 11 12- **Ported from:** alpha-rust-mesh `crates/mesh-rt/src/ptx.rs`, instruction for instruction. 13- **Tests:** every program under `programs/` compiles these into PTX in each test run; @ajax/mesh-prog-hello's 14 linked PTX is checked for its entry, `MESH_RT_ABI` and the float mode. 15- **Differences:** `rdf`/`wrf`, `shfl_idx_f` and `warp_sum` (target-neutral) live in @ajax/mesh-rt-prim.