Mojo module
coord
Unified layout system for mixed compile-time and runtime indices.
comptime values
DynamicCoord
comptime DynamicCoord[dtype: DType, size: Int] = Coord[#kgen.variadic.splat(RuntimeInt[dtype], size._mlir_value)]
Create a Coord full of size dynamic elements with dtype.
Returns:
A Coord full of size dynamic elements with dtype.
Parameters
- dtype (
DType): The output element DType. - size (
Int): The number of output elements.
StaticCoord
comptime StaticCoord[value: Int, size: Int] = Coord[#kgen.variadic.splat(ComptimeInt[value], size._mlir_value)]
Create a Coord full of size static elements with dtype.
Returns:
A Coord full of size static elements with dtype.
Parameters
- value (
Int): The value of each element. - size (
Int): The number of output elements.
Structs
-
ComptimeInt: Compile-time known index value. -
Coord: A struct representing tuple-like data with compile-time and runtime elements. -
RuntimeInt: Runtime index value with configurable precision.
Traits
-
CoordLike: Trait for unified layout handling of compile-time and runtime indices.
Functions
-
coord: Create a Coord from a tuple of integers with specified dtype. -
coord_to_index_list: Convert a flat Coord to an IndexList. -
coord_to_int_tuple: Convert a Coord to an IntTuple, preserving the nested structure. -
crd2idx: Calculate the linear index from a coordinate tuple. -
Idx: Helper to create runtime indices. -
idx2crd: Calculate the coordinate tuple from a linear index.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!