pub enum Alignment {
Default,
Align256,
Align512,
Align1024,
Align4096,
Custom(usize),
}Expand description
Specifies the byte alignment for a device memory allocation.
All variants represent alignments that are powers of two. The Custom
variant is validated at allocation time.
Variants§
Default
CUDA’s default allocation alignment (typically 256 bytes).
Align256
256-byte alignment.
Align512
512-byte alignment.
Align1024
1024-byte alignment.
Align4096
4096-byte (page) alignment.
Custom(usize)
User-specified alignment in bytes (must be a power of two).
Implementations§
Source§impl Alignment
impl Alignment
Sourcepub fn bytes(&self) -> usize
pub fn bytes(&self) -> usize
Returns the alignment in bytes.
For Default, this returns 256 (the typical CUDA
allocation alignment).
Sourcepub fn is_power_of_two(&self) -> bool
pub fn is_power_of_two(&self) -> bool
Returns true if the alignment value is a power of two.
This is always true for the named variants and may be false for
Custom with an invalid value.
Sourcepub fn is_aligned(&self, ptr: u64) -> bool
pub fn is_aligned(&self, ptr: u64) -> bool
Returns true if the given device pointer satisfies this alignment.
Trait Implementations§
impl Copy for Alignment
impl Eq for Alignment
impl StructuralPartialEq for Alignment
Auto Trait Implementations§
impl Freeze for Alignment
impl RefUnwindSafe for Alignment
impl Send for Alignment
impl Sync for Alignment
impl Unpin for Alignment
impl UnsafeUnpin for Alignment
impl UnwindSafe for Alignment
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