IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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 struct

TensorMapDataType

struct TensorMapDataType

Data type enumeration for TMA tensor map descriptors.

Specifies the element data type for TMA operations. The TMA hardware supports various numeric types including integers, floating-point, and specialized formats.

Implemented traits​

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassable

comptime members​

BFLOAT16​

comptime BFLOAT16 = TensorMapDataType(Int32(9))

Brain floating-point 16-bit format.

FLOAT16​

comptime FLOAT16 = TensorMapDataType(Int32(6))

IEEE 754 16-bit floating-point.

FLOAT32​

comptime FLOAT32 = TensorMapDataType(Int32(7))

IEEE 754 32-bit floating-point.

FLOAT32_FTZ​

comptime FLOAT32_FTZ = TensorMapDataType(Int32(10))

32-bit float with flush-to-zero for denormals.

FLOAT64​

comptime FLOAT64 = TensorMapDataType(Int32(8))

IEEE 754 64-bit floating-point.

INT32​

comptime INT32 = TensorMapDataType(Int32(3))

Signed 32-bit integer.

INT64​

comptime INT64 = TensorMapDataType(Int32(5))

Signed 64-bit integer.

PACKED_FP4_ALIGN16B​

comptime PACKED_FP4_ALIGN16B = TensorMapDataType(Int32(14))

Nibble-packed 4-bit source, landed padded in shared memory.

Copies 16 U4 values into 16 shared-memory bytes: 8 bytes of packed data then an 8-byte gap. The values stay nibble-packed -- it is the padding that makes a K extent span one byte per element. This is the layout the SM100 kind::mxf8f6f4 UMMA reads an E2M1 operand from, so it is what lets FP4 weights stay 4-bit in global memory while feeding a tensor-core kind whose operands are byte addressed.

PACKED_FP4_ALIGN8B​

comptime PACKED_FP4_ALIGN8B = TensorMapDataType(Int32(13))

Nibble-packed 4-bit source, landed packed in shared memory.

Copies 16 U4 values into 8 shared-memory bytes with no gaps.

TFLOAT32​

comptime TFLOAT32 = TensorMapDataType(Int32(11))

TensorFloat-32 format.

TFLOAT32_FTZ​

comptime TFLOAT32_FTZ = TensorMapDataType(Int32(12))

TensorFloat-32 with flush-to-zero for denormals.

UINT16​

comptime UINT16 = TensorMapDataType(Int32(1))

Unsigned 16-bit integer.

UINT32​

comptime UINT32 = TensorMapDataType(Int32(2))

Unsigned 32-bit integer.

UINT64​

comptime UINT64 = TensorMapDataType(Int32(4))

Unsigned 64-bit integer.

UINT8​

comptime UINT8 = TensorMapDataType(Int32(0))

Unsigned 8-bit integer.

Methods​

from_dtype​

static def from_dtype[dtype: DType]() -> Self

Converts a Mojo DType to the corresponding TMA data type.

Constraints:

The dtype must be one of the supported types listed above.

Parameters:

  • ​dtype (DType): The Mojo data type to convert. Must be one of DType.float32, DType.float16, DType.bfloat16, DType.uint8, DType.uint16, DType.uint32, DType.int32, DType.int64, DType.uint64, DType.float8_e4m3fn, or DType.float8_e8m0fnu.

Returns:

Self: The corresponding TensorMapDataType value.

Was this page helpful?