cuda::experimental::stf::shape_of< mdspan< T, P… > >#

template<typename T, typename ...P>
class shape_of<mdspan<T, P...>> : public cuda::experimental::stf::shape_of<T>#

Specialization of the shape template for mdspan

Copies a shape.

All shape_of specializations must define this constructor.

shape_of(const shape_of&) = default#

Extracts the shape from a given slice.

All shape_of specializations must define this constructor.

Parameters:

x – object to get the shape from

inline explicit shape_of(const described_type &x)#

Extracts the shape from a given slice.

All shape_of specializations must define this constructor.

Parameters:

x – object to get the shape from

inline explicit shape_of(const coords_t &sizes)#

Create a new shape_of object from a coords_t object.

Initializes dimensions to size0, sizes.... This constructor is optional.

Template Parameters:

Sizes – Types (all must convert to size_t implicitly)

Parameters:
  • size0 – Size for the first dimension (

  • sizes – Sizes of data for the other dimensions, one per dimension

template<typename ...Sizes>
inline explicit shape_of(
size_t size0,
Sizes&&... sizes
)#

Create a new shape_of object taking exactly dimension sizes.

Initializes dimensions to size0, sizes.... This constructor is optional.

Template Parameters:

Sizes – Types (all must convert to size_t implicitly)

Parameters:
  • size0 – Size for the first dimension (

  • sizes – Sizes of data for the other dimensions, one per dimension

Constructors

inline explicit shape_of(const ::std::array<size_t, rank()> &sizes)#
inline explicit shape_of(
const ::std::array<size_t, rank()> &sizes,
const ::std::array<size_t, rank()> &_strides
)#

Public Types

using described_type = mdspan<T, P...>#
using coords_t = array_tuple<size_t, described_type::rank()>#

Public Functions

inline auto begin()#
inline auto end()#
shape_of() = default#

The default constructor builds a shape with size 0 in all dimensions.

All shape_of specializations must define this constructor.

inline bool operator==(const shape_of &other) const#
inline constexpr size_t extent(size_t dim) const#

Returns the size of a slice in a given dimension (run-time version)

This member function is optional.

Template Parameters:

dim – The dimension to get the size for. Must be < dimensions

Returns:

size_t The size

inline constexpr size_t stride(size_t dim) const#

Get the stride for a specified dimension.

Parameters:

dim – The dimension for which to get the stride.

Returns:

The stride for the specified dimension.

inline size_t size() const#

Total size of the slice in all dimensions (product of the sizes)

This member function is optional.

Returns:

size_t The total size

inline ::std::array<size_t, rank()> get_sizes() const#

Returns an array with sizes in all dimensions.

Returns:

const std::array<size_t, dimensions>&

inline dim4 get_data_dims() const#

Returns the extents as a dim4 type.

Returns:

const dim4

void set_contiguous_strides(
const ::std::array<size_t, rank()> &sizes
)#

Set contiguous strides based on the provided sizes.

Note

This function should not be called (calling it will engender a link-time error).

Parameters:

sizes – The sizes to set the contiguous strides.

inline described_type create(T *base) const#

Create a new described_type object with the given base pointer.

Parameters:

base – Base pointer to create the described_type object.

Returns:

described_type Newly created described_type object.

inline coords_t index_to_coords(size_t index) const#

Public Static Functions

static inline constexpr size_t rank()#

Dimensionality of the slice.