pub struct UpsampleNearest2dBackward<D: Num> {
pub name: &'static str,
pub id: String,
pub scale_h: i32,
pub scale_w: i32,
pub block_iw: i32,
pub kernel_source: String,
pub entry_point_source: String,
pub source: String,
/* private fields */
}Expand description
Nearest-neighbour 2-D upsample backward pass — NCHW layout.
Grid: one flat pid per (b, c, ih, iw-tile) — same spatial extent as the
input tensor:
pid = ((b * C + c) * H + ih) * num_iw_tiles + iw_tile
Each CTA computes the gradient for a BLOCK_IW-wide strip of input columns by summing the SCALE_H × SCALE_W upstream gradients that each input pixel received during the forward pass. No atomic operations are needed because each input element is the sole accumulator for exactly SCALE_H×SCALE_W output lanes (their ranges are disjoint).
dx does NOT need to be zero-initialised (every element is written once).
Fields§
§name: &'static strThe kernel function’s name (e.g. "flash_attention2_forward").
id: StringUnique kernel identifier: fn_name + dtype(s) + const values joined by “__”.
scale_h: i32Compile-time kernel constant, from the annotated fn’s const generics.
scale_w: i32Compile-time kernel constant, from the annotated fn’s const generics.
block_iw: i32Compile-time kernel constant, from the annotated fn’s const generics.
kernel_source: StringThe original kernel function source.
entry_point_source: StringThe Rust source of the generated C-ABI entry-point wrapper function.
source: StringCombined source (kernel_source + "\n\n" + entry_point_source); used by the Kernel trait.
Implementations§
Trait Implementations§
Source§impl<D: Num> Kernel for UpsampleNearest2dBackward<D>
impl<D: Num> Kernel for UpsampleNearest2dBackward<D>
Source§type Args<'__a> = (*mut D, *mut D, i32, i32, i32, i32, i32, i32)
type Args<'__a> = (*mut D, *mut D, i32, i32, i32, i32, i32, i32)
Source§fn kernel_source(&self) -> &str
fn kernel_source(&self) -> &str
Source§fn entry_point_source(&self) -> &str
fn entry_point_source(&self) -> &str
Source§fn entry_point_name(&self) -> String
fn entry_point_name(&self) -> String
"{name}_entry_point".