| 47 | |
| 48 | |
| 49 | class MatrixCoord: |
| 50 | def __init__(self, row, col): |
| 51 | self._row = row |
| 52 | self._col = col |
| 53 | |
| 54 | @property |
| 55 | def row(self): |
| 56 | return self._row |
| 57 | |
| 58 | @property |
| 59 | def column(self): |
| 60 | return self._col |
| 61 | |
| 62 | def leading_dimension(self, layout: LayoutType) -> int: |
| 63 | """ |
| 64 | Returns the leading dimension for a matrix with layout ``layout`` and shape provided by the MatrixCoord. |
| 65 | |
| 66 | :param layout: layout of matrix |
| 67 | :type layout: cutlass_library.LayoutType |
| 68 | |
| 69 | :returns: leading dimension |
| 70 | :rtype: int |
| 71 | """ |
| 72 | if layout == LayoutType.RowMajor: |
| 73 | return self._col |
| 74 | elif layout == LayoutType.ColumnMajor: |
| 75 | return self._row |
| 76 | else: |
| 77 | raise Exception(f'Unsupported layout for leading dimension calculation: {layout}') |
| 78 | |
| 79 | |
| 80 | class GemmCoord: |
no outgoing calls