Skip to main content

TmaDescriptorBuilder

Struct TmaDescriptorBuilder 

Source
pub struct TmaDescriptorBuilder { /* private fields */ }
Expand description

Typed builder for TMA tensor-map descriptors.

Collects parameters in a convenient Rust API and produces a TmaEncodeTiledParams struct suitable for passing to the CUDA driver’s cuTensorMapEncodeTiled entry point.

§Example

use oxicuda_driver::tma::{
    CuTensorMapDataType, CuTensorMapSwizzle, TmaDescriptorBuilder,
};

let params = TmaDescriptorBuilder::new_2d(
    CuTensorMapDataType::Bfloat16,
    512, 1024,           // rows × cols
    1024 * 2,            // row stride in bytes
    64, 64,              // tile rows × tile cols
)
.with_swizzle(CuTensorMapSwizzle::B128)
.params();

assert_eq!(params.num_dims, 2);
assert_eq!(params.global_dims[0], 1024); // cols (innermost)
assert_eq!(params.global_dims[1], 512);  // rows
assert_eq!(params.box_dims[0], 64);      // tile cols
assert_eq!(params.box_dims[1], 64);      // tile rows

Implementations§

Source§

impl TmaDescriptorBuilder

Source

pub fn new_2d( data_type: CuTensorMapDataType, rows: u64, cols: u64, row_stride_bytes: u64, box_rows: u32, box_cols: u32, ) -> Self

Create a 2-D tiled TMA descriptor for a row-major matrix.

§Parameters
  • data_type — element type.
  • rows — number of rows in the global tensor.
  • cols — number of columns in the global tensor.
  • row_stride_bytes — byte offset between consecutive rows in global memory (often cols * element_size).
  • box_rows — tile height (rows per block in shared memory).
  • box_cols — tile width (cols per block in shared memory).
§Panics

Does not panic; invalid parameters will be caught by the driver when cuTensorMapEncodeTiled is called.

Source

pub fn new_nd( data_type: CuTensorMapDataType, num_dims: u32, global_dims: [u64; 5], global_strides: [u64; 4], box_dims: [u32; 5], element_strides: [u32; 5], ) -> Self

Create an N-dimensional tiled TMA descriptor (N ≤ 5).

§Parameters
  • data_type — element type.
  • num_dims — number of tensor dimensions (1–5).
  • global_dims — size of each dimension, innermost (col) first.
  • global_strides — byte stride for each outer dimension (num_dims - 1 entries).
  • box_dims — tile extent per dimension.
  • element_strides — stride between elements in each tile dimension.
Source

pub fn with_swizzle(self, swizzle: CuTensorMapSwizzle) -> Self

Override the swizzle pattern (default: CuTensorMapSwizzle::B128).

Source

pub fn with_interleave(self, interleave: CuTensorMapInterleave) -> Self

Override the interleave mode (default: CuTensorMapInterleave::None).

Source

pub fn with_l2_promotion(self, l2_promotion: CuTensorMapL2Promotion) -> Self

Override the L2 promotion hint (default: CuTensorMapL2Promotion::L2B128).

Source

pub fn with_oob_fill(self, oob_fill: CuTensorMapFloatOobFill) -> Self

Override the out-of-bounds fill mode (default: CuTensorMapFloatOobFill::None).

Source

pub fn params(self) -> TmaEncodeTiledParams

Finalise the builder and return the flat parameter struct.

Pass the fields of the returned TmaEncodeTiledParams directly to cuTensorMapEncodeTiled.

Trait Implementations§

Source§

impl Clone for TmaDescriptorBuilder

Source§

fn clone(&self) -> TmaDescriptorBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TmaDescriptorBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more