| CUTLASS CUDA Templates for Linear Algebra Subroutines and Solvers

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Attributes | List of all members
cutlass::TensorRef< Element_, Layout_ > Class Template Reference

`#include <tensor_ref.h>`

Inheritance diagram for cutlass::TensorRef< Element_, Layout_ >:
[legend]

## Public Types
using | Element = Element_
| Data type of individual access. More...
using | Layout = Layout_
| Mapping function from logical coordinate to linear memory. More...
using | Reference = typename platform::conditional< sizeof_bits< Element >::value >=8, Element &, SubbyteReference< Element > >::type
| Reference type to an element. More...
using | Index = typename Layout::Index
| Index type. More...
using | LongIndex = typename Layout::LongIndex
| Long index used for pointer offsets. More...
using | TensorCoord = typename Layout::TensorCoord
| Coordinate in logical tensor space. More...
using | Stride = typename Layout::Stride
| Layout's stride vector. More...
using | ConstTensorRef = TensorRef< typename platform::remove_const< Element >::type const, Layout >
| TensorRef to constant data. More...
using | NonConstTensorRef = TensorRef< typename platform::remove_const< Element >::type, Layout >
| TensorRef to non-constant data. More...

## Public Member Functions
CUTLASS_HOST_DEVICE | TensorRef (Element *ptr=nullptr, Layout const &layout=Layout())
| Constructs a TensorRef with a pointer and layout object. More...
CUTLASS_HOST_DEVICE | TensorRef (NonConstTensorRef const &ref)
| Converting constructor from TensorRef to non-constant data. More...
CUTLASS_HOST_DEVICE ConstTensorRef | const_ref () const
| Returns a reference to constant-valued tensor. More...
CUTLASS_HOST_DEVICE NonConstTensorRef | non_const_ref () const
CUTLASS_HOST_DEVICE void | reset (Element *ptr=nullptr)
| Updates only the pointer. More...
CUTLASS_HOST_DEVICE void | reset (Element *ptr, Layout const &layout)
| Updates the pointer and layout object. More...
CUTLASS_HOST_DEVICE bool | good () const
| Returns true if the TensorRef is non-null. More...
CUTLASS_HOST_DEVICE Element * | data () const
| Returns the pointer to referenced data. More...
CUTLASS_HOST_DEVICE Reference | data (LongIndex idx) const
| Returns a reference to the element at a given linear index. More...
CUTLASS_HOST_DEVICE Layout & | layout ()
| Returns the layout object. More...
CUTLASS_HOST_DEVICE Layout | layout () const
| Returns the layout object. More...
CUTLASS_HOST_DEVICE Stride | stride () const
| Returns the layout object's stride vector. More...
CUTLASS_HOST_DEVICE Stride & | stride ()
| Returns the layout object's stride vector. More...
CUTLASS_HOST_DEVICE Index | stride (int dim) const
| Returns the layout object's stride in a given physical dimension. More...
CUTLASS_HOST_DEVICE Index & | stride (int dim)
| Returns the layout object's stride in a given physical dimension. More...
CUTLASS_HOST_DEVICE LongIndex | offset (TensorCoord const &coord) const
| Computes the offset of an index from the origin of the tensor. More...
CUTLASS_HOST_DEVICE Reference | at (TensorCoord const &coord) const
| Returns a reference to the element at a given Coord. More...
CUTLASS_HOST_DEVICE Reference | operator[] (TensorCoord const &coord) const
| Returns a reference to the element at a given Coord. More...
CUTLASS_HOST_DEVICE TensorRef & | add_pointer_offset (LongIndex offset_)
| Adds an offset to each pointer. More...
CUTLASS_HOST_DEVICE TensorRef & | add_coord_offset (TensorCoord const &coord)
| Adds an offset to each pointer. More...
CUTLASS_HOST_DEVICE TensorRef | operator+ (TensorCoord const &b) const
| Returns a TensorRef offset by a given amount. More...
CUTLASS_HOST_DEVICE TensorRef & | operator+= (TensorCoord const &b)
| Returns a TensorRef offset by a given amount. More...
CUTLASS_HOST_DEVICE TensorRef | operator- (TensorCoord const &b) const
| Returns a TensorRef offset by a given amount. More...
CUTLASS_HOST_DEVICE TensorRef & | operator-= (TensorCoord const &b)
| Returns a TensorRef offset by a given amount. More...

## Static Public Attributes
static int const | kRank = Layout::kRank
| Logical rank of tensor index space. More...

## Member Typedef Documentation

template<typename Element_, typename Layout_>

using cutlass::TensorRef< Element_, Layout_ >::ConstTensorRef = TensorRef< typename platform::remove_const<Element>::type const, Layout>

template<typename Element_, typename Layout_>

using cutlass::TensorRef< Element_, Layout_ >::Element = Element_

template<typename Element_, typename Layout_>

using cutlass::TensorRef< Element_, Layout_ >::Index = typename Layout::Index

template<typename Element_, typename Layout_>

using cutlass::TensorRef< Element_, Layout_ >::Layout = Layout_

template<typename Element_, typename Layout_>

using cutlass::TensorRef< Element_, Layout_ >::LongIndex = typename Layout::LongIndex

template<typename Element_, typename Layout_>

using cutlass::TensorRef< Element_, Layout_ >::NonConstTensorRef = TensorRef< typename platform::remove_const<Element>::type, Layout>

template<typename Element_, typename Layout_>

using cutlass::TensorRef< Element_, Layout_ >::Reference = typename platform::conditional< sizeof_bits<Element>::value >= 8, Element &, SubbyteReference<Element> >::type

template<typename Element_, typename Layout_>

using cutlass::TensorRef< Element_, Layout_ >::Stride = typename Layout::Stride

template<typename Element_, typename Layout_>

using cutlass::TensorRef< Element_, Layout_ >::TensorCoord = typename Layout::TensorCoord

## Constructor & Destructor Documentation

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE cutlass::TensorRef< Element_, Layout_ >::TensorRef | ( | Element * | ptr = `nullptr`,
|  | Layout const & | layout = `Layout()`
| ) |  |
| inline

Parameters

  ptr | pointer to start of tensor
  layout | layout object containing stride and mapping function

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE cutlass::TensorRef< Element_, Layout_ >::TensorRef | ( | NonConstTensorRef< Element_, Layout_ > const & | ref | ) |
| inline

Parameters

  ref | TensorRef to non-const data

## Member Function Documentation

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE TensorRef& cutlass::TensorRef< Element_, Layout_ >::add_coord_offset | ( | TensorCoord const & | coord | ) |
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE TensorRef& cutlass::TensorRef< Element_, Layout_ >::add_pointer_offset | ( | LongIndex | offset_ | ) |
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Reference cutlass::TensorRef< Element_, Layout_ >::at | ( | TensorCoord const & | coord | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE ConstTensorRef cutlass::TensorRef< Element_, Layout_ >::const_ref | ( |  | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Element* cutlass::TensorRef< Element_, Layout_ >::data | ( |  | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Reference cutlass::TensorRef< Element_, Layout_ >::data | ( | LongIndex | idx | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE bool cutlass::TensorRef< Element_, Layout_ >::good | ( |  | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Layout& cutlass::TensorRef< Element_, Layout_ >::layout | ( |  | ) |
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Layout cutlass::TensorRef< Element_, Layout_ >::layout | ( |  | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE NonConstTensorRef cutlass::TensorRef< Element_, Layout_ >::non_const_ref | ( |  | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE LongIndex cutlass::TensorRef< Element_, Layout_ >::offset | ( | TensorCoord const & | coord | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE TensorRef cutlass::TensorRef< Element_, Layout_ >::operator+ | ( | TensorCoord const & | b | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE TensorRef& cutlass::TensorRef< Element_, Layout_ >::operator+= | ( | TensorCoord const & | b | ) |
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE TensorRef cutlass::TensorRef< Element_, Layout_ >::operator- | ( | TensorCoord const & | b | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE TensorRef& cutlass::TensorRef< Element_, Layout_ >::operator-= | ( | TensorCoord const & | b | ) |
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Reference cutlass::TensorRef< Element_, Layout_ >::operator[] | ( | TensorCoord const & | coord | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE void cutlass::TensorRef< Element_, Layout_ >::reset | ( | Element * | ptr = `nullptr` | ) |
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE void cutlass::TensorRef< Element_, Layout_ >::reset | ( | Element * | ptr,
|  | Layout const & | layout
| ) |  |
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Stride cutlass::TensorRef< Element_, Layout_ >::stride | ( |  | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Stride& cutlass::TensorRef< Element_, Layout_ >::stride | ( |  | ) |
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Index cutlass::TensorRef< Element_, Layout_ >::stride | ( | int | dim | ) | const
| inline

template<typename Element_, typename Layout_>

CUTLASS_HOST_DEVICE Index& cutlass::TensorRef< Element_, Layout_ >::stride | ( | int | dim | ) |
| inline

## Member Data Documentation

template<typename Element_, typename Layout_>

int const cutlass::TensorRef< Element_, Layout_ >::kRank = Layout::kRank
| static

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

- tensor_ref.h