pub struct MemoryMapper;Expand description
Maps CUDA memory spaces to Rust and WGSL equivalents.
Implementations§
Source§impl MemoryMapper
impl MemoryMapper
Sourcepub fn to_rust(storage: &StorageClass) -> MemoryMapping
pub fn to_rust(storage: &StorageClass) -> MemoryMapping
Map a CUDA StorageClass to its Rust representation.
Sourcepub fn rust_var_prefix(storage: &StorageClass, mutable: bool) -> String
pub fn rust_var_prefix(storage: &StorageClass, mutable: bool) -> String
Generate a Rust variable declaration prefix for the given storage class.
§Examples
StorageClass::Shared->"/* __shared__ */ let mut "StorageClass::Constant->"const "StorageClass::Auto->"let "
Sourcepub fn to_wgsl(storage: &StorageClass) -> MemoryMapping
pub fn to_wgsl(storage: &StorageClass) -> MemoryMapping
Map a CUDA StorageClass to its WGSL representation.
Sourcepub fn wgsl_var_decl(
storage: &StorageClass,
name: &str,
wgsl_type: &str,
) -> String
pub fn wgsl_var_decl( storage: &StorageClass, name: &str, wgsl_type: &str, ) -> String
Sourcepub fn wgsl_binding_decl(
storage: &StorageClass,
group: u32,
binding: u32,
name: &str,
wgsl_type: &str,
read_only: bool,
) -> String
pub fn wgsl_binding_decl( storage: &StorageClass, group: u32, binding: u32, name: &str, wgsl_type: &str, read_only: bool, ) -> String
Generate a WGSL binding declaration for a kernel parameter.
§Arguments
storage- The CUDA storage classgroup- Binding group numberbinding- Binding indexname- Variable namewgsl_type- WGSL type stringread_only- Whether the binding is read-only
Sourcepub fn parse_cuda_qualifier(qualifier: &str) -> StorageClass
pub fn parse_cuda_qualifier(qualifier: &str) -> StorageClass
Parse a CUDA memory space qualifier string into a StorageClass.
Sourcepub fn requires_barrier(storage: &StorageClass) -> bool
pub fn requires_barrier(storage: &StorageClass) -> bool
Returns true if the storage class requires barrier synchronisation before other threads can see writes.
Sourcepub fn is_read_only(storage: &StorageClass) -> bool
pub fn is_read_only(storage: &StorageClass) -> bool
Returns true if the storage class is read-only.
Sourcepub fn wgsl_barrier(storage: &StorageClass) -> Option<&'static str>
pub fn wgsl_barrier(storage: &StorageClass) -> Option<&'static str>
Returns the WGSL barrier function name needed after writes to this memory space, if any.
Sourcepub fn rust_barrier(storage: &StorageClass) -> Option<&'static str>
pub fn rust_barrier(storage: &StorageClass) -> Option<&'static str>
Returns the Rust synchronization primitive needed after writes to this memory space, if any.
Auto Trait Implementations§
impl Freeze for MemoryMapper
impl RefUnwindSafe for MemoryMapper
impl Send for MemoryMapper
impl Sync for MemoryMapper
impl Unpin for MemoryMapper
impl UnsafeUnpin for MemoryMapper
impl UnwindSafe for MemoryMapper
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