For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
gemv_gpu
def gemv_gpu[transpose_b: Bool = False, pdl_level: PDLLevel = PDLLevel.ON](c: TileTensor[Engine=c.Engine, address_space=c.address_space, linear_idx_type=c.linear_idx_type], a: TileTensor[Engine=a.Engine, address_space=a.address_space, linear_idx_type=a.linear_idx_type], b: TileTensor[Engine=b.Engine, address_space=b.address_space, linear_idx_type=b.linear_idx_type], ctx: DeviceContextBase)
Selects and dispatches the appropriate GPU GEMV kernel based on shape and hardware.
Examines runtime dimensions M, N, K and static shape information to choose among GEMV_KERNEL, GEMV_KERNEL_VECTOR, GEMV_SPLIT_K, GEVM_KERNEL, and MATMUL_NAIVE variants.
Parameters:
- transpose_b (
Bool): When True, B is treated as transposed (N, K) row-major. - pdl_level (
PDLLevel): Programmatic dependent launch level for PDL barriers.
Args:
- c (
TileTensor[Engine=c.Engine, address_space=c.address_space, linear_idx_type=c.linear_idx_type]): Rank-2 output TileTensor. - a (
TileTensor[Engine=a.Engine, address_space=a.address_space, linear_idx_type=a.linear_idx_type]): Rank-2 input matrix TileTensor. - b (
TileTensor[Engine=b.Engine, address_space=b.address_space, linear_idx_type=b.linear_idx_type]): Rank-2 input vector or matrix TileTensor. - ctx (
DeviceContextBase): Device context for kernel launch.
def gemv_gpu[EpilogueFnType: ElementwiseEpilogueFn, //, transpose_b: Bool = False, pdl_level: PDLLevel = PDLLevel.ON](c: TileTensor[Engine=c.Engine, address_space=c.address_space, linear_idx_type=c.linear_idx_type], a: TileTensor[Engine=a.Engine, address_space=a.address_space, linear_idx_type=a.linear_idx_type], b: TileTensor[Engine=b.Engine, address_space=b.address_space, linear_idx_type=b.linear_idx_type], epilogue_fn: EpilogueFnType, ctx: DeviceContextBase)
Selects and dispatches a GPU GEMV kernel that stores through epilogue_fn.
Parameters:
- EpilogueFnType (
ElementwiseEpilogueFn): Type ofepilogue_fn(inferred). - transpose_b (
Bool): When True, B is treated as transposed (N, K) row-major. - pdl_level (
PDLLevel): Programmatic dependent launch level for PDL barriers.
Args:
- c (
TileTensor[Engine=c.Engine, address_space=c.address_space, linear_idx_type=c.linear_idx_type]): Rank-2 output TileTensor. Only its shape is read;epilogue_fnstores the result. - a (
TileTensor[Engine=a.Engine, address_space=a.address_space, linear_idx_type=a.linear_idx_type]): Rank-2 input matrix TileTensor. - b (
TileTensor[Engine=b.Engine, address_space=b.address_space, linear_idx_type=b.linear_idx_type]): Rank-2 input vector or matrix TileTensor. - epilogue_fn (
EpilogueFnType): Stores each output element. - ctx (
DeviceContextBase): Device context for kernel launch.
def gemv_gpu[ComputeFnType: ElementwiseComputeFn, //, transpose_b: Bool = False, pdl_level: PDLLevel = PDLLevel.ON](c: TileTensor[Engine=c.Engine, address_space=c.address_space, linear_idx_type=c.linear_idx_type], a: TileTensor[Engine=a.Engine, address_space=a.address_space, linear_idx_type=a.linear_idx_type], b: TileTensor[Engine=b.Engine, address_space=b.address_space, linear_idx_type=b.linear_idx_type], compute_fn: ComputeFnType, ctx: DeviceContextBase)
Selects and dispatches a GPU GEMV kernel that stores compute_fn(idx, a @ b) into c.
Parameters:
- ComputeFnType (
ElementwiseComputeFn): Type ofcompute_fn(inferred). - transpose_b (
Bool): When True, B is treated as transposed (N, K) row-major. - pdl_level (
PDLLevel): Programmatic dependent launch level for PDL barriers.
Args:
- c (
TileTensor[Engine=c.Engine, address_space=c.address_space, linear_idx_type=c.linear_idx_type]): Rank-2 output TileTensor. - a (
TileTensor[Engine=a.Engine, address_space=a.address_space, linear_idx_type=a.linear_idx_type]): Rank-2 input matrix TileTensor. - b (
TileTensor[Engine=b.Engine, address_space=b.address_space, linear_idx_type=b.linear_idx_type]): Rank-2 input vector or matrix TileTensor. - compute_fn (
ComputeFnType): Maps each output index and value to the value to store. - ctx (
DeviceContextBase): Device context for kernel launch.