Struct pjrt_sys::protos::xla::LayoutProto
source · pub struct LayoutProto {Show 13 fields
pub dim_level_types: Vec<i32>,
pub dim_unique: Vec<bool>,
pub dim_ordered: Vec<bool>,
pub minor_to_major: Vec<i64>,
pub tiles: Vec<TileProto>,
pub tail_padding_alignment_in_elements: i64,
pub element_size_in_bits: i64,
pub memory_space: i64,
pub index_primitive_type: i32,
pub pointer_primitive_type: i32,
pub physical_shape: Option<Box<ShapeProto>>,
pub dynamic_shape_metadata_prefix_bytes: i64,
pub split_configs: Vec<SplitConfigProto>,
}Expand description
A layout describes how the array is placed in (1D) memory space. This includes the minor-to-major ordering of dimensions within a shape.
Clients must specify the layouts of input Literals to the computation. Layouts specified in interior operations which take Shapes (for example, Convert) are ignored.
See the XLA documentation for more information on shapes and layouts.
LINT.IfChange
Fields§
§dim_level_types: Vec<i32>The dimension level type list for this array, specifying the way in which each array dimension is represented in memory. If this list is empty, the array is assumed to be dense.
dim_unique: Vec<bool>Whether each dimension is unique or ordered. Each of the following lists must be empty, or have one entry for each entry of dim_level_types. If either list is empty, all dimensions are assumed to be unique and ordered, respectively. Entries in this list may not be false for some DimLevelType values (such as DIM_DENSE in particular).
dim_ordered: Vec<bool>§minor_to_major: Vec<i64>Sequence of dimension numbers, from minor (fastest varying index) to major (slowest varying index). This field is required.
tiles: Vec<TileProto>A sequence of tiles, starting from the tile that’s applied first to the Shape.
TODO(b/119839262): implement tiling in each backend or add Unimplemented error.
tail_padding_alignment_in_elements: i64The shape is padded at the end to multiple of, in terms of number of elements. This is useful when tiling does not bring the shape to certain desired granules. Tiling effectively pads/reshapes/transposes the shape to another shape. This field pads the total number of elements of that new shape to a multiple of certain number of elements. This is useful such as we want a layout which does not tile the data but still requires it to be padded to certain number of elements.
element_size_in_bits: i64(Optional) Bit size of each element. When unspecified or being 0, default to ShapeUtil::ByteSizeOfPrimitiveType.
memory_space: i64Memory space where this array resides. The integer field is interpreted in a backend-specific manner.
index_primitive_type: i32The integer types to be used for indices and pointers. These fields must not be used unless the layout represents a sparse array. The PrimitiveType must correspond to an unsigned integer (U8, U16, U32, or U64). If not provided, the compiler will use the largest unsigned integer that is naturally supported by the target device (U32 or U64 in currently supported devices).
pointer_primitive_type: i32§physical_shape: Option<Box<ShapeProto>>The physical, on-device shape used to represent the shape this layout belongs to. Only used for sparse arrays. The layout(s) contained within the physical shape should not also contain a physical shape.
dynamic_shape_metadata_prefix_bytes: i64The dynamic shape metadata size in bytes in front of the shape data. The field may be non-zero for a static shape whose associated buffer is for a dynamic shape, e.g. a result of SliceToDynamic.
split_configs: Vec<SplitConfigProto>The split configurations which describe if/how the data is split between different memories.
Implementations§
source§impl LayoutProto
impl LayoutProto
sourcepub fn dim_level_types(
&self,
) -> FilterMap<Cloned<Iter<'_, i32>>, fn(_: i32) -> Option<DimLevelType>>
pub fn dim_level_types( &self, ) -> FilterMap<Cloned<Iter<'_, i32>>, fn(_: i32) -> Option<DimLevelType>>
Returns an iterator which yields the valid enum values contained in dim_level_types.
sourcepub fn push_dim_level_types(&mut self, value: DimLevelType)
pub fn push_dim_level_types(&mut self, value: DimLevelType)
Appends the provided enum value to dim_level_types.
sourcepub fn index_primitive_type(&self) -> PrimitiveType
pub fn index_primitive_type(&self) -> PrimitiveType
Returns the enum value of index_primitive_type, or the default if the field is set to an invalid enum value.
sourcepub fn set_index_primitive_type(&mut self, value: PrimitiveType)
pub fn set_index_primitive_type(&mut self, value: PrimitiveType)
Sets index_primitive_type to the provided enum value.
sourcepub fn pointer_primitive_type(&self) -> PrimitiveType
pub fn pointer_primitive_type(&self) -> PrimitiveType
Returns the enum value of pointer_primitive_type, or the default if the field is set to an invalid enum value.
sourcepub fn set_pointer_primitive_type(&mut self, value: PrimitiveType)
pub fn set_pointer_primitive_type(&mut self, value: PrimitiveType)
Sets pointer_primitive_type to the provided enum value.
Trait Implementations§
source§impl Clone for LayoutProto
impl Clone for LayoutProto
source§fn clone(&self) -> LayoutProto
fn clone(&self) -> LayoutProto
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for LayoutProto
impl Debug for LayoutProto
source§impl Default for LayoutProto
impl Default for LayoutProto
source§impl Message for LayoutProto
impl Message for LayoutProto
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.source§impl PartialEq for LayoutProto
impl PartialEq for LayoutProto
impl StructuralPartialEq for LayoutProto
Auto Trait Implementations§
impl Freeze for LayoutProto
impl RefUnwindSafe for LayoutProto
impl Send for LayoutProto
impl Sync for LayoutProto
impl Unpin for LayoutProto
impl UnwindSafe for LayoutProto
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)