CUTLASS
CUDA Templates for Linear Algebra Subroutines and Solvers
|
#include <subbyte_reference.h>
Public Types | |
using | Element = Element_ |
using | Storage = Storage_ |
using | StoragePointer = Storage const * |
Public Member Functions | |
CUTLASS_HOST_DEVICE | ConstSubbyteReference () |
CUTLASS_HOST_DEVICE | ConstSubbyteReference (Element const *ptr, int64_t offset) |
Constructor. More... | |
CUTLASS_HOST_DEVICE | ConstSubbyteReference (Element *ptr=nullptr) |
Constructor. More... | |
CUTLASS_HOST_DEVICE StoragePointer | storage_pointer () const |
Gets storage pointer. More... | |
CUTLASS_HOST_DEVICE int | element_offset () const |
Gets element offset within storage vector. More... | |
CUTLASS_HOST_DEVICE Element | get () const |
Unpacks an element from memory. More... | |
CUTLASS_HOST_DEVICE | operator Element () const |
Unpacks an element from memory. More... | |
CUTLASS_HOST_DEVICE ConstSubbyteReference & | operator+= (int offset) |
Adds an offset in units of elements to the reference. More... | |
CUTLASS_HOST_DEVICE ConstSubbyteReference & | operator+= (long long offset) |
Adds an offset in units of elements to the reference. More... | |
CUTLASS_HOST_DEVICE ConstSubbyteReference & | operator-= (int offset) |
Adds an offset in units of elements to the reference. More... | |
CUTLASS_HOST_DEVICE ConstSubbyteReference & | operator-= (long long offset) |
Adds an offset in units of elements to the reference. More... | |
CUTLASS_HOST_DEVICE ConstSubbyteReference | operator+ (int offset) const |
Returns a reference to an element with a given offset from the current reference. More... | |
CUTLASS_HOST_DEVICE ConstSubbyteReference | operator+ (long long offset) const |
Returns a reference to an element with a given offset from the current reference. More... | |
CUTLASS_HOST_DEVICE ConstSubbyteReference | operator- (int offset) const |
Returns a reference to an element with a given offset from the current reference. More... | |
CUTLASS_HOST_DEVICE ConstSubbyteReference | operator-= (long long offset) const |
Returns a reference to an element with a given offset from the current reference. More... | |
CUTLASS_HOST_DEVICE ptrdiff_t | operator- (ConstSubbyteReference ref) const |
Computes the difference in elements between references. More... | |
CUTLASS_HOST_DEVICE | operator int () const |
Explicit cast to int. More... | |
CUTLASS_HOST_DEVICE | operator int64_t () const |
Explicit cast to signed 64-bit integer. More... | |
CUTLASS_HOST_DEVICE | operator uint64_t () const |
Explicit cast to unsigned 64-bit integer. More... | |
CUTLASS_HOST_DEVICE | operator float () const |
Explicit cast to float. More... | |
CUTLASS_HOST_DEVICE | operator double () const |
Explicit cast to double. More... | |
This class provides a mechanism for packing and unpacking elements smaller than one byte. It assumes these sub-byte elements are packed in a traditional C++ numeric type.
The intended application is to provide a mechanism to indirectly reference elements in memory or Array<> objects whose addresses cannot otherwise be taken since they are smaller than one byte.
Supports basic pointer arithmetic:
Example:
int4b_t *ptr = ...;
SubbyteReference<int4b_t> ref = ptr; ref += 15;
int4b_t x = ref; // load an int4b_t ref = x + 2_s4; // perform arithmetic on int4b_t and then store
using cutlass::ConstSubbyteReference< Element_, Storage_ >::Element = Element_ |
using cutlass::ConstSubbyteReference< Element_, Storage_ >::Storage = Storage_ |
using cutlass::ConstSubbyteReference< Element_, Storage_ >::StoragePointer = Storage const * |
|
inline |
|
inline |
offset | pointer to memory logical offset in units of Element |
|
inline |
|
inline |
|
inline |
|
inlineexplicit |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |