Rate this Page

helion.language.inline_triton#

helion.language.inline_triton(triton_source, args, output_like)[source]#

Inline a raw Triton snippet inside a Helion kernel.

Parameters:
  • triton_source (str) – The Triton code snippet. The last statement must be an expression representing the return value. The snippet may be indented, and common indentation is stripped automatically.

  • args (Sequence[object] | Mapping[str, object]) – Positional or keyword placeholders that will be substituted via str.format before code generation. Provide a tuple/list for positional placeholders ({0}, {1}, …) or a mapping for named placeholders ({x}, {y}, …).

  • output_like (TypeVar(_T)) – Example tensors describing the expected outputs. A single tensor indicates a single output; a tuple/list of tensors indicates multiple outputs.

Return type:

TypeVar(_T)

Returns:

The value(s) produced by the snippet. Matches the structure of output_like.