The mesh cluster float mode's rules on PTX text: FTZ, correctly rounded, unfused float instructions only
$ sexc add @ajax/mesh-ptx-float-rules- 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-check ^0.1.0
- dependents
- @ajax/mesh-build-programs, @ajax/mesh-ptx-float-check
- keywords
- mesh alphaos ptx ftz float lint
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-ptx-float-rules
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-ptx-float-rules 2 3The cluster float mode's rules on PTX text. Every float instruction must be correctly rounded, unfused 4and exact, and every f32 instruction that has a `.ftz` form must carry it, so CUDA and Metal members of 5a cluster compute the same bits: 6 7| Instructions | Rule | 8|---|---| 9| `add sub mul div rcp sqrt` | `.rn`, and `.ftz` on f32 | 10| `abs neg min max setp set slct` | `.ftz` on f32 | 11| `cvt` | `.ftz` when the source is f32, or f64 to f32 | 12| `selp copysign testp mov ld ldu st` | allowed as they are | 13| `.approx`, `div.full`, `fma`/`mad`, f16/bf16/tf32/fp8, anything else with a float type | refused | 14 15`mesh_ptx_float_line(line, len)` gives the reason a line breaks a rule (the script's words), and 16`mesh_ptx_float_check(path, text, len, out)` checks a whole file, printing up to 5 problems. 17 18- **Ported from:** alpha-rust-mesh `scripts/ptx-float-check.sh` (an awk program), rule for rule. 19- **Tests:** every rule on hand-written lines; the programs' tests run it on every linked PTX, and the 20 results agree with the original awk script on those files (checked by hand when porting).