pub trait UnalignedVectorExpand<E: Scalar, N: Size> {
// Required methods
fn __expand_unaligned_vector_read_method(
self,
scope: &mut Scope,
index: <usize as RudaType>::ExpandType,
) -> <Vector<E, N> as RudaType>::ExpandType;
fn __expand_unaligned_vector_write_method(
self,
scope: &mut Scope,
index: <usize as RudaType>::ExpandType,
value: <Vector<E, N> as RudaType>::ExpandType,
) -> <() as RudaType>::ExpandType;
}Expand description
An extension trait for expanding the ruda frontend with the ability to request unaligned vector reads and writes
Typically in ruda, a buffer is declared as having a certain vector size
at kernel compilation time. The buffer can then be indexed to produce
vectors that are aligned to the vector_size.
This trait allows the user to request a vector_read from a buffer where the
start of the read is not aligned to the vector_read requested.
As an example, imagine a buffer of scalar length 4. With vector_size = 1,
this could be illustrated like so
[1, 2, 3, 4]
Imagine the same buffer, now with vector_size = 2.
[[1, 2], [3, 4]]
Vectors can now be accessed from this buffer, but only those that that are aligned
with the vector_size. I.e. we can get the vectors [1, 2] or [3, 4], but not [2, 3]
This trait allows you to treat the buffer as having no vector_size = 1, yet asking
for a vector of some kernel-compile-time known length at some offset in the buffer.
I.e. if for the buffer buf = [1, 2, 3, 4], buf.unaligned_vector_read(1, 2)
will produce the vector [2, 3].
Required Methods§
fn __expand_unaligned_vector_read_method( self, scope: &mut Scope, index: <usize as RudaType>::ExpandType, ) -> <Vector<E, N> as RudaType>::ExpandType
fn __expand_unaligned_vector_write_method( self, scope: &mut Scope, index: <usize as RudaType>::ExpandType, value: <Vector<E, N> as RudaType>::ExpandType, ) -> <() as RudaType>::ExpandType
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".