pub enum Type {
Scalar(StorageType),
Opaque(OpaqueType),
Vector(Intern<Type>, usize),
Semantic(SemanticType),
Atomic(Intern<Type>),
Pointer(Intern<Type>, AddressSpace),
Array(Intern<Type>, usize),
DynamicArray(Intern<Type>),
Matrix(MatrixType),
Aggregate(AggregateKind),
}Variants§
Scalar(StorageType)
Scalar type containing a single storage element
Opaque(OpaqueType)
Opaque types that can be stored but not interacted with normally. i.e. barrier, arrival tokens and tensor map descriptor.
Vector(Intern<Type>, usize)
Vector wrapping n storage elements
Semantic(SemanticType)
No defined physical representation, purely semantic. i.e. barrier, pipeline
Atomic(Intern<Type>)
Atomically accessed version of Type
Pointer(Intern<Type>, AddressSpace)
Pointer of Type into a PointerClass
Array(Intern<Type>, usize)
Statically sized array of Types
DynamicArray(Intern<Type>)
Dynamically sized array of Types
Matrix(MatrixType)
Cooperative Matrix
Aggregate(AggregateKind)
Implementations§
Source§impl Type
impl Type
pub fn intern(self) -> Intern<Type>
Sourcepub fn new(storage: StorageType) -> Type
pub fn new(storage: StorageType) -> Type
Create a new item
pub fn scalar(elem: ElemType) -> Type
pub fn semantic(ty: SemanticType) -> Type
pub fn atomic(ty: impl Into<Type>) -> Type
pub fn with_vector_size(self, vector_size: usize) -> Type
pub fn pointer(ty: impl Into<Type>, class: AddressSpace) -> Type
pub fn array(ty: impl Into<Type>, size: usize) -> Type
pub fn vector_size(&self) -> usize
pub fn array_size(&self) -> usize
pub fn align(&self) -> usize
pub fn size(&self) -> usize
pub fn size_bits(&self) -> usize
pub fn packing_factor(&self) -> usize
pub fn is_atomic(&self) -> bool
pub fn is_ptr(&self) -> bool
pub fn is_int(&self) -> bool
pub fn is_signed_int(&self) -> bool
pub fn is_unsigned_int(&self) -> bool
pub fn is_float(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn storage_type(&self) -> StorageType
pub fn as_scalar(&self) -> Type
Sourcepub fn scalar_value_type(&self) -> Type
pub fn scalar_value_type(&self) -> Type
Utility mainly for use in cubecl-cpu
pub fn is_semantic(&self) -> bool
pub fn constant(&self, value: ConstantValue) -> Value
pub fn unwrap_ptr(&self) -> Type
pub fn address_space(&self) -> Option<AddressSpace>
pub fn value_type(&self) -> Type
pub fn is_array_like(&self) -> bool
Sourcepub fn is_destructurable(&self) -> bool
pub fn is_destructurable(&self) -> bool
Whether a type is destructurable. This implies that
- it does not have dynamic field offsets (i.e.
Array) - it can exist in registers (i.e. no
BarrierorAtomic)
pub fn is_value(&self) -> bool
Trait Implementations§
impl Copy for Type
Source§impl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Type, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Type, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Type
Source§impl From<OpaqueType> for Type
impl From<OpaqueType> for Type
Source§fn from(val: OpaqueType) -> Type
fn from(val: OpaqueType) -> Type
Converts to this type from the input type.
Source§impl From<SemanticType> for Type
impl From<SemanticType> for Type
Source§fn from(val: SemanticType) -> Type
fn from(val: SemanticType) -> Type
Converts to this type from the input type.
Source§impl Hash for Type
Intern hashes the pointer, not the values, leading to unstable hashes across runs.
Fix this by manually hashing the value.
impl Hash for Type
Intern hashes the pointer, not the values, leading to unstable hashes across runs.
Fix this by manually hashing the value.
Source§impl Ord for Type
impl Ord for Type
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Type
impl PartialOrd for Type
Source§impl Serialize for Type
impl Serialize for Type
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnsafeUnpin for Type
impl UnwindSafe for Type
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
impl<T> CacheKey for T
impl<T> CacheValue for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> CompilationArg for T
impl<T> CompilationArg for T
Source§fn dynamic_cast<Arg>(&self) -> Argwhere
Arg: CompilationArg,
fn dynamic_cast<Arg>(&self) -> Argwhere
Arg: CompilationArg,
Compilation args should be the same even with different element types. However, it isn’t
possible to enforce it with the type system. So, we make the compilation args serializable
and dynamically cast them. Read more
impl<T> CubeComptime for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more