warp.func#

warp.func(
f: Callable[[_FuncParams], _FuncReturn],
) Callable[[_FuncParams], _FuncReturn][source]#
warp.func(
f: None = None,
*,
name: str | None = None,
module: Module | Literal['unique'] | str | None = None,
) Callable[[Callable[[_FuncParams], _FuncReturn]], Callable[[_FuncParams], _FuncReturn]]

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 from f.

  • module (Module | Literal['unique'] | str | None) – The Warp module in which to register the function. If None, Warp infers the module from f. Pass "unique" to create a new module, or a string to register the function in a named module.

See also

warp.kernel() for defining kernels that can be launched on devices.