IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/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, Equatable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, Writable

comptime members​

GLOBAL_MEM​

comptime GLOBAL_MEM = ResourceKind(0)

LDS​

comptime LDS = ResourceKind(1)

MMA_UNIT​

comptime MMA_UNIT = ResourceKind(2)

NONE​

comptime NONE = ResourceKind(255)

SCALAR​

comptime SCALAR = ResourceKind(3)

VALU​

comptime VALU = ResourceKind(4)

Vector ALU: parallel with MMA on CDNA architectures.

Methods​

write_to​

write_to(self, mut writer: T)