Skip to main content

Maxpool3dForward

Struct Maxpool3dForward 

Source
pub struct Maxpool3dForward<D: Num> {
    pub name: &'static str,
    pub id: String,
    pub kd: i32,
    pub kh: i32,
    pub kw: i32,
    pub stride_d: i32,
    pub stride_h: i32,
    pub stride_w: i32,
    pub block_ow: i32,
    pub kernel_source: String,
    pub entry_point_source: String,
    pub source: String,
    /* private fields */
}
Expand description

3-D max-pooling forward pass.

Grid: pid = (((b * C + c) * OD + od) * OH + oh) * num_ow_tiles + ow_tile

Constraints: no padding; OD = (D - KD) / STRIDE_D + 1, OH = (H - KH) / STRIDE_H + 1, OW = (W - KW) / STRIDE_W + 1.

Fields§

§name: &'static str

The kernel function’s name (e.g. "flash_attention2_forward").

§id: String

Unique kernel identifier: fn_name + dtype(s) + const values joined by “__”.

§kd: i32

Compile-time kernel constant, from the annotated fn’s const generics.

§kh: i32

Compile-time kernel constant, from the annotated fn’s const generics.

§kw: i32

Compile-time kernel constant, from the annotated fn’s const generics.

§stride_d: i32

Compile-time kernel constant, from the annotated fn’s const generics.

§stride_h: i32

Compile-time kernel constant, from the annotated fn’s const generics.

§stride_w: i32

Compile-time kernel constant, from the annotated fn’s const generics.

§block_ow: i32

Compile-time kernel constant, from the annotated fn’s const generics.

§kernel_source: String

The original kernel function source.

§entry_point_source: String

The Rust source of the generated C-ABI entry-point wrapper function.

§source: String

Combined source (kernel_source + "\n\n" + entry_point_source); used by the Kernel trait.

Implementations§

Source§

impl<D: Num> Maxpool3dForward<D>

Source

pub fn new( kd: i32, kh: i32, kw: i32, stride_d: i32, stride_h: i32, stride_w: i32, block_ow: i32, ) -> Self

Constructs a new kernel instance for these compile-time parameters.

Trait Implementations§

Source§

impl<D: Num> Kernel for Maxpool3dForward<D>

Source§

type Args<'__a> = (*mut D, *mut D, i32, i32, i32, i32, i32, i32, i32, i32)

This kernel’s launch-argument tuple type.
Source§

fn id(&self) -> String

A content hash of this kernel’s source, used as a cache key.
Source§

fn name(&self) -> &str

This kernel’s name.
Source§

fn source(&self) -> &str

This kernel’s full source (DSL + kernel body + entry point wrapper).
Source§

fn kernel_source(&self) -> &str

This kernel’s body source, without the entry-point wrapper.
Source§

fn entry_point_source(&self) -> &str

Returns the Rust source of the generated C-ABI entry-point wrapper function.
Source§

fn entry_point_name(&self) -> String

Returns the PTX symbol name for this kernel: "{name}_entry_point".
Source§

impl<D: Num + Send + Sync + 'static> RuntimeOp for Maxpool3dForward<D>

Source§

fn n_activation_inputs(&self) -> usize

Number of activation tensors taken from predecessor DAG nodes.
Source§

fn param_shapes(&self, _: &[&[usize]], _: &[usize]) -> Vec<Vec<usize>>

Shapes of additional parameter buffers (weights, biases) needed by this op. Called at LoadedModel::load() time to pre-allocate device buffers. input_shapes / output_shape are concrete (batch dim resolved).
Source§

fn pack_args( &self, _: &[(RawPtr, &[usize])], _: &[RawPtr], _: RawPtr, _: &[usize], _: i32, _: &mut dyn ArgVisitor, )

Pack all kernel arguments into visitor in the correct order. Read more
Source§

fn block(&self) -> [u32; 3]

Threads-per-CTA for this kernel (x, y, z).
Source§

fn grid(&self, _: &[usize]) -> [u32; 3]

Number of CTAs to launch (x, y, z), given the concrete output shape.
Source§

fn param_names(&self) -> &'static [&'static str]

Names of parameter slots returned by [param_shapes], in the same order. Used as the suffix in the dotted key {node_name}.{slot_name}. Return an empty slice for ops that have no named parameters.
Source§

fn forward_output_row_stride(&self, output_shape: &[usize]) -> usize

Returns the required row stride (in elements) for the output buffer of this op’s forward kernel. The default is the natural row-major stride (output_shape[-1]). Kernels using TMA must round up to satisfy the 16-byte alignment constraint (e.g. 4 elements for f32).
Source§

fn param_init_data(&self, _param_idx: usize) -> Option<Vec<u8>>

Returns raw (little-endian) bytes to pre-populate parameter slot param_idx immediately after device buffer allocation. Return None to leave the slot zero-initialised (the default for trained parameters). Byte count must equal param_shapes()[param_idx].iter().product() * dtype_bytes.
Source§

fn compute_concrete_output_shape( &self, _input_shapes: &[&[usize]], resolved: &[usize], ) -> Vec<usize>

Override to compute the true concrete output shape from concrete input shapes. Read more
Source§

fn n_launches(&self) -> usize

Number of sequential kernel launches this op requires. Read more
Source§

fn pack_args_for_launch( &self, launch_idx: usize, inputs: &[(*mut c_void, &[usize])], params: &[*mut c_void], output: *mut c_void, output_shape: &[usize], output_row_stride: i32, visitor: &mut dyn ArgVisitor, )

Pack kernel arguments for launch i (0-indexed). Read more
Source§

fn grid_for_launch( &self, launch_idx: usize, input_shapes: &[&[usize]], output_shape: &[usize], ) -> [u32; 3]

Grid for launch i. Receives concrete input shapes so that per-chunk grids can be computed without storing them in the op. Read more
Source§

fn has_backward(&self) -> bool

Returns true if this op has a backward (gradient) kernel.
Source§

fn backward_grad_output_row_stride(&self, output_shape: &[usize]) -> usize

Returns the required row stride (in elements) for the grad_output buffer passed to pack_backward_args. The default is the natural row-major stride (output_shape[-1]). Kernels using TMA must round up to satisfy the 16-byte alignment constraint (e.g. 4 elements for f32).
Source§

fn pack_backward_args( &self, inputs: &[(*mut c_void, &[usize])], params: &[*mut c_void], output: *mut c_void, output_shape: &[usize], grad_output: *mut c_void, grad_output_row_stride: i32, grad_inputs: &[*mut c_void], grad_params: &[*mut c_void], visitor: &mut dyn ArgVisitor, )

Pack backward kernel arguments. Read more
Source§

fn backward_block(&self) -> [u32; 3]

Threads-per-CTA for the backward kernel.
Source§

fn backward_grid( &self, input_shapes: &[&[usize]], output_shape: &[usize], ) -> [u32; 3]

Number of CTAs for the backward kernel. Read more
Source§

fn n_backward_launches(&self) -> usize

Number of sequential kernel launches for the backward pass. Read more
Source§

fn pack_backward_args_for_launch( &self, launch_idx: usize, inputs: &[(*mut c_void, &[usize])], params: &[*mut c_void], output: *mut c_void, output_shape: &[usize], grad_output: *mut c_void, grad_output_row_stride: i32, grad_inputs: &[*mut c_void], grad_params: &[*mut c_void], visitor: &mut dyn ArgVisitor, )

Pack backward kernel arguments for launch i (0-indexed). Read more
Source§

fn backward_grid_for_launch( &self, launch_idx: usize, input_shapes: &[&[usize]], output_shape: &[usize], ) -> [u32; 3]

Grid for backward launch i. Read more

Auto Trait Implementations§

§

impl<D> Freeze for Maxpool3dForward<D>

§

impl<D> RefUnwindSafe for Maxpool3dForward<D>
where D: RefUnwindSafe,

§

impl<D> Send for Maxpool3dForward<D>
where D: Send,

§

impl<D> Sync for Maxpool3dForward<D>
where D: Sync,

§

impl<D> Unpin for Maxpool3dForward<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for Maxpool3dForward<D>

§

impl<D> UnwindSafe for Maxpool3dForward<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.