Skip to main content

Mojo struct

GmemTrace

struct GmemTrace

HBM-backed trace buffer: store(offset, ts) writes ts to ptr[offset]. 8 bytes of kernel arg.

Fields​

  • ​ptr (UnsafePointer[UInt64, MutAnyOrigin]): Device pointer to a u64 buffer sized for num_blocks * GEMV_TRACE_EVENTS_PER_BLOCK slots.

Implemented traits​

AnyType, Copyable, DevicePassable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, TraceBuf, TrivialRegisterPassable

comptime members​

device_type​

comptime device_type = GmemTrace

Device-side type alias. GmemTrace is trivially device-passable.

Methods​

__init__​

__init__(ptr: UnsafePointer[UInt64, MutAnyOrigin]) -> Self

Wraps a device pointer as a trace buffer.

Args:

  • ​ptr (UnsafePointer[UInt64, MutAnyOrigin]): Device-side UnsafePointer[UInt64] with room for num_blocks * GEMV_TRACE_EVENTS_PER_BLOCK slots, zero-initialized on first use.

store​

store(self, offset: Int, val: UInt64)

Writes a timestamp into the device-side trace buffer.

Args:

  • ​offset (Int): Slot index.
  • ​val (UInt64): Timestamp value (ns).

get_type_name​

static get_type_name() -> String

Returns the type name for runtime diagnostics.

Returns:

String: Always "GmemTrace".