warp.func#
- warp.func(
- f: Callable[[_FuncParams], _FuncReturn],
- warp.func(
- f: None = None,
- *,
- name: str | None = None,
- module: Module | Literal['unique'] | str | None = None,
- inline: bool | None = None,
Decorator to define a Warp function callable from kernels and other Warp functions.
- Parameters:
f (Callable | None) – The Python callable to register as a Warp function.
name (str | None) – Sets the function key used for registration and native code generation. If
None, Warp derives the key fromf.module (Module | Literal['unique'] | str | None) – The Warp module in which to register the function. If
None, Warp infers the module fromf. Pass"unique"to create a new module, or a string to register the function in a named module.inline (bool | None) – Whether the function is inlined into its call sites.
Noneleaves the choice to the backend compiler.Truerequires inlining (CUDA__forceinline__), overriding the compiler’s own heuristic.Falsekeeps the function out of line (CUDA__noinline__).
The inline hint covers the generated adjoint as well as the forward function, and is lowered per backend so the decorated function stays valid for CPU and CUDA.
See also
warp.kernel()for defining kernels that can be launched on devices.