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

#include <tensor_view.h>

Inheritance diagram for cutlass::TensorView< Element_, Layout_ >:
Inheritance graph
[legend]
Collaboration diagram for cutlass::TensorView< Element_, Layout_ >:
Collaboration graph
[legend]

Public Types

using Base = cutlass::TensorRef< Element_, Layout_ >
 Base tensor reference. More...
 
using Layout = Layout_
 Mapping function from logical coordinate to internal n-D array. More...
 
using ConstTensorRef = typename Base::ConstTensorRef
 TensorRef pointing to constant memory. More...
 
using TensorRef = Base
 Underlying TensorRef type. More...
 
using Element = Element_
 Data type of individual access. More...
 
using Reference = Element &
 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
 Coordinate in storage n-D array. More...
 
using ConstTensorView = TensorView< typename platform::remove_const< Element >::type const, Layout >
 TensorView pointing to constant memory. More...
 
using NonConstTensorView = TensorView< typename platform::remove_const< Element >::type, Layout >
 TensorView pointing to non-constant memory. More...
 
- Public Types inherited from cutlass::TensorRef< Element_, Layout_ >
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 TensorView (TensorCoord const &extent=TensorCoord())
 Constructs a TensorView object. More...
 
CUTLASS_HOST_DEVICE TensorView (Element *ptr, Layout const &layout, TensorCoord const &extent)
 Constructs a TensorView object. More...
 
CUTLASS_HOST_DEVICE TensorView (TensorRef const &ref, TensorCoord const &extent)
 Constructs a TensorView object. More...
 
CUTLASS_HOST_DEVICE TensorView (NonConstTensorView const &view)
 Converting constructor from TensorRef to non-constant data. More...
 
CUTLASS_HOST_DEVICE void reset (Element *ptr, Layout const &layout, TensorCoord size)
 Updates the pointer and layout object. More...
 
CUTLASS_HOST_DEVICE void resize (TensorCoord extent)
 Changes the size of the view without affecting pointer or layout. More...
 
CUTLASS_HOST_DEVICE TensorCoord const & extent () const
 Returns the extent of the view (the size along each logical dimension). More...
 
CUTLASS_HOST_DEVICE Index extent (int dim) const
 Returns the extent along a particular logical dimension. More...
 
CUTLASS_HOST_DEVICE bool contains (TensorCoord const &coord) const
 Determines whether a location is within a tensor. More...
 
CUTLASS_HOST_DEVICE TensorRef ref () const
 Returns a TensorRef pointing to the first element of the tensor. More...
 
CUTLASS_HOST_DEVICE ConstTensorRef const_ref () const
 Returns a TensorRef pointing to the first element of the tensor. More...
 
CUTLASS_HOST_DEVICE ConstTensorView const_view () const
 Returns a TensorView to const data. More...
 
CUTLASS_HOST_DEVICE TensorView subview (TensorCoord extent, TensorCoord const &location=TensorCoord()) const
 Returns a Tensor_view given location and size quantities. More...
 
CUTLASS_HOST_DEVICE size_t capacity () const
 Returns the number of scalar elements needed to store tensor. More...
 
CUTLASS_HOST_DEVICE TensorView operator+ (TensorCoord const &b) const
 Returns a TensorView offset by a given amount. More...
 
CUTLASS_HOST_DEVICE TensorViewoperator+= (TensorCoord const &b)
 Returns a TensorRef offset by a given amount. More...
 
CUTLASS_HOST_DEVICE TensorView operator- (TensorCoord const &b) const
 Returns a TensorRef offset by a given amount. More...
 
CUTLASS_HOST_DEVICE TensorViewoperator-= (TensorCoord const &b)
 Returns a TensorRef offset by a given amount. More...
 
- Public Member Functions inherited from cutlass::TensorRef< Element_, Layout_ >
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 Elementdata () 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 Layoutlayout ()
 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 Stridestride ()
 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 Indexstride (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 TensorRefadd_pointer_offset (LongIndex offset_)
 Adds an offset to each pointer. More...
 
CUTLASS_HOST_DEVICE TensorRefadd_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 TensorRefoperator+= (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 TensorRefoperator-= (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...
 
- Static Public Attributes inherited from cutlass::TensorRef< Element_, Layout_ >
static int const kRank = Layout::kRank
 Logical rank of tensor index space. More...
 

Member Typedef Documentation

template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::Base = cutlass::TensorRef<Element_, Layout_>
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::ConstTensorRef = typename Base::ConstTensorRef
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::ConstTensorView = TensorView< typename platform::remove_const<Element>::type const, Layout>
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::Element = Element_
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::Index = typename Layout::Index
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::Layout = Layout_
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::LongIndex = typename Layout::LongIndex
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::NonConstTensorView = TensorView< typename platform::remove_const<Element>::type, Layout>
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::Reference = Element &
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::Stride = typename Layout::Stride
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::TensorCoord = typename Layout::TensorCoord
template<typename Element_, typename Layout_>
using cutlass::TensorView< Element_, Layout_ >::TensorRef = Base

Constructor & Destructor Documentation

template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE cutlass::TensorView< Element_, Layout_ >::TensorView ( TensorCoord const &  extent = TensorCoord())
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE cutlass::TensorView< Element_, Layout_ >::TensorView ( Element ptr,
Layout const &  layout,
TensorCoord const &  extent 
)
inline
Parameters
ptrpointer to start of tensor
layoutlayout object containing stride and mapping function
extentsize of the view in logical coordinates
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE cutlass::TensorView< Element_, Layout_ >::TensorView ( TensorRef const &  ref,
TensorCoord const &  extent 
)
inline
Parameters
refpointer and layout object referencing a tensor
extentlogical size of tensor
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE cutlass::TensorView< Element_, Layout_ >::TensorView ( NonConstTensorView< Element_, Layout_ > const &  view)
inline
Parameters
viewTensorView to non-const data

Member Function Documentation

template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE size_t cutlass::TensorView< Element_, Layout_ >::capacity ( ) const
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE ConstTensorRef cutlass::TensorView< Element_, Layout_ >::const_ref ( ) const
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE ConstTensorView cutlass::TensorView< Element_, Layout_ >::const_view ( ) const
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE bool cutlass::TensorView< Element_, Layout_ >::contains ( TensorCoord const &  coord) const
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE TensorCoord const& cutlass::TensorView< Element_, Layout_ >::extent ( ) const
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE Index cutlass::TensorView< Element_, Layout_ >::extent ( int  dim) const
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE TensorView cutlass::TensorView< Element_, Layout_ >::operator+ ( TensorCoord const &  b) const
inline
Parameters
boffset in the logical coordinate space of the tensor
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE TensorView& cutlass::TensorView< Element_, Layout_ >::operator+= ( TensorCoord const &  b)
inline
Parameters
boffset in the logical coordinate space of the tensor
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE TensorView cutlass::TensorView< Element_, Layout_ >::operator- ( TensorCoord const &  b) const
inline
Parameters
boffset in the logical coordinate space of the tensor
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE TensorView& cutlass::TensorView< Element_, Layout_ >::operator-= ( TensorCoord const &  b)
inline
Parameters
boffset in the logical coordinate space of the tensor
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE TensorRef cutlass::TensorView< Element_, Layout_ >::ref ( ) const
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE void cutlass::TensorView< Element_, Layout_ >::reset ( Element ptr,
Layout const &  layout,
TensorCoord  size 
)
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE void cutlass::TensorView< Element_, Layout_ >::resize ( TensorCoord  extent)
inline
template<typename Element_, typename Layout_>
CUTLASS_HOST_DEVICE TensorView cutlass::TensorView< Element_, Layout_ >::subview ( TensorCoord  extent,
TensorCoord const &  location = TensorCoord() 
) const
inline
Parameters
extentextent of the resulting view
locationresulting view's origin within the old view

Member Data Documentation

template<typename Element_, typename Layout_>
int const cutlass::TensorView< Element_, Layout_ >::kRank = Layout::kRank
static

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