Skip to main content

Module gemm

Module gemm 

Source
Expand description

2-D matrix multiply (MatMul / Gemm) Triton kernels.

Tiled GEMM using T::make_tensor_descriptor + T::dot for Tensor Core utilisation — one CTA computes one [BLOCK_M, BLOCK_N] (or [BLOCK_M, BLOCK_K] / [BLOCK_K, BLOCK_N] for the backward kernels) output tile, accumulating over K/N/M-tiles with T::dot rather than a scalar multiply-and-reduce per element. Same swizzled-pid / tensor-descriptor structure as crate::nn::mlp::linear’s linear_forward/linear_backward.

Grid: one CTA per output tile. Block: [128, 1, 1].

Structs§

MatMulRuntimeOp
MatmulBackwardDa
Backward: dA = dC @ B^T
MatmulBackwardDb
Backward: dB = A^T @ dC
MatmulForward
Forward: C = A @ B

Functions§

matmul_backward_da
Backward: dA = dC @ B^T
matmul_backward_db
Backward: dB = A^T @ dC
matmul_forward
Forward: C = A @ B