Skip to main content

ValuePtr

Struct ValuePtr 

Source
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>

Source

pub fn offset(&self, offset: usize) -> Self

Source

pub fn read_only(&self) -> ValuePtr<E, S, ReadOnly>

Source

pub fn select(&self, condition: bool, otherwise: Self) -> Self

Source

pub fn load(&self) -> E

Source

pub fn native_address(&self) -> u64

Export a byte address on backends that support native-address operations.

Source

pub fn __expand_offset( scope: &mut Scope, this: <Self as RudaType>::ExpandType, offset: <usize as RudaType>::ExpandType, ) -> <Self as RudaType>::ExpandType

Source

pub fn __expand_read_only( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <ValuePtr<E, S, ReadOnly> as RudaType>::ExpandType

Source

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

Source

pub fn __expand_load( scope: &mut Scope, this: <Self as RudaType>::ExpandType, ) -> <E as RudaType>::ExpandType

Source

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>

Source

pub fn store(&self, value: E)

Source

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>

Source

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.

Source

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>

Source

pub fn atomic_load(&self) -> E

Source

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>

Source

pub fn swap(&self, value: E) -> E

Source

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>

Source

pub fn fetch_add(&self, value: E) -> E

Source

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>

Source

pub fn fetch_sub(&self, value: E) -> E

Source

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>

Source

pub fn fetch_min(&self, value: E) -> E

Source

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>

Source

pub fn fetch_max(&self, value: E) -> E

Source

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>

Source

pub fn atomic_store(&self, value: E)

Source

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>

Source

pub fn fetch_and(&self, value: E) -> E

Source

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>

Source

pub fn fetch_or(&self, value: E) -> E

Source

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>

Source

pub fn fetch_xor(&self, value: E) -> E

Source

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>

Source

pub fn compare_exchange_weak(&self, compare: E, value: E) -> E

Source

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>

Source§

fn expand_assign(&mut self, _: &mut Scope, value: Self)

Assign value to self in scope.
Source§

fn init_mut(&self, _: &mut Scope) -> Self

Create a new mutable variable of this type in scope.
Source§

impl<E: Clone + RudaPrimitive, S: Clone + PointerSpace, A: Clone + PointerPermission> Clone for ValuePtr<E, S, A>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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>

Source§

type RuntimeArg<R: Runtime> = <Array<E> as LaunchArg>::RuntimeArg<R>

The runtime argument for the kernel.
Source§

type CompilationArg = <Array<E> as LaunchArg>::CompilationArg

Compilation argument.
Source§

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

Register an input variable during compilation that fill the KernelBuilder.
Source§

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>

Source§

impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for ValuePtr<E, S, A>

Source§

impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for &ValuePtr<E, S, A>

Source§

impl<E: RudaPrimitive, S: PointerSpace, A: PointerPermission> RudaType for &mut 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<C> CloneExpand for C
where C: Clone,

Source§

fn __expand_clone_method(&self, _scope: &mut Scope) -> C

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoComptime for T

Source§

fn comptime(self) -> Self

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.