Skip to main content

Runtime

Decorators and launch syntax

Argument rules: device arrays become pointers; sf.sf16(...) scalars and Python ints become scalar arguments; host arrays, raw floats, bools, and non-contiguous views (a transpose or strided slice) are rejected before launch; all arrays must be on one device; sf16 only on the simulator. A kernel must not return a value.

Kernel language (valid only inside a kernel)

Lockstep rule. if, while, and, or, not on a traced value, or a traced value in range(), raise SFCompileError at trace time. Use sf.where for a value and sf.predicate for statements. Loops run over Python ints or constexprs and are unrolled. Faults. Out-of-bounds load / store / shared access and integer division by zero raise SFDeviceError. The faulting op writes nothing; writes by earlier ops and earlier programs stay; nothing after the fault runs. Result. A launch returns LaunchResult with .status (exact SFStatus), .counters, .cycles, .grid, .block, .device, .backend, .config. The policy is applied to the status after the launch in catalogue order (invalid, divide, overflow).