Skip to content

CLI tools reference

These tools read source or .wbin files. Each accepts --help for its command-line options.

Assemble a .wave source file into .wbin.

wave-asm <input.wave> [options]
ArgumentDescription
input.waveAssembly source file
OptionDescription
-o, --output <path>Output path; defaults to the input path with a .wbin extension
--dump-hexPrint the binary as hexadecimal instead of writing it
--dump-astParse and print the AST instead of assembling a binary
--verbosePrint the assembled byte count and output path
--no-symbolsStrip the symbol table
-W, --warn <level>Warning policy: all, none, or error; default all
Terminal window
wave-asm vector_add.wave -o vector_add.wbin
wave-asm kernel.wave --dump-hex
wave-asm kernel.wave -o kernel.wbin -W error
wave-asm kernel.wave -o kernel.wbin --no-symbols

0 indicates success, 1 indicates an assembly or I/O failure, and 2 indicates invalid CLI arguments.

Disassemble a .wbin file into assembly text.

wave-dis <program.wbin> [options]
ArgumentDescription
program.wbinBinary file
OptionDescription
-o, --output <path>Write to a file instead of stdout
--offsetsInclude instruction byte offsets
--rawInclude hexadecimal instruction words
--no-directivesOmit kernel, register, and end directives
Terminal window
wave-dis program.wbin
wave-dis program.wbin -o program.wave --offsets
wave-dis program.wbin --raw

0 indicates success, 1 indicates decoding or I/O failure, and 2 indicates invalid CLI arguments.

Compile a supported Python, Rust, C++, or TypeScript kernel into .wbin.

wave-compiler <input> -o <output.wbin> --lang <language> [options]
ArgumentDescription
inputSource file
OptionDescription
-o, --output <path>Required output path
--lang <language>Required source language
-O, --opt-level <level>Optimization level 0 through 3; default 0
--max-registers NRegister limit; default 256
--wave-width NWave width; default 32
--dump-hirPrint HIR to stderr
--dump-mirPrint MIR to stderr
--dump-lirPrint LIR to stderr

See Compiler optimization for the passes at each level.

Language--lang valueFile extensions
Pythonpython.py
Rustrust.rs
C++cpp.cpp, .cc, .cxx
TypeScripttypescript.ts
Terminal window
wave-compiler kernel.py -o kernel.wbin --lang python
wave-compiler matmul.py -o matmul.wbin --lang python -O 3
wave-compiler reduce.rs -o reduce.wbin --lang rust
wave-compiler scan.cpp -o scan.wbin --lang cpp -O 0
wave-compiler filter.ts -o filter.wbin --lang typescript

0 indicates success, 1 indicates compilation or I/O failure, and 2 indicates invalid CLI arguments.

Execute a .wbin program on the CPU.

wave-emu <program.wbin> [options]
ArgumentDescription
program.wbinBinary file
OptionDefaultDescription
--grid X,Y,Z1,1,1Workgroup counts in each dimension
--workgroup X,Y,Z32,1,1Workgroup dimensions when kernel metadata does not supply them
--registers N32Registers per thread when kernel metadata does not supply a count
--local-memory N16384Local-memory bytes when kernel metadata does not supply a size
--device-memory N1048576Device-memory bytes
--wave-width N32Lanes per wave
--max-instructions N10000000Instruction budget; 0 removes the limit
--traceOffPrint executed instructions
--statsOffPrint operation, memory, workgroup, wave, and barrier counters
--arg OFFSET:FILENoneLoad a file into device memory at the byte offset
--set-reg REG:VALUENoneSet a register in every thread
--fill-iota OFFSET:TYPE:COUNT:SCALENoneFill memory with 0, SCALE, 2*SCALE, and subsequent values
--fill-zero OFFSET:TYPE:COUNTNoneFill memory with zeros
--dump-regsOffPrint registers after execution
--dump-memory START:ENDNonePrint the specified byte range as hexadecimal
--dump-u32 OFFSET:COUNTNonePrint memory as u32 values
--dump-f32 OFFSET:COUNTNonePrint memory as f32 values
--dump-f16 OFFSET:COUNTNonePrint memory as f16 values
--dump-bf16 OFFSET:COUNTNonePrint memory as bf16 values

--arg loads raw file bytes at the specified byte offset. Repeat it to load several regions:

Terminal window
wave-emu kernel.wbin --grid 1,1,1 --workgroup 64,1,1 \
--arg 0:input.bin --arg 256:output.bin
Terminal window
wave-emu program.wbin --grid 1,1,1 --workgroup 64,1,1
wave-emu program.wbin --grid 4,1,1 --workgroup 256,1,1
wave-emu volume.wbin --grid 8,8,8 --workgroup 4,4,4
wave-emu debug.wbin --wave-width 64 --trace
wave-emu matmul.wbin --grid 16,16,1 --workgroup 16,16,1 \
--device-memory 16777216 --local-memory 49152 --stats
wave-emu kernel.wbin --registers 16 --dump-regs

Kernel metadata overrides nonzero register and local-memory declarations and declared workgroup dimensions.

0 indicates success, 1 indicates execution or I/O failure, and 2 indicates invalid CLI arguments. Exceeding the instruction budget is an execution failure.

Trace records identify the workgroup, wave, program counter, and instruction:

wg(0,0,0) wave[0] pc=0x0000: mov_imm r0, 3

--stats reports executed instructions by category, device and local memory loads and stores with byte counts, barriers, divergent branches, workgroups, and waves. It does not estimate GPU cycles.