40 typename Index_ = int,
41 typename LongIndex_ = int64_t
78 for (
int i = 0; i <
kRank; ++i) {
86 for (
int i = 0; i <
kRank; ++i) {
94 for (
int i = 0; i <
kRank; ++i) {
105 for (
int i = 0; i < Slice; ++i) {
106 if (i + start < kRank) {
107 result[i] = idx[i + start];
110 result[i] = identity;
120 for (
int j = 1; j <
kRank; ++j) {
121 if (idx[j] < idx[i]) {
132 for (
int j = 1; j <
kRank; ++j) {
133 if (idx[j] > idx[i]) {
142 explicit operator bool()
const {
143 for (
int i = 0; i <
kRank; ++i) {
154 for (
int i = 0; i <
kRank; ++i) {
166 for (
int i = 0; i <
kRank; ++i) {
167 c.idx[i] = idx[i] + b.idx[i];
176 for (
int i = 0; i <
kRank; ++i) {
177 c.idx[i] = idx[i] - b.idx[i];
186 for (
int i = 0; i <
kRank; ++i) {
187 c.idx[i] = idx[i] * b.idx[i];
196 for (
int i = 0; i <
kRank; ++i) {
197 c.idx[i] = idx[i] / b.idx[i];
205 for (
int i = 0; i <
kRank; ++i) {
214 for (
int i = 0; i <
kRank; ++i) {
223 for (
int i = 0; i <
kRank; ++i) {
232 for (
int i = 0; i <
kRank; ++i) {
247 for (
int i = 0; i <
kRank; ++i) {
248 sum += idx[i] * b.idx[i];
271 Index const&
at(
int dim)
const {
return idx[dim]; }
277 for (
int i = 0; equal && i <
kRank; ++i) {
278 equal = (idx[i] == b.idx[i]);
290 for (
int i = 0; i <
kRank; ++i) {
300 for (
int i = 1; i <
kRank; ++i) {
310 for (
int i = 1; i <
kRank; ++i) {
319 for (
int i = 0; i <
kRank; ++i) {
320 if (!(idx[i] < b[i])) {
330 for (
int i = 0; i <
kRank; ++i) {
331 if (!(idx[i] <= b[i])) {
341 return !(*
this <= b);
358 template <
int Rank,
typename Index>
362 for (
int i = 0; i < Rank; ++i) {
363 coord[i] = s / coord[i];
369 template <
int Rank,
typename Index>
373 for (
int i = 0; i < Rank; ++i) {
388 int values[1] = {_0};
395 int values[2] = {_0, _1};
402 int values[3] = {_0, _1, _2};
409 int values[4] = {_0, _1, _2, _3};
CUTLASS_HOST_DEVICE Coord operator-(Coord const &b) const
Element-wise subtraction.
Definition: coord.h:174
CUTLASS_HOST_DEVICE int min_dim_index() const
Returns the index of the dimension with least value.
Definition: coord.h:118
CUTLASS_HOST_DEVICE Index const & at() const
Gets the index of a given Coord element.
Definition: coord.h:265
static int const kRank
Number of elements in Coord.
Definition: coord.h:52
CUTLASS_HOST_DEVICE bool operator==(Coord const &b) const
Determines if two Coord<> objects are equal.
Definition: coord.h:275
Definition: aligned_buffer.h:35
CUTLASS_HOST_DEVICE Coord operator+(Coord const &b) const
Element-wise addition.
Definition: coord.h:164
CUTLASS_HOST_DEVICE Index const & operator[](int dim) const
Member access operator.
Definition: coord.h:242
CUTLASS_HOST_DEVICE Coord(Index value=Index(0))
Default ctor initializes uniformly.
Definition: coord.h:77
CUTLASS_HOST_DEVICE bool operator!() const
Returns true if Coord is uniformly zero.
Definition: coord.h:153
CUTLASS_HOST_DEVICE Coord & operator*=(Coord const &b)
In-place multiplication.
Definition: coord.h:222
CUTLASS_HOST_DEVICE Coord< 1 > make_Coord(int _0)
Helper to make a 2-element coordinate.
Definition: coord.h:387
CUTLASS_HOST_DEVICE Coord & clamp(Coord const &max, Coord const &min=Coord())
Clamps a coordinate to a range specified by maximum and minimum values.
Definition: coord.h:289
CUTLASS_HOST_DEVICE bool operator<(Coord const &b) const
Less than operator.
Definition: coord.h:318
CUTLASS_HOST_DEVICE bool operator!=(Coord const &b) const
Not equal.
Definition: coord.h:285
CUTLASS_HOST_DEVICE Coord & operator-=(Coord const &b)
In-place subtraction.
Definition: coord.h:213
CUTLASS_HOST_DEVICE Index & at(int dim)
Access via index; may limit unrolling potential.
Definition: coord.h:261
CUTLASS_HOST_DEVICE Coord(Coord< kRank, Index, LongIndex > const &coord)
Copy constructor.
Definition: coord.h:93
int Index
Index type used to store elements.
Definition: coord.h:55
#define CUTLASS_PRAGMA_UNROLL
Definition: cutlass.h:110
CUTLASS_HOST_DEVICE LongIndex product() const
Returns the product of all elements.
Definition: coord.h:308
CUTLASS_HOST_DEVICE Index & operator[](int dim)
Member access operator.
Definition: coord.h:239
CUTLASS_HOST_DEVICE bool operator<=(Coord const &b) const
Less than or equals operator.
Definition: coord.h:329
CUTLASS_HOST_DEVICE bool operator>(Coord const &b) const
Greater than operator.
Definition: coord.h:340
CUTLASS_HOST_DEVICE Coord< Slice > slice(int start=0, Index identity=0) const
Definition: coord.h:103
CUTLASS_HOST_DEVICE Coord operator*(Coord const &b) const
Element-wise multiplication.
Definition: coord.h:184
CUTLASS_HOST_DEVICE Coord(Index const (&_idx)[kRank])
Constructs from an array of integers.
Definition: coord.h:85
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:89
CUTLASS_HOST_DEVICE Coord & operator/=(Coord const &b)
In-place division.
Definition: coord.h:231
CUTLASS_HOST_DEVICE Coord operator/(Coord const &b) const
Element-wise division.
Definition: coord.h:194
CUTLASS_HOST_DEVICE Index sum() const
Returns the sum of all elements.
Definition: coord.h:298
Statically-sized array specifying Coords within a tensor.
Definition: coord.h:43
CUTLASS_HOST_DEVICE Index const & at(int dim) const
Access via index; may limit unrolling potential.
Definition: coord.h:271
CUTLASS_HOST_DEVICE Coord & operator+=(Coord const &b)
In-place addition.
Definition: coord.h:204
int64_t LongIndex
Type used to represent linear offsets.
Definition: coord.h:58
CUTLASS_HOST_DEVICE Index & at()
Gets the index of a given Coord element.
Definition: coord.h:255
CUTLASS_HOST_DEVICE LongIndex dot(Coord const &b, LongIndex sum=LongIndex(0)) const
Computes the dot product with anotherCoord object.
Definition: coord.h:246
CUTLASS_HOST_DEVICE int max_dim_index() const
Returns the index of the dimension with greatest value.
Definition: coord.h:130
Basic include for CUTLASS.
CUTLASS_HOST_DEVICE bool operator>=(Coord const &b) const
Greater than or equals operator.
Definition: coord.h:346