pub struct ValuePtr<E: RudaPrimitive, S: PointerSpace, A: PointerPermission = ReadOnly> { /* private fields */ }Expand description
A first-class pointer value. Its address space and permissions are statically distinct.
ⓘ
use ruda_kernel::dsl::prelude::{GlobalSpace, ValuePtr};
fn write(pointer: ValuePtr<f32, GlobalSpace>) { pointer.store(1.0); }ⓘ
use ruda_kernel::dsl::prelude::{GlobalSpace, ValuePtr, Workgroup};
fn global(_: ValuePtr<f32, GlobalSpace>) {}
fn shared(pointer: ValuePtr<f32, Workgroup>) { global(pointer); }ⓘ
use ruda_kernel::dsl::prelude::{Atomic, GlobalSpace, ValuePtr};
fn mutate(pointer: ValuePtr<Atomic<u32>, GlobalSpace>) { pointer.fetch_add(1); }Implementations§
Source§impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> ValuePtr<E, S, A>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> ValuePtr<E, S, A>
pub fn offset(&self, offset: usize) -> Self
pub fn read_only(&self) -> ValuePtr<E, S, ReadOnly>
pub fn select(&self, condition: bool, otherwise: Self) -> Self
pub fn load(&self) -> E
Sourcepub fn native_address(&self) -> u64
pub fn native_address(&self) -> u64
Export a byte address on backends that support native-address operations.
pub fn __expand_offset( scope: &mut Scope, this: <Self as RudaType>::ExpandType, offset: <usize as RudaType>::ExpandType, ) -> <Self as RudaType>::ExpandType
pub fn __expand_read_only( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <ValuePtr<E, S, ReadOnly> as RudaType>::ExpandType
pub fn __expand_select( scope: &mut Scope, this: <Self as RudaType>::ExpandType, condition: <bool as RudaType>::ExpandType, otherwise: <Self as RudaType>::ExpandType, ) -> <Self as RudaType>::ExpandType
pub fn __expand_load( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
pub fn __expand_native_address( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <u64 as RudaType>::ExpandType
Source§impl<E: RudaPrimitive, S: PointerSpace> ValuePtr<E, S, ReadWrite>
impl<E: RudaPrimitive, S: PointerSpace> ValuePtr<E, S, ReadWrite>
pub fn store(&self, value: E)
pub fn __expand_store( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <() as RudaType>::ExpandType
Source§impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> ValuePtr<E, S, A>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> ValuePtr<E, S, A>
Sourcepub fn from_native(address: u64) -> Self
pub fn from_native(address: u64) -> Self
Import a valid, aligned byte address in S. The allocation must outlive kernel execution;
its address space, permissions and length are the caller’s responsibility. Native backends only.
pub fn __expand_from_native( scope: &mut Scope, address: <u64 as RudaType>::ExpandType, ) -> <Self as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace, A: PointerPermission> ValuePtr<Atomic<E>, S, A>
impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace, A: PointerPermission> ValuePtr<Atomic<E>, S, A>
pub fn atomic_load(&self) -> E
pub fn __expand_atomic_load( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn swap(&self, value: E) -> E
pub fn __expand_swap( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn fetch_add(&self, value: E) -> E
pub fn __expand_fetch_add( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn fetch_sub(&self, value: E) -> E
pub fn __expand_fetch_sub( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn fetch_min(&self, value: E) -> E
pub fn __expand_fetch_min( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn fetch_max(&self, value: E) -> E
pub fn __expand_fetch_max( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Numeric>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn atomic_store(&self, value: E)
pub fn __expand_atomic_store( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <() as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Int>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Int>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn fetch_and(&self, value: E) -> E
pub fn __expand_fetch_and( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Int>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Int>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn fetch_or(&self, value: E) -> E
pub fn __expand_fetch_or( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Int>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Int>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn fetch_xor(&self, value: E) -> E
pub fn __expand_fetch_xor( scope: &mut Scope, this: <Self as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Source§impl<E: RudaPrimitive<Scalar: Int>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
impl<E: RudaPrimitive<Scalar: Int>, S: PointerSpace> ValuePtr<Atomic<E>, S, ReadWrite>
pub fn compare_exchange_weak(&self, compare: E, value: E) -> E
pub fn __expand_compare_exchange_weak( scope: &mut Scope, this: <Self as RudaType>::ExpandType, compare: <E as RudaType>::ExpandType, value: <E as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType
Trait Implementations§
Source§impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> Assign for ValuePtr<E, S, A>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> Assign for ValuePtr<E, S, A>
Source§impl<E: Clone + RudaPrimitive, S: Clone + PointerSpace, A: Clone + PointerPermission> Clone for ValuePtr<E, S, A>
impl<E: Clone + RudaPrimitive, S: Clone + PointerSpace, A: Clone + PointerPermission> Clone for ValuePtr<E, S, A>
impl<E: Copy + RudaPrimitive, S: Copy + PointerSpace, A: Copy + PointerPermission> Copy for ValuePtr<E, S, A>
Source§impl<E: RudaPrimitive, A: PointerPermission> LaunchArg for ValuePtr<E, GlobalSpace, A>
impl<E: RudaPrimitive, A: PointerPermission> LaunchArg for ValuePtr<E, GlobalSpace, A>
Source§type RuntimeArg<R: Runtime> = <Array<E> as LaunchArg>::RuntimeArg<R>
type RuntimeArg<R: Runtime> = <Array<E> as LaunchArg>::RuntimeArg<R>
The runtime argument for the kernel.
Source§type CompilationArg = <Array<E> as LaunchArg>::CompilationArg
type CompilationArg = <Array<E> as LaunchArg>::CompilationArg
Compilation argument.
fn register<R: Runtime>( arg: Self::RuntimeArg<R>, launcher: &mut KernelLauncher<R>, ) -> Self::CompilationArg
Source§fn expand(
arg: &Self::CompilationArg,
builder: &mut KernelBuilder,
) -> Self::ExpandType
fn expand( arg: &Self::CompilationArg, builder: &mut KernelBuilder, ) -> Self::ExpandType
Register an input variable during compilation that fill the
KernelBuilder.Source§fn expand_output(
arg: &Self::CompilationArg,
builder: &mut KernelBuilder,
) -> Self::ExpandType
fn expand_output( arg: &Self::CompilationArg, builder: &mut KernelBuilder, ) -> Self::ExpandType
Register an output variable during compilation that fill the
KernelBuilder.Source§impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> NativeAssign for ValuePtr<E, S, A>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> NativeAssign for ValuePtr<E, S, A>
fn elem_init_mut(scope: &mut Scope, elem: ManagedVariable) -> ManagedVariable
Source§impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for ValuePtr<E, S, A>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for ValuePtr<E, S, A>
type ExpandType = NativeExpand<ValuePtr<E, S, A>>
Source§impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for &ValuePtr<E, S, A>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for &ValuePtr<E, S, A>
type ExpandType = NativeExpand<ValuePtr<E, S, A>>
Source§impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for &mut ValuePtr<E, S, A>
impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for &mut ValuePtr<E, S, A>
type ExpandType = NativeExpand<ValuePtr<E, S, A>>
Auto Trait Implementations§
impl<E, S, A> Freeze for ValuePtr<E, S, A>
impl<E, S, A> RefUnwindSafe for ValuePtr<E, S, A>
impl<E, S, A> Send for ValuePtr<E, S, A>
impl<E, S, A> Sync for ValuePtr<E, S, A>
impl<E, S, A> Unpin for ValuePtr<E, S, A>
impl<E, S, A> UnsafeUnpin for ValuePtr<E, S, A>
impl<E, S, A> UnwindSafe for ValuePtr<E, S, A>
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