CUTLASS
CUDA Templates for Linear Algebra Subroutines and Solvers
Public Types | Public Member Functions | List of all members
cutlass::ConstSubbyteReference< Element_, Storage_ > Class Template Reference

#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 ConstSubbyteReferenceoperator+= (int offset)
 Adds an offset in units of elements to the reference. More...
 
CUTLASS_HOST_DEVICE ConstSubbyteReferenceoperator+= (long long offset)
 Adds an offset in units of elements to the reference. More...
 
CUTLASS_HOST_DEVICE ConstSubbyteReferenceoperator-= (int offset)
 Adds an offset in units of elements to the reference. More...
 
CUTLASS_HOST_DEVICE ConstSubbyteReferenceoperator-= (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...
 

Detailed Description

template<typename Element_, typename Storage_ = uint8_t>
class cutlass::ConstSubbyteReference< Element_, Storage_ >

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

Member Typedef Documentation

template<typename Element_, typename Storage_ = uint8_t>
using cutlass::ConstSubbyteReference< Element_, Storage_ >::Element = Element_
template<typename Element_, typename Storage_ = uint8_t>
using cutlass::ConstSubbyteReference< Element_, Storage_ >::Storage = Storage_
template<typename Element_, typename Storage_ = uint8_t>
using cutlass::ConstSubbyteReference< Element_, Storage_ >::StoragePointer = Storage const *

Constructor & Destructor Documentation

template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE cutlass::ConstSubbyteReference< Element_, Storage_ >::ConstSubbyteReference ( )
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE cutlass::ConstSubbyteReference< Element_, Storage_ >::ConstSubbyteReference ( Element const *  ptr,
int64_t  offset 
)
inline
Parameters
offsetpointer to memory logical offset in units of Element
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE cutlass::ConstSubbyteReference< Element_, Storage_ >::ConstSubbyteReference ( Element ptr = nullptr)
inline

Member Function Documentation

template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE int cutlass::ConstSubbyteReference< Element_, Storage_ >::element_offset ( ) const
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE Element cutlass::ConstSubbyteReference< Element_, Storage_ >::get ( ) const
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE cutlass::ConstSubbyteReference< Element_, Storage_ >::operator double ( ) const
inlineexplicit
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE cutlass::ConstSubbyteReference< Element_, Storage_ >::operator Element ( ) const
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE cutlass::ConstSubbyteReference< Element_, Storage_ >::operator float ( ) const
inlineexplicit
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE cutlass::ConstSubbyteReference< Element_, Storage_ >::operator int ( ) const
inlineexplicit
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE cutlass::ConstSubbyteReference< Element_, Storage_ >::operator int64_t ( ) const
inlineexplicit
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE cutlass::ConstSubbyteReference< Element_, Storage_ >::operator uint64_t ( ) const
inlineexplicit
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE ConstSubbyteReference cutlass::ConstSubbyteReference< Element_, Storage_ >::operator+ ( int  offset) const
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE ConstSubbyteReference cutlass::ConstSubbyteReference< Element_, Storage_ >::operator+ ( long long  offset) const
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE ConstSubbyteReference& cutlass::ConstSubbyteReference< Element_, Storage_ >::operator+= ( int  offset)
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE ConstSubbyteReference& cutlass::ConstSubbyteReference< Element_, Storage_ >::operator+= ( long long  offset)
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE ConstSubbyteReference cutlass::ConstSubbyteReference< Element_, Storage_ >::operator- ( int  offset) const
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE ptrdiff_t cutlass::ConstSubbyteReference< Element_, Storage_ >::operator- ( ConstSubbyteReference< Element_, Storage_ >  ref) const
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE ConstSubbyteReference& cutlass::ConstSubbyteReference< Element_, Storage_ >::operator-= ( int  offset)
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE ConstSubbyteReference& cutlass::ConstSubbyteReference< Element_, Storage_ >::operator-= ( long long  offset)
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE ConstSubbyteReference cutlass::ConstSubbyteReference< Element_, Storage_ >::operator-= ( long long  offset) const
inline
template<typename Element_, typename Storage_ = uint8_t>
CUTLASS_HOST_DEVICE StoragePointer cutlass::ConstSubbyteReference< Element_, Storage_ >::storage_pointer ( ) const
inline

The documentation for this class was generated from the following file: