skip to content
==> README.md <==
1# @ajax/mesh-ptx-link
2
3```
4mesh-ptx-link --mcpu sm_86 [-O0..3] [--debug] [--export SYM]... -o OUT.ptx IN.bc...
5```
6
7Links LLVM bitcode (a sexc `ptx` package's `.sexc/out/<profile>/ptx/<id>.bc`) into one PTX module in the
8cluster float mode: `llvm-link`, then `opt --denormal-fp-math-f32=preserve-sign` with
9`default<O3>,internalize,globaldce` keeping only `mesh_main` and `MESH_RT_ABI` public, then `llc` with the
10same flag. Every f32 instruction that has a `.ftz` form gets it, and the rest of the program is internalised
11and inlined into the kernel. Tools: `$MESH_LLVM_LINK`, `$MESH_OPT`, `$MESH_LLC`, or found on `PATH`
12(also `name-21` .. `name-15`) or the newest `/usr/lib/llvm-N/bin`.
13
14- **Ported from:** alpha-rust-mesh `scripts/ptx-link.sh` (rustc's linker for the programs).
15- **Tests:** the exact commands, the symbols file, the `sm_NN` rule, tool lookup; the programs' tests link
16  their PTX with it and float-check the result.
17- **Differences:** a command-line tool instead of a rustc `-C linker`, so it takes the inputs and options
18  directly. `llc` also gets `--fp-contract=off`: clang's C (unlike rustc) may emit `llvm.fmuladd` in a
19  library built without `-ffp-contract=off`, and strict contraction keeps that a multiply and an add.