MLIR 23.0.0git
X86Dialect.cpp File Reference
#include "mlir/Dialect/X86/X86Dialect.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/TypeUtilities.h"
#include "llvm/ADT/TypeSwitch.h"
#include "mlir/Dialect/X86/X86Interfaces.cpp.inc"
#include "mlir/Dialect/X86/X86Dialect.cpp.inc"
#include "mlir/Dialect/X86/X86Types.cpp.inc"
#include "mlir/Dialect/X86/X86.cpp.inc"

Go to the source code of this file.

Macros

#define GET_TYPEDEF_LIST
#define GET_OP_LIST
#define GET_OP_CLASSES
#define GET_TYPEDEF_CLASSES

Functions

static Value getMemrefBuffPtr (Location loc, MemRefType type, Value buffer, const LLVMTypeConverter &typeConverter, RewriterBase &rewriter)
static LogicalResult verifyTileSize (Operation *op, x86::amx::TileType tp)
 Verify that AMX supports the implied tile shape.
static LogicalResult verifyMultShape (Operation *op, x86::amx::TileType atp, x86::amx::TileType btp, x86::amx::TileType ctp, unsigned scale)
 Verify that AMX supports the multiplication.
static SmallVector< ValuegetTileSizes (Location loc, x86::amx::TileType tType, RewriterBase &rewriter)
 Maps the 2-dim vector shape to the two 16-bit tile sizes.
static Value computeStrideInBytes (Location loc, MemRefType mType, Value elementStride, RewriterBase &rewriter)
 Returns stride expressed in number of bytes for the given elementStride stride encoded in number of elements of the type mType.
static Value inferStride (Location loc, MemRefType mType, Value base, RewriterBase &rewriter)
 Maps the 2-dim memref shape to the 64-bit stride.
template<typename OpTy, typename = std::enable_if_t< std::is_same_v<OpTy, x86::amx::TileLoadOp> || std::is_same_v<OpTy, x86::amx::TileStoreOp>>>
static LogicalResult tileTransferVerifier (OpTy op)

Macro Definition Documentation

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 392 of file X86Dialect.cpp.

◆ GET_OP_LIST

#define GET_OP_LIST

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

Definition at line 395 of file X86Dialect.cpp.

◆ GET_TYPEDEF_LIST

#define GET_TYPEDEF_LIST

Function Documentation

◆ computeStrideInBytes()

Value computeStrideInBytes ( Location loc,
MemRefType mType,
Value elementStride,
RewriterBase & rewriter )
static

Returns stride expressed in number of bytes for the given elementStride stride encoded in number of elements of the type mType.

Definition at line 164 of file X86Dialect.cpp.

References mlir::Builder::getI64IntegerAttr(), and mlir::Builder::getIntegerType().

Referenced by inferStride().

◆ getMemrefBuffPtr()

Value getMemrefBuffPtr ( Location loc,
MemRefType type,
Value buffer,
const LLVMTypeConverter & typeConverter,
RewriterBase & rewriter )
static

Definition at line 42 of file X86Dialect.cpp.

References mlir::MemRefDescriptor::bufferPtr().

◆ getTileSizes()

SmallVector< Value > getTileSizes ( Location loc,
x86::amx::TileType tType,
RewriterBase & rewriter )
static

Maps the 2-dim vector shape to the two 16-bit tile sizes.

The first dimension directly translates into the number of rows of the tiles. The second dimensions needs to be scaled by the number of bytes.

Definition at line 149 of file X86Dialect.cpp.

References mlir::Builder::getI16IntegerAttr(), and mlir::Builder::getIntegerType().

◆ inferStride()

Value inferStride ( Location loc,
MemRefType mType,
Value base,
RewriterBase & rewriter )
static

Maps the 2-dim memref shape to the 64-bit stride.

Note that the buffer shape may "envelop" the actual tile shape, and may be dynamically sized.

Definition at line 176 of file X86Dialect.cpp.

References computeStrideInBytes(), mlir::Builder::getI64IntegerAttr(), mlir::Builder::getIntegerType(), and mlir::MemRefDescriptor::stride().

◆ tileTransferVerifier()

template<typename OpTy, typename = std::enable_if_t< std::is_same_v<OpTy, x86::amx::TileLoadOp> || std::is_same_v<OpTy, x86::amx::TileStoreOp>>>
LogicalResult tileTransferVerifier ( OpTy op)
static

Definition at line 210 of file X86Dialect.cpp.

References success(), and verifyTileSize().

◆ verifyMultShape()

LogicalResult verifyMultShape ( Operation * op,
x86::amx::TileType atp,
x86::amx::TileType btp,
x86::amx::TileType ctp,
unsigned scale )
static

Verify that AMX supports the multiplication.

Definition at line 134 of file X86Dialect.cpp.

References mlir::Operation::emitOpError(), and success().

◆ verifyTileSize()

LogicalResult verifyTileSize ( Operation * op,
x86::amx::TileType tp )
static

Verify that AMX supports the implied tile shape.

Definition at line 122 of file X86Dialect.cpp.

References mlir::Operation::emitOpError(), and success().

Referenced by tileTransferVerifier().