TT-MLIR
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
mlir::tt::ttnn::TTNNLayoutAttr Class Reference
Inheritance diagram for mlir::tt::ttnn::TTNNLayoutAttr:

Public Member Functions

TTNNLayoutAttr withGrid (::mlir::MLIRContext *context, ArrayRef< int64_t > tensorShape, GridAttr grid, ArrayRef< std::pair< std::int64_t, std::int64_t >> collapseIntervals={{0, -1}})
 
TTNNLayoutAttr withGrid (::mlir::MLIRContext *context, RankedTensorType ty, GridAttr grid, ArrayRef< std::pair< std::int64_t, std::int64_t >> collapseIntervals={{0, -1}})
 
TTNNLayoutAttr withElementType (::mlir::MLIRContext *context, Type elementType)
 
TTNNLayoutAttr withBufferType (::mlir::MLIRContext *context, BufferType bufferType)
 
TTNNLayoutAttr withMemoryLayout (::mlir::MLIRContext *context, TensorMemoryLayoutAttr memLayoutAttr)
 
TTNNLayoutAttr withMemoryLayout (::mlir::MLIRContext *context, TensorMemoryLayout memLayout)
 
TTNNLayoutAttr withShardShape (::mlir::MLIRContext *context, llvm::SmallVector< int64_t > shardShape)
 
TTNNLayoutAttr withTensorShape (::mlir::MLIRContext *context, ArrayRef< int64_t > tensorShape)
 
bool isSystemBufferType () const
 
bool isDeviceBufferType () const
 
bool isTiled () const
 
bool hasShardedTensorMemoryLayout () const
 
bool hasShardedL1TensorMemoryLayout () const
 
bool hasInterleavedL1TensorMemoryLayout () const
 
bool hasInterleavedDRAMTensorMemoryLayout () const
 
bool hasDRAMBufferType () const
 
bool hasL1BufferType () const
 
Layout getLayout () const
 
std::optional< TensorMemoryLayoutgetMemLayoutOpt () const
 
Type getElementType () const
 
Type getScalarElementType () const
 
uint64_t getShardSizeInBytes () const
 
BufferType getBufferType () const
 
DataType getDataType () const
 
uint64_t getElementSizeBytes () const
 
int64_t getTensorSizeInBytes (ArrayRef< int64_t > tensorShape, ::mlir::tt::DeviceAttr device) const
 
llvm::SmallVector< int64_t > getStride (ArrayRef< int64_t > logicalShape) const
 
llvm::SmallVector< int64_t > getShardShape () const
 
llvm::SmallVector< int64_t > getScalarShardShape () const
 
AffineMap getIdentityTileLinearMap () const
 
llvm::SmallVector< int64_t > getTiledShape (ArrayRef< int64_t > logicalTensorShape) const
 
AffineMap replaceMemoryMapSymbolsWithShardShape (AffineMap physicalMemoryMap) const
 
void print (::mlir::AsmPrinter &odsPrinter) const
 
AffineMap getLinear () const
 
GridAttr getGrid () const
 
MemRefType getMemref () const
 
TensorMemoryLayoutAttr getMemLayout () const
 

Static Public Member Functions

static TTNNLayoutAttr get (::mlir::MLIRContext *context, ArrayRef< int64_t > tensorShape, Type elementType, BufferType bufferType, GridAttr grid, TensorMemoryLayoutAttr memoryLayoutAttr=nullptr, ArrayRef< std::pair< std::int64_t, std::int64_t >> collapseIntervals={{0, -1}})
 
static llvm::SmallVector< int64_t > calculateLogicalShardShapeForSharding (ArrayRef< int64_t > tensorShape, mlir::AffineMap linear, GridAttr grid)
 
static llvm::SmallVector< int64_t > calculateLogicalShardShapeForL1Interleaved (ArrayRef< int64_t > tensorShape, Type elementType, mlir::AffineMap linear, GridAttr grid)
 
static TTNNLayoutAttr get (::mlir::MLIRContext *context, AffineMap linear, GridAttr grid, MemRefType memref, TensorMemoryLayoutAttr mem_layout)
 
static constexpr ::llvm::StringLiteral getMnemonic ()
 
::mlir::Attribute parse (::mlir::AsmParser &odsParser, ::mlir::Type odsType)
 

Static Public Attributes

static constexpr ::llvm::StringLiteral name = "ttnn.ttnn_layout"
 
static constexpr ::llvm::StringLiteral dialectName = "ttnn"
 

Member Function Documentation

◆ calculateLogicalShardShapeForL1Interleaved()

static llvm::SmallVector<int64_t> mlir::tt::ttnn::TTNNLayoutAttr::calculateLogicalShardShapeForL1Interleaved ( ArrayRef< int64_t >  tensorShape,
Type  elementType,
mlir::AffineMap  linear,
GridAttr  grid 
)
static

◆ calculateLogicalShardShapeForSharding()

static llvm::SmallVector<int64_t> mlir::tt::ttnn::TTNNLayoutAttr::calculateLogicalShardShapeForSharding ( ArrayRef< int64_t >  tensorShape,
mlir::AffineMap  linear,
GridAttr  grid 
)
static

◆ get() [1/2]

TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::get ( ::mlir::MLIRContext *  context,
AffineMap  linear,
GridAttr  grid,
MemRefType  memref,
TensorMemoryLayoutAttr  mem_layout 
)
static

◆ get() [2/2]

static TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::get ( ::mlir::MLIRContext *  context,
ArrayRef< int64_t >  tensorShape,
Type  elementType,
BufferType  bufferType,
GridAttr  grid,
TensorMemoryLayoutAttr  memoryLayoutAttr = nullptr,
ArrayRef< std::pair< std::int64_t, std::int64_t >>  collapseIntervals = {{0, -1}} 
)
static

◆ getBufferType()

BufferType mlir::tt::ttnn::TTNNLayoutAttr::getBufferType ( ) const

◆ getDataType()

DataType mlir::tt::ttnn::TTNNLayoutAttr::getDataType ( ) const

◆ getElementSizeBytes()

uint64_t mlir::tt::ttnn::TTNNLayoutAttr::getElementSizeBytes ( ) const

◆ getElementType()

Type mlir::tt::ttnn::TTNNLayoutAttr::getElementType ( ) const

◆ getGrid()

GridAttr mlir::tt::ttnn::TTNNLayoutAttr::getGrid ( ) const

◆ getIdentityTileLinearMap()

AffineMap mlir::tt::ttnn::TTNNLayoutAttr::getIdentityTileLinearMap ( ) const

◆ getLayout()

Layout mlir::tt::ttnn::TTNNLayoutAttr::getLayout ( ) const

◆ getLinear()

AffineMap mlir::tt::ttnn::TTNNLayoutAttr::getLinear ( ) const

◆ getMemLayout()

TensorMemoryLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::getMemLayout ( ) const

◆ getMemLayoutOpt()

std::optional<TensorMemoryLayout> mlir::tt::ttnn::TTNNLayoutAttr::getMemLayoutOpt ( ) const

◆ getMemref()

MemRefType mlir::tt::ttnn::TTNNLayoutAttr::getMemref ( ) const

◆ getMnemonic()

static constexpr ::llvm::StringLiteral mlir::tt::ttnn::TTNNLayoutAttr::getMnemonic ( )
inlinestatic

◆ getScalarElementType()

Type mlir::tt::ttnn::TTNNLayoutAttr::getScalarElementType ( ) const

◆ getScalarShardShape()

llvm::SmallVector<int64_t> mlir::tt::ttnn::TTNNLayoutAttr::getScalarShardShape ( ) const

◆ getShardShape()

llvm::SmallVector<int64_t> mlir::tt::ttnn::TTNNLayoutAttr::getShardShape ( ) const

◆ getShardSizeInBytes()

uint64_t mlir::tt::ttnn::TTNNLayoutAttr::getShardSizeInBytes ( ) const

◆ getStride()

llvm::SmallVector<int64_t> mlir::tt::ttnn::TTNNLayoutAttr::getStride ( ArrayRef< int64_t >  logicalShape) const

◆ getTensorSizeInBytes()

int64_t mlir::tt::ttnn::TTNNLayoutAttr::getTensorSizeInBytes ( ArrayRef< int64_t >  tensorShape,
::mlir::tt::DeviceAttr  device 
) const

◆ getTiledShape()

llvm::SmallVector<int64_t> mlir::tt::ttnn::TTNNLayoutAttr::getTiledShape ( ArrayRef< int64_t >  logicalTensorShape) const

◆ hasDRAMBufferType()

bool mlir::tt::ttnn::TTNNLayoutAttr::hasDRAMBufferType ( ) const

◆ hasInterleavedDRAMTensorMemoryLayout()

bool mlir::tt::ttnn::TTNNLayoutAttr::hasInterleavedDRAMTensorMemoryLayout ( ) const

◆ hasInterleavedL1TensorMemoryLayout()

bool mlir::tt::ttnn::TTNNLayoutAttr::hasInterleavedL1TensorMemoryLayout ( ) const

◆ hasL1BufferType()

bool mlir::tt::ttnn::TTNNLayoutAttr::hasL1BufferType ( ) const

◆ hasShardedL1TensorMemoryLayout()

bool mlir::tt::ttnn::TTNNLayoutAttr::hasShardedL1TensorMemoryLayout ( ) const

◆ hasShardedTensorMemoryLayout()

bool mlir::tt::ttnn::TTNNLayoutAttr::hasShardedTensorMemoryLayout ( ) const

◆ isDeviceBufferType()

bool mlir::tt::ttnn::TTNNLayoutAttr::isDeviceBufferType ( ) const
inline

◆ isSystemBufferType()

bool mlir::tt::ttnn::TTNNLayoutAttr::isSystemBufferType ( ) const
inline

◆ isTiled()

bool mlir::tt::ttnn::TTNNLayoutAttr::isTiled ( ) const

◆ parse()

mlir::Attribute mlir::tt::ttnn::TTNNLayoutAttr::parse ( ::mlir::AsmParser &  odsParser,
::mlir::Type  odsType 
)
static

◆ print()

void mlir::tt::ttnn::TTNNLayoutAttr::print ( ::mlir::AsmPrinter &  odsPrinter) const

◆ replaceMemoryMapSymbolsWithShardShape()

AffineMap mlir::tt::ttnn::TTNNLayoutAttr::replaceMemoryMapSymbolsWithShardShape ( AffineMap  physicalMemoryMap) const

◆ withBufferType()

TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::withBufferType ( ::mlir::MLIRContext *  context,
BufferType  bufferType 
)

◆ withElementType()

TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::withElementType ( ::mlir::MLIRContext *  context,
Type  elementType 
)

◆ withGrid() [1/2]

TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::withGrid ( ::mlir::MLIRContext *  context,
ArrayRef< int64_t >  tensorShape,
GridAttr  grid,
ArrayRef< std::pair< std::int64_t, std::int64_t >>  collapseIntervals = {{0, -1}} 
)

◆ withGrid() [2/2]

TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::withGrid ( ::mlir::MLIRContext *  context,
RankedTensorType  ty,
GridAttr  grid,
ArrayRef< std::pair< std::int64_t, std::int64_t >>  collapseIntervals = {{0, -1}} 
)

◆ withMemoryLayout() [1/2]

TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::withMemoryLayout ( ::mlir::MLIRContext *  context,
TensorMemoryLayout  memLayout 
)

◆ withMemoryLayout() [2/2]

TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::withMemoryLayout ( ::mlir::MLIRContext *  context,
TensorMemoryLayoutAttr  memLayoutAttr 
)

◆ withShardShape()

TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::withShardShape ( ::mlir::MLIRContext *  context,
llvm::SmallVector< int64_t >  shardShape 
)

◆ withTensorShape()

TTNNLayoutAttr mlir::tt::ttnn::TTNNLayoutAttr::withTensorShape ( ::mlir::MLIRContext *  context,
ArrayRef< int64_t >  tensorShape 
)

Member Data Documentation

◆ dialectName

constexpr ::llvm::StringLiteral mlir::tt::ttnn::TTNNLayoutAttr::dialectName = "ttnn"
static

◆ name

constexpr ::llvm::StringLiteral mlir::tt::ttnn::TTNNLayoutAttr::name = "ttnn.ttnn_layout"
static

The documentation for this class was generated from the following files: