101 return coord.
row() * stride_[0] + coord.
column();
137 return extent.
row() * stride_[0];
194 return coord.
row() + coord.
column() * stride_[0];
230 return extent.
column() * stride_[0];
236 template <
int Interleave>
258 static int const kInterleave = Interleave;
291 Index row_major = coord.
row() / kInterleave;
292 Index row_minor = coord.
row() % kInterleave;
293 return row_major * stride_[0] + coord.
column() * kInterleave + row_minor;
303 Index column = residual / kInterleave;
304 Index row_minor = residual % kInterleave;
306 return MatrixCoord(row_major * kInterleave + row_minor, column);
336 return (extent.
row() + kInterleave - 1) / kInterleave * stride_[0];
342 template <
int Interleave>
364 static int const kInterleave = Interleave;
400 return column_major * stride_[0] + coord.
row() * kInterleave + column_minor;
407 Index column_major =
Index(offset / stride_[0]);
410 Index row = residual / kInterleave;
411 Index column_minor = residual % kInterleave;
413 return MatrixCoord(row, column_major * kInterleave + column_minor);
443 return (extent.
column() + kInterleave - 1) / kInterleave * stride_[0];
497 stride_(ldm), layout_(layout) { }
520 return coord.
row() + coord.
column() * stride_[0];
523 return coord.
row() * stride_[0] + coord.
column();
566 return stride_[0] * extent.
column();
569 return stride_[0] * extent.
row();
580 template <
int BlockRows,
int BlockColumns>
601 static int const kBlockRows = BlockRows;
604 static int const kBlockColumns = BlockColumns;
634 (coord.
row() % kBlockRows) +
635 (coord.
column() % kBlockColumns) * kBlockRows +
636 (coord.
row() / kBlockRows) * kBlockRows * kBlockColumns +
637 (coord.
column() / kBlockColumns) * stride_[0];
675 return (extent.
column() + kBlockColumns - 1) / kBlockColumns * stride_[0];
681 template <
int BlockRows,
int BlockColumns>
702 static int const kBlockRows = BlockRows;
705 static int const kBlockColumns = BlockColumns;
735 (coord.
column() % kBlockColumns) +
736 (coord.
row() % kBlockRows) * kBlockColumns +
737 (coord.
column() / kBlockColumns) * kBlockRows * kBlockColumns +
738 (coord.
row() / kBlockRows) * stride_[0];
775 return (extent.
row() + kBlockRows - 1) / kBlockRows * stride_[0];
825 Index interleave): layout_id_(layout_id), stride_(
make_Coord(ldm, interleave)) { }
832 Index interleave = 1) {
842 Index ldm = c * interleave;
861 Index v = s / stride_[1];
862 Index residual = (s % stride_[1]);
912 Index v =
Index((s + stride_[1] - 1) / stride_[1]);
920 template <
typename Layout>
int32_t Index
Index type used for coordinates.
Definition: layout/matrix.h:464
static CUTLASS_HOST_DEVICE RowMajorInterleaved packed(MatrixCoord const &extent)
Helper returns a layout to a tightly packed tensor.
Definition: layout/matrix.h:283
CUTLASS_HOST_DEVICE Index stride(int idx) const
Returns the stride of the layout.
Definition: layout/matrix.h:323
int64_t LongIndex
Long index type used for offsets.
Definition: layout/matrix.h:62
CUTLASS_HOST_DEVICE Index & stride(int idx)
Returns the stride of the layout.
Definition: layout/matrix.h:668
int64_t LongIndex
Long index type used for offsets.
Definition: layout/matrix.h:355
CUTLASS_HOST_DEVICE Index const & column() const
Returns the column of the coordinate.
Definition: matrix_coord.h:85
CUTLASS_HOST_DEVICE Stride stride() const
Returns the stride of the layout.
Definition: layout/matrix.h:540
static CUTLASS_HOST_DEVICE RowMajorBlockLinear packed(MatrixCoord const &extent)
Helper returns a layout to a tightly packed tensor.
Definition: layout/matrix.h:726
Definition: aligned_buffer.h:35
CUTLASS_HOST_DEVICE Stride stride() const
Returns the stride of the layout.
Definition: layout/matrix.h:750
leading dimension refers to stride between columns; stride along rows is 1
CUTLASS_HOST_DEVICE Stride stride() const
Returns the stride of the layout.
Definition: layout/matrix.h:311
CUTLASS_HOST_DEVICE Index & stride(int idx)
Returns the stride of the layout.
Definition: layout/matrix.h:768
CUTLASS_HOST_DEVICE ColumnMajorInterleaved(Index ldm=0)
Ctor.
Definition: layout/matrix.h:381
CUTLASS_HOST_DEVICE GeneralMatrix(MatrixLayout layout_id, Index ldm, Index interleave)
Ctor.
Definition: layout/matrix.h:822
int64_t LongIndex
Long index type used for offsets.
Definition: layout/matrix.h:592
Definition: layout/matrix.h:455
Definition: layout/matrix.h:781
CUTLASS_HOST_DEVICE Index stride(int idx) const
Returns the stride of the layout.
Definition: layout/matrix.h:662
CUTLASS_HOST_DEVICE LongIndex capacity(MatrixCoord const &extent) const
Compute the number of contiguous elements needed to store a tensor with the given size...
Definition: layout/matrix.h:442
CUTLASS_HOST_DEVICE Index & stride(int idx)
Returns the stride of the layout.
Definition: layout/matrix.h:130
CUTLASS_HOST_DEVICE Index stride(int idx) const
Returns the stride of the layout.
Definition: layout/matrix.h:124
int64_t LongIndex
Long index type used for offsets.
Definition: layout/matrix.h:467
int64_t LongIndex
Long index type used for offsets.
Definition: layout/matrix.h:249
CUTLASS_HOST_DEVICE LongIndex operator()(MatrixCoord const &coord) const
Definition: layout/matrix.h:397
int64_t LongIndex
Long index type used for offsets.
Definition: layout/matrix.h:793
int64_t LongIndex
Long index type used for offsets.
Definition: layout/matrix.h:693
static int const kRank
Logical rank of tensor.
Definition: layout/matrix.h:53
CUTLASS_HOST_DEVICE Stride & stride()
Returns the stride of the layout.
Definition: layout/matrix.h:211
CUTLASS_HOST_DEVICE Index & stride(int idx)
Returns the stride of the layout.
Definition: layout/matrix.h:329
int32_t Index
Index type used for coordinates.
Definition: layout/matrix.h:352
CUTLASS_HOST_DEVICE Index & stride(int idx)
Returns the stride of the layout.
Definition: layout/matrix.h:558
CUTLASS_HOST_DEVICE Coord< 1 > make_Coord(int _0)
Helper to make a 2-element coordinate.
Definition: coord.h:387
int64_t LongIndex
Long index type used for offsets.
Definition: layout/matrix.h:154
CUTLASS_HOST_DEVICE ColumnMajor(Index ldm=0)
Ctor.
Definition: layout/matrix.h:177
CUTLASS_HOST_DEVICE MatrixCoord inverse(LongIndex offset) const
Inverse of layout function, mapping linear offset to logical coordinate.
Definition: layout/matrix.h:298
CUTLASS_HOST_DEVICE LongIndex operator()(MatrixCoord const &coord) const
Definition: layout/matrix.h:733
int32_t Index
Index type used for coordinates.
Definition: layout/matrix.h:246
CUTLASS_HOST_DEVICE Index const & row() const
Returns the row of the coordinate.
Definition: matrix_coord.h:77
CUTLASS_HOST_DEVICE LongIndex capacity(MatrixCoord const &extent) const
Compute the number of contiguous elements needed to store a tensor with the given size...
Definition: layout/matrix.h:136
CUTLASS_HOST_DEVICE Stride stride() const
Returns the stride of the layout.
Definition: layout/matrix.h:418
CUTLASS_HOST_DEVICE Stride stride() const
Returns the stride of the layout.
Definition: layout/matrix.h:112
CUTLASS_HOST_DEVICE LongIndex capacity(MatrixCoord const &extent) const
Compute the number of contiguous elements needed to store a tensor with the given size...
Definition: layout/matrix.h:335
CUTLASS_HOST_DEVICE MatrixCoord inverse(LongIndex offset) const
Inverse of layout function, mapping linear offset to logical coordinate.
Definition: layout/matrix.h:106
Definition: layout/matrix.h:581
Mapping function for column-major matrices.
Definition: layout/matrix.h:142
CUTLASS_HOST_DEVICE MatrixLayout & layout_id()
Definition: layout/matrix.h:885
CUTLASS_HOST_DEVICE Index stride(int idx) const
Returns the stride of the layout.
Definition: layout/matrix.h:762
CUTLASS_HOST_DEVICE Index stride(int idx) const
Returns the stride of the layout.
Definition: layout/matrix.h:891
CUTLASS_HOST_DEVICE GeneralMatrix()
Ctor.
Definition: layout/matrix.h:818
int32_t Index
Index type used for coordinates.
Definition: layout/matrix.h:59
CUTLASS_HOST_DEVICE Stride stride() const
Returns the stride of the layout.
Definition: layout/matrix.h:650
CUTLASS_HOST_DEVICE MatrixCoord inverse(LongIndex offset) const
Inverse of layout function, mapping linear offset to logical coordinate.
Definition: layout/matrix.h:642
CUTLASS_HOST_DEVICE Index & stride(int idx)
Returns the stride of the layout.
Definition: layout/matrix.h:897
CUTLASS_HOST_DEVICE LongIndex operator()(MatrixCoord const &coord) const
Definition: layout/matrix.h:100
int32_t Index
Index type used for coordinates.
Definition: layout/matrix.h:790
Defines transposes of matrix layouts.
Definition: layout/matrix.h:921
CUTLASS_HOST_DEVICE LongIndex operator()(MatrixCoord const &coord) const
Definition: layout/matrix.h:632
CUTLASS_HOST_DEVICE LongIndex capacity(MatrixCoord const &extent) const
Compute the number of contiguous elements needed to store a tensor with the given size...
Definition: layout/matrix.h:564
int32_t Index
Index type used for coordinates.
Definition: layout/matrix.h:589
Matrix
Enumerated type for canonical pitch-linear matrix layouts.
Definition: layout/matrix.h:448
CUTLASS_HOST_DEVICE LongIndex operator()(MatrixCoord const &coord) const
Definition: layout/matrix.h:518
CUTLASS_HOST_DEVICE MatrixCoord inverse(LongIndex offset) const
Inverse of layout function, mapping linear offset to logical coordinate.
Definition: layout/matrix.h:199
Definition: layout/matrix.h:682
MatrixLayout
Definition: matrix_traits.h:36
CUTLASS_HOST_DEVICE Index & stride(int idx)
Returns the stride of the layout.
Definition: layout/matrix.h:436
int32_t Index
Index type used for coordinates.
Definition: layout/matrix.h:690
CUTLASS_HOST_DEVICE RowMajorInterleaved(Stride stride)
Ctor.
Definition: layout/matrix.h:279
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:89
CUTLASS_HOST_DEVICE MatrixCoord inverse(LongIndex offset) const
Inverse of layout function, mapping linear offset to logical coordinate.
Definition: layout/matrix.h:533
CUTLASS_HOST_DEVICE MatrixCoord inverse(LongIndex offset) const
Inverse of layout function, mapping linear offset to logical coordinate.
Definition: layout/matrix.h:743
static CUTLASS_HOST_DEVICE ColumnMajor packed(MatrixCoord const &extent)
Helper returns a layout to a tightly packed tensor.
Definition: layout/matrix.h:186
CUTLASS_HOST_DEVICE Stride & stride()
Returns the stride of the layout.
Definition: layout/matrix.h:756
CUTLASS_HOST_DEVICE LongIndex capacity(MatrixCoord const &extent) const
Compute the number of contiguous elements needed to store a tensor with the given size...
Definition: layout/matrix.h:774
static CUTLASS_HOST_DEVICE GeneralMatrix packed(MatrixCoord const &extent, MatrixLayout layout_id=MatrixLayout::kColumnMajor, Index interleave=1)
Helper returns a layout to a tightly packed tensor.
Definition: layout/matrix.h:829
CUTLASS_HOST_DEVICE LongIndex capacity(MatrixCoord const &extent) const
Compute the number of contiguous elements needed to store a tensor with the given size...
Definition: layout/matrix.h:229
CUTLASS_HOST_DEVICE Stride & stride()
Returns the stride of the layout.
Definition: layout/matrix.h:118
static CUTLASS_HOST_DEVICE ContiguousMatrix packed(MatrixCoord const &extent, Matrix layout=Matrix::kColumnMajor)
Helper returns a layout to a tightly packed tensor.
Definition: layout/matrix.h:501
CUTLASS_HOST_DEVICE Stride stride() const
Returns the stride of the layout.
Definition: layout/matrix.h:205
CUTLASS_HOST_DEVICE Stride & stride()
Returns the stride of the layout.
Definition: layout/matrix.h:424
leading dimension refers to stride between rows; stride along columns is 1
Mapping function for row-major matrices.
Definition: layout/matrix.h:50
CUTLASS_HOST_DEVICE LongIndex operator()(MatrixCoord const &coord) const
Definition: layout/matrix.h:193
Defines a canonical coordinate for rank=2 matrices offering named indices.
CUTLASS_HOST_DEVICE RowMajor(Stride stride)
Ctor.
Definition: layout/matrix.h:89
CUTLASS_HOST_DEVICE Stride & stride()
Returns the stride of the layout.
Definition: layout/matrix.h:880
CUTLASS_HOST_DEVICE LongIndex operator()(MatrixCoord const &coord) const
Definition: layout/matrix.h:290
CUTLASS_HOST_DEVICE ContiguousMatrix(Index ldm=0, Matrix layout=Matrix::kColumnMajor)
Ctor.
Definition: layout/matrix.h:493
CUTLASS_HOST_DEVICE Index stride(int idx) const
Returns the stride of the layout.
Definition: layout/matrix.h:430
CUTLASS_HOST_DEVICE Stride & stride()
Returns the stride of the layout.
Definition: layout/matrix.h:317
CUTLASS_HOST_DEVICE Index stride(int idx) const
Returns the stride of the layout.
Definition: layout/matrix.h:552
CUTLASS_HOST_DEVICE Index stride(int idx) const
Returns the stride of the layout.
Definition: layout/matrix.h:217
static CUTLASS_HOST_DEVICE ColumnMajorBlockLinear packed(MatrixCoord const &extent)
Helper returns a layout to a tightly packed tensor.
Definition: layout/matrix.h:625
CUTLASS_HOST_DEVICE ColumnMajorInterleaved(Stride stride)
Ctor.
Definition: layout/matrix.h:385
CUTLASS_HOST_DEVICE LongIndex operator()(MatrixCoord const &coord) const
Definition: layout/matrix.h:850
Definition: layout/matrix.h:343
int32_t Index
Index type used for coordinates.
Definition: layout/matrix.h:151
CUTLASS_HOST_DEVICE Stride stride() const
Returns the stride of the layout.
Definition: layout/matrix.h:869
CUTLASS_HOST_DEVICE Stride & stride()
Returns the stride of the layout.
Definition: layout/matrix.h:656
static CUTLASS_HOST_DEVICE RowMajor packed(MatrixCoord const &extent)
Helper returns a layout to a tightly packed tensor.
Definition: layout/matrix.h:93
CUTLASS_HOST_DEVICE RowMajorInterleaved(Index ldm=0)
Ctor.
Definition: layout/matrix.h:275
CUTLASS_HOST_DEVICE RowMajorBlockLinear(Index ldm=0)
Ctor.
Definition: layout/matrix.h:722
CUTLASS_HOST_DEVICE LongIndex capacity(MatrixCoord const &extent) const
Compute the number of contiguous elements needed to store a tensor with the given size...
Definition: layout/matrix.h:903
CUTLASS_HOST_DEVICE MatrixCoord inverse(LongIndex offset) const
Inverse of layout function, mapping linear offset to logical coordinate.
Definition: layout/matrix.h:405
Defines properties of matrices used to denote layout and operands to GEMM kernels.
static CUTLASS_HOST_DEVICE ColumnMajorInterleaved packed(MatrixCoord const &extent)
Helper returns a layout to a tightly packed tensor.
Definition: layout/matrix.h:390
CUTLASS_HOST_DEVICE Index & stride(int idx)
Returns the stride of the layout.
Definition: layout/matrix.h:223
CUTLASS_HOST_DEVICE Stride & stride()
Returns the stride of the layout.
Definition: layout/matrix.h:546
Basic include for CUTLASS.
Definition: matrix_coord.h:39
CUTLASS_HOST_DEVICE LongIndex capacity(MatrixCoord const &extent) const
Compute the number of contiguous elements needed to store a tensor with the given size...
Definition: layout/matrix.h:674
CUTLASS_HOST_DEVICE ColumnMajor(Stride stride)
Ctor.
Definition: layout/matrix.h:181
static int const kStrideRank
Rank of stride vector.
Definition: layout/matrix.h:56
CUTLASS_HOST_DEVICE ColumnMajorBlockLinear(Index ldm=0)
Ctor.
Definition: layout/matrix.h:621
CUTLASS_HOST_DEVICE RowMajor(Index ldm=0)
Constructor.
Definition: layout/matrix.h:85
CUTLASS_HOST_DEVICE MatrixLayout layout_id() const
Definition: layout/matrix.h:874
Definition: layout/matrix.h:237