Skip to main content

Crate cubecl_macros

Crate cubecl_macros 

Source

Macros§

comment
Insert a literal comment into the kernel source code.
comptime
Mark the contents of this macro as compile time values, turning off all expansion for this code and using it verbatim
comptime_type
Makes the function return a compile time value Useful in a cube trait to have a part of the trait return comptime values
gpu_asm
GPU version of asm. Currently parses all the same options, but most are not applicable to GPU assembly architectures. Should validate and give proper errors at some point. Also adds a new register spec: the inferred register specifier (_). This is because the specifier isn’t actually meaningful in PTX and is currently ignored, with constraints being inferred from the value type. The reason it’s still present is because we may want to add an explicit mem specifier to allow fine-grained memory clobbering, or support for other assembly formats that do use different register types.
intrinsic
Mark the contents of this macro as an intrinsic, turning off all expansion for this code and calling it with the scope
terminate
Terminate the execution of the kernel for the current unit.

Attribute Macros§

cube
Mark a cube function, trait or implementation for expansion.
derive_cube_comptime
Attribute macro to define a type that can be used as a kernel comptime argument This derive Debug, Hash, PartialEq, Eq, Clone, Copy
derive_expand
Attribute macro to derive cube traits for existing structs, without redefining that struct.

Derive Macros§

AutotuneKey
Implements display and initialization for autotune keys.
CubeLaunch
Derive macro to define a cube type that is launched with a kernel
CubeType
Derive macro to define a cube type that is not launched
CubeTypeMut
Implements mutability for a CubeType
IntoRuntime
Implements IntoRuntime for a CubeType