48 template <
int Rank_,
typename Index_ =
int>
58 static int const N = Rank_;
77 for (
int i = 0; i <
kRank; ++i) {
85 for (
int i = 0; i <
kRank; ++i) {
93 for (
int i = 0; i <
kRank; ++i) {
104 for (
int i = 0; i < Slice; ++i) {
105 if (i + start <
kRank) {
117 operator bool()
const {
118 for (
int i = 0; i <
kRank; ++i) {
129 for (
int i = 0; i <
kRank; ++i) {
141 for (
int i = 0; i <
kRank; ++i) {
151 for (
int i = 0; i <
kRank; ++i) {
161 for (
int i = 0; i <
kRank; ++i) {
171 for (
int i = 0; i <
kRank; ++i) {
180 for (
int i = 0; i <
kRank; ++i) {
189 for (
int i = 0; i <
kRank; ++i) {
198 for (
int i = 0; i <
kRank; ++i) {
207 for (
int i = 0; i <
kRank; ++i) {
220 template <
typename T>
222 for (
int i = 0; i <
kRank; ++i) {
229 template <
typename T>
232 for (
int i = 0; i <
kRank; ++i) {
262 for (
int i = 0; equal && i <
kRank; ++i) {
263 equal = (
idx[i] == b.
idx[i]);
275 for (
int i = 0; i <
kRank; ++i) {
285 for (
int i = 1; i <
kRank; ++i) {
293 bool operator<(Coord<kRank>
const &b)
const {
294 for (
int i = 0; i <
kRank; ++i) {
295 if (!(
idx[i] < b[i])) {
304 bool operator<=(Coord<kRank>
const &b)
const {
305 for (
int i = 0; i <
kRank; ++i) {
306 if (!(
idx[i] <= b[i])) {
317 template <
typename T,
int Rank,
typename Index>
321 for (
int i = 0; i < Rank; ++i) {
328 template <
typename T,
int Rank,
typename Index>
332 for (
int i = 0; i < Rank; ++i) {
339 template <
typename T,
int Rank,
typename Index>
343 for (
int i = 0; i < Rank; ++i) {
344 coord[i] = s / coord[i];
350 template <
typename T,
int Rank,
typename Index>
354 for (
int i = 0; i < Rank; ++i) {
369 int values[1] = {_0};
376 int values[2] = {_0, _1};
383 int values[3] = {_0, _1, _2};
390 int values[4] = {_0, _1, _2, _3};
396 template <
typename Shape_>
398 return make_Coord(Shape_::kD, Shape_::kH, Shape_::kW);
Describes identity elements.
Definition: coord.h:39
CUTLASS_HOST_DEVICE Coord operator-(Coord const &b) const
Element-wise subtraction.
Definition: coord.h:149
CUTLASS_HOST_DEVICE Coord< Rank, Index > operator*(T s, Coord< Rank, Index > coord)
Scalar multiplication.
Definition: coord.h:319
CUTLASS_HOST_DEVICE Index const & at(int dim) const
Access via index; may limit unrolling potential.
Definition: coord.h:256
CUTLASS_HOST_DEVICE Index const & operator[](int dim) const
Member access operator.
Definition: coord.h:217
CUTLASS_HOST_DEVICE Coord operator/(Coord const &b) const
Element-wise division.
Definition: coord.h:169
CUTLASS_HOST_DEVICE Index & operator[](int dim)
Member access operator.
Definition: coord.h:214
CUTLASS_HOST_DEVICE Coord< 1 > make_Coord(int _0)
Helper to make a 2-element coordinate.
Definition: coord.h:368
static int const kRank
Number of elements in Coord.
Definition: coord.h:55
Index_ Index
Index type used to store elements.
Definition: coord.h:61
CUTLASS_HOST_DEVICE Coord & operator*=(Coord const &b)
In-place multiplication.
Definition: coord.h:197
CUTLASS_HOST_DEVICE Index & at(int dim)
Access via index; may limit unrolling potential.
Definition: coord.h:246
CUTLASS_HOST_DEVICE Index count() const
Returns the product of all elements.
Definition: coord.h:283
CUTLASS_HOST_DEVICE Coord operator*(Coord const &b) const
Element-wise multiplication.
Definition: coord.h:159
Kind
Definition: coord.h:42
CUTLASS_HOST_DEVICE Coord< 3 > make_Coord_from_shape()
Definition: coord.h:397
CUTLASS_HOST_DEVICE bool operator==(Coord< kRank > const &b) const
Determines if two Coord<> objects are equal.
Definition: coord.h:260
static int const N
Number of elements in Coord, aliased for compatibility.
Definition: coord.h:58
Index idx[kRank]
Indices.
Definition: coord.h:68
CUTLASS_HOST_DEVICE Coord & operator-=(Coord const &b)
In-place subtraction.
Definition: coord.h:188
CUTLASS_HOST_DEVICE Coord & operator+=(Coord const &b)
In-place addition.
Definition: coord.h:179
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:46
CUTLASS_HOST_DEVICE bool operator!=(Coord< kRank > const &b) const
Not equal.
Definition: coord.h:270
CUTLASS_HOST_DEVICE Index & at()
Gets the index of a given Coord element.
Definition: coord.h:240
CUTLASS_HOST_DEVICE Coord & operator/=(Coord const &b)
In-place division.
Definition: coord.h:206
CUTLASS_HOST_DEVICE Coord< Slice > slice(int start=0, Index identity=0) const
Definition: coord.h:102
Statically-sized array specifying Coords within a tensor.
Definition: coord.h:49
CUTLASS_HOST_DEVICE Coord< Rank, Index > operator/(T s, Coord< Rank, Index > coord)
Scalar division.
Definition: coord.h:341
CUTLASS_HOST_DEVICE Index const & at() const
Gets the index of a given Coord element.
Definition: coord.h:250
CUTLASS_HOST_DEVICE T dot(Coord const &b, T sum) const
Computes the dot product of two Coord instances.
Definition: coord.h:221
CUTLASS_HOST_DEVICE Coord(Index value=0)
Default ctor initializes uniformly.
Definition: coord.h:76
CUTLASS_HOST_DEVICE Coord & clamp(Coord< kRank > const &max, Coord< kRank > const &min=Coord< kRank >())
Clamps a coordinate to a range specified by maximum and minimum values.
Definition: coord.h:274
CUTLASS_HOST_DEVICE Coord(Index _idx[])
Constructs from an array of integers.
Definition: coord.h:84
CUTLASS_HOST_DEVICE T dot(Coord const &b) const
Computes the dot product of two Coord instances.
Definition: coord.h:230
CUTLASS_HOST_DEVICE Coord operator+(Coord const &b) const
Element-wise addition.
Definition: coord.h:139
Basic include for CUTLASS macros.
CUTLASS_HOST_DEVICE Coord(Coord< kRank > const &coord)
Constructs from an array of integers.
Definition: coord.h:92
CUTLASS_HOST_DEVICE bool operator!() const
Returns true if Coord is uniformly zero.
Definition: coord.h:128