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 module

tdm

CDNA5 (gfx1250) Tensor Data Mover (TDM) descriptors and instructions.

CDNA5 deletes CDNA4's buffer_load_lds (buffer-to-LDS DMA) and replaces it with tensor_load_to_lds / tensor_store_from_lds, which take a multi-register Tensor DMA Descriptor describing a box transfer between global memory and LDS. Completion of both directions is tracked by the wave's TENSORcnt counter (s_wait_tensorcnt); CDNA5's STOREcnt counts vector stores, not TDM traffic.

Only the 2D dense form is implemented: the gather and iterate-mode bits stay zero, and groups 2 and 3 (dimensions 2-4 with their strides and tile extents) are issued as zeros, which describes a rank-2 tensor. A descriptor is meant to be built once with compile-time box and padding fields, then advanced with with_addr and with_extents instead of being rebuilt from scratch on every iteration.

TODO(anand): lift the 2D ceiling -- a caller that needs three or four dimensions has to fill groups 2 and 3, and a gather caller also has to change the type field away from the dense encoding, so both wait on a caller that wants them.

The field layout and widths come from AMD's public hip/amd_detail/amd_gfx1250_TDM.h, whose bitfield structs describe every group, and the type field and live-transfer count are the values that header's own constructor writes. Two conventions it does not state, and that no public AMD text was found to confirm:

  • Dim 0 is the contiguous dimension with an implicit stride of one element, so the row pitch of a 2D box goes in the 48-bit field the header calls tensorDim0Stride; the field named tensorDim1Stride therefore belongs to the stride of dim 2, which a 2D transfer leaves zero.
  • pad_interval and pad_amount are stored in 32-bit dword units, biased by one: pad_interval_bytes is 4 << (field + 1) (a power of two in 8..1024) and pad_amount_bytes is 4 * (field + 1) (a multiple of 4 in 4..512). The header gives the fields' widths, and the host test pins this packing, but nothing public gives their units.

Packing is plain integer arithmetic, so TDMDescriptor.make_2d and its mutators are usable from host code and are covered by a host test; only the two instruction wrappers are gated on the CDNA5 target.

Structs​

  • ​TDMDescriptor: A gfx1250 TDM descriptor: groups 0 and 1 of the 20-dword structure.

Functions​

Was this page helpful?