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

ResourceKind

struct ResourceKind

Hardware resource that an operation occupies.

Each operation is assigned to a resource unit with a finite capacity. Two operations on the same resource at the same time slot contend. The resource also determines which wait counter tracks the operation:

GLOBAL_MEM → vmcnt (buffer_load instructions) LDS → lgkmcnt (ds_read / LDS instructions) MMA_UNIT → MFMA (matrix fused multiply-add) VALU → VALU (vector ALU: softmax, exp2, reductions) SCALAR → SALU (barriers, priority hints, fences) NONE → sentinel (no-op / not applicable)

On CDNA architectures, MMA_UNIT and VALU are independent execution units that can issue simultaneously. The scheduler models this by tracking separate free times for each, allowing MMA and VALU ops to overlap.

Implemented traits

AnyType, Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, Writable

comptime members

GLOBAL_MEM

comptime GLOBAL_MEM = ResourceKind(Int(0))

LDS

comptime LDS = ResourceKind(Int(1))

MMA_UNIT

comptime MMA_UNIT = ResourceKind(Int(2))

NONE

comptime NONE = ResourceKind(Int(255))

SCALAR

comptime SCALAR = ResourceKind(Int(3))

VALU

comptime VALU = ResourceKind(Int(4))

Vector ALU: parallel with MMA on CDNA architectures.

Methods

write_to

def write_to(self, mut writer: T)