#[warp_kernel]Expand description
Mark a function as a GPU kernel entry point.
This attribute transforms the function signature for PTX compilation:
- Adds
#[no_mangle]for symbol visibility in PTX - Adds
extern "ptx-kernel"ABI - Wraps the body in
unsafe(PTX kernels are inherently unsafe)
§Parameter Rules
Kernel parameters must be one of:
- Raw pointers (
*const T,*mut T) — for device memory - Scalars (
u8,u16,u32,u64,i8,i16,i32,i64,f32,f64,bool) — passed by value
Note: usize/isize are rejected because their width is platform-dependent.
On nvptx64 they are 64-bit, but the host launcher may assume a different size,
causing ABI mismatch. Use explicit-width types (u32, u64, etc.) instead.
§Compile-Time Safety
The function body uses warp-types normally. Warp::kernel_entry() creates
the initial Warp<All>, and the type system prevents shuffle-from-inactive-lane
bugs at compile time — on the actual GPU target.