1# @ajax/mesh-ptx-float-rules
23The 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:
67| 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 |
1415`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.
1718- **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).