Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The #[kernel] Macro

teeny-macros provides the #[kernel] attribute macro (teeny_macros::kernel), which marks a function as a kernel definition consumed by teeny-triton/teeny-kernels:

use teeny_macros::kernel;

#[kernel]
pub fn my_kernel(/* ... */) {
    // kernel body
}

See Writing a Triton Kernel for how a #[kernel]-annotated function fits into the broader compilation pipeline.

TODO: document exactly what code transformation #[kernel] performs (macros/teeny-macros/src/macros/kernel.rs) once it’s stable enough to describe without immediately going stale.