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 function

q_num_matrix_view_rows

def q_num_matrix_view_rows[dtype: DType, //](q: LayoutTensor[dtype, address_space=q.address_space, element_layout=q.element_layout, layout_int_type=q.layout_int_type, linear_idx_type=q.linear_idx_type, masked=q.masked, alignment=q.alignment]) -> Int

Return the number of matrix rows when viewing Q as a 2-D tensor for TMA.

For decoding, Q is viewed as rows x depth; for prefill it is viewed as rows x (depth * num_heads). The row count is the product of all leading dimensions except the last two (head and depth).

Parameters:

  • dtype (DType): Element type of the query tensor.

Args:

Returns:

Int: The number of logical rows in the 2-D TMA view of Q.

def q_num_matrix_view_rows[dtype: DType, //](q: TileTensor[dtype, Storage=q.Storage, address_space=q.address_space, linear_idx_type=q.linear_idx_type]) -> Int

Returns:

Int

Was this page helpful?