pub struct Geometry {
pub sublanes: usize,
pub lanes: usize,
pub mxu: usize,
}Expand description
The hardware tile shape a lattice is padded and laid out to.
Fields§
§sublanes: usizeRows per storage tile (the sublane count of a vector register).
lanes: usizeColumns per storage tile (the lane count of a vector register).
mxu: usizeSide length of the square systolic matrix-unit block.
Implementations§
Source§impl Geometry
impl Geometry
Sourcepub const TPU_V: Geometry
pub const TPU_V: Geometry
The canonical TPU v-class geometry: 8 sublanes, 128 lanes, 128x128 MXU.
Sourcepub fn new(sublanes: usize, lanes: usize, mxu: usize) -> Result<Self>
pub fn new(sublanes: usize, lanes: usize, mxu: usize) -> Result<Self>
Build a geometry, validating that every dimension is non-zero.
Sourcepub const fn tile_len(&self) -> usize
pub const fn tile_len(&self) -> usize
Number of elements in a single storage tile (sublanes * lanes).
Sourcepub const fn pad_rows(&self, rows: usize) -> usize
pub const fn pad_rows(&self, rows: usize) -> usize
Pad a row count up to a whole number of sublane tiles.
Sourcepub const fn pad_cols(&self, cols: usize) -> usize
pub const fn pad_cols(&self, cols: usize) -> usize
Pad a column count up to a whole number of lane tiles.
Sourcepub const fn tile_rows(&self, rows: usize) -> usize
pub const fn tile_rows(&self, rows: usize) -> usize
How many storage tiles tall a padded rows is.
Sourcepub const fn tile_cols(&self, cols: usize) -> usize
pub const fn tile_cols(&self, cols: usize) -> usize
How many storage tiles wide a padded cols is.
Sourcepub const fn is_aligned(&self, rows: usize, cols: usize) -> bool
pub const fn is_aligned(&self, rows: usize, cols: usize) -> bool
True if both row and column counts already sit on tile boundaries.
Trait Implementations§
impl Copy for Geometry
impl Eq for Geometry
impl StructuralPartialEq for Geometry
Auto Trait Implementations§
impl Freeze for Geometry
impl RefUnwindSafe for Geometry
impl Send for Geometry
impl Sync for Geometry
impl Unpin for Geometry
impl UnsafeUnpin for Geometry
impl UnwindSafe for Geometry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more