For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
gemv_kernel_vector
def gemv_kernel_vector[c_type: DType, a_type: DType, b_type: DType, c_layout: TensorLayout, a_layout: TensorLayout, b_layout: TensorLayout, c_storage: TensorStorage, a_storage: TensorStorage, b_storage: TensorStorage, *, simd_width: Int, transpose_b: Bool = False, elementwise_lambda_fn: Optional[def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> None] = None, accum_type: DType = get_accum_type[c_type](), check_bounds: Bool = True, pdl_level: PDLLevel = PDLLevel()](c: TileTensor[c_type, c_layout, MutAnyOrigin, Storage=c_storage], a: TileTensor[a_type, a_layout, ImmutAnyOrigin, Storage=a_storage], b: TileTensor[b_type, b_layout, ImmutAnyOrigin, Storage=b_storage], m: Int, n: Int, k: Int)
GPU kernel for matrix-vector multiplication using vectorized warp-level loads.
Each warp processes one output row. Threads collaborate to load simd_width-wide
vectors from A and B, accumulate dot products locally, then reduce across the warp.
Parameters:
- βc_type (
DType): Output element type. - βa_type (
DType): A (matrix) element type. - βb_type (
DType): B (vector) element type. - βc_layout (
TensorLayout): Layout descriptor for the output tensor. - βa_layout (
TensorLayout): Layout descriptor for the A matrix. - βb_layout (
TensorLayout): Layout descriptor for the B vector. - βc_storage (
TensorStorage): Storage kind for the output tensor. - βa_storage (
TensorStorage): Storage kind for A. - βb_storage (
TensorStorage): Storage kind for B. - βsimd_width (
Int): Number of elements loaded per vectorized access. - βtranspose_b (
Bool): When True, writes the result transposed. - βelementwise_lambda_fn (
Optional[def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> None]): Optional epilogue applied to each output element. - βaccum_type (
DType): Accumulation precision type. - βcheck_bounds (
Bool): When True, bounds-checks the last K iteration. - βpdl_level (
PDLLevel): Programmatic dependent launch level.
Args:
- βc (
TileTensor[c_type, c_layout, MutAnyOrigin, Storage=c_storage]): Rank-2 output TileTensor. - βa (
TileTensor[a_type, a_layout, ImmutAnyOrigin, Storage=a_storage]): Rank-2 input matrix TileTensor, shape (m, k). - βb (
TileTensor[b_type, b_layout, ImmutAnyOrigin, Storage=b_storage]): Rank-2 input vector TileTensor, shape (1, k). - βm (
Int): Number of output rows. - βn (
Int): Unused; retained for interface consistency. - βk (
Int): Shared reduction dimension.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!