LLVM: lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "lower-matrix-intrinsics"
Enumerations
enum class MatrixLayoutTy { ColumnMajor, RowMajor }
Functions
STATISTIC (FlattenedMatrices, "Number of matrix flattenings")
STATISTIC (ReshapedMatrices, "Number of matrix reshapes")
STATISTIC (SplitMatrices, "Number of matrix splits")
static DISubprogram * getSubprogram (DIScope *Scope)
Helper function to either return Scope, if it is a subprogram or the attached subprogram for a local scope.
static bool isSplat (Value *V)
Return true if V is a splat of a value (which is used when multiplying a matrix with a scalar).
template<typename LTy, typename RTy>
static auto m_AnyMul (const LTy &L, const RTy &R)
Match any mul operation (fp or integer).
template<typename LTy, typename RTy>
static auto m_AnyAdd (const LTy &L, const RTy &R)
Match any add operation (fp or integer).
static Value * computeVectorAddr (Value *BasePtr, Value *VecIdx, Value *Stride, unsigned NumElements, Type *EltType, IRBuilder<> &Builder)
static bool isShapePreserving (Value *V)
static iterator_range< Use * > getShapedOperandsForInst (Instruction *I)
Return an iterator over the operands of I that should share shape information with I.
static std::optional< ShapeInfo > computeShapeInfoForInst (Instruction *I, const DenseMap< Value *, ShapeInfo > &ShapeMap)
Return the ShapeInfo for the result of I, it it can be determined.
Variables
static cl::opt< bool > FuseMatrix ("fuse-matrix", cl::init(true), cl::Hidden, cl::desc("Enable/disable fusing matrix instructions."))
static cl::opt< unsigned > TileSize ("fuse-matrix-tile-size", cl::init(4), cl::Hidden, cl::desc("Tile size for matrix instruction fusion using square-shaped tiles."))
static cl::opt< bool > TileUseLoops ("fuse-matrix-use-loops", cl::init(false), cl::Hidden, cl::desc("Generate loop nest for tiling."))
static cl::opt< bool > ForceFusion ("force-fuse-matrix", cl::init(false), cl::Hidden, cl::desc("Force matrix instruction fusion even if not profitable."))
static cl::opt< bool > AllowContractEnabled ("matrix-allow-contract", cl::init(false), cl::Hidden, cl::desc("Allow the use of FMAs if available and profitable. This may " "result in different results, due to less rounding error."))
static cl::opt< bool > VerifyShapeInfo ("verify-matrix-shapes", cl::Hidden, cl::desc("Enable/disable matrix shape verification."), cl::init(false))
static cl::opt< MatrixLayoutTy > MatrixLayout ("matrix-default-layout", cl::init(MatrixLayoutTy::ColumnMajor), cl::desc("Sets the default matrix layout"), cl::values(clEnumValN(MatrixLayoutTy::ColumnMajor, "column-major", "Use column-major layout"), clEnumValN(MatrixLayoutTy::RowMajor, "row-major", "Use row-major layout")))
static cl::opt< bool > PrintAfterTransposeOpt ("matrix-print-after-transpose-opt", cl::init(false))
static cl::opt< unsigned > SplitMatmulRemainderOverThreshold ("matrix-split-matmul-remainder-over-threshold", cl::Hidden, cl::desc("Illegal remainder vectors over this size in bits should be split " "in the inner loop of matmul"), cl::init(0))

DEBUG_TYPE

#define DEBUG_TYPE "lower-matrix-intrinsics"

MatrixLayoutTy

enum class MatrixLayoutTy strong

computeShapeInfoForInst()

Return the ShapeInfo for the result of I, it it can be determined.

Definition at line 318 of file LowerMatrixIntrinsics.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), getShapedOperandsForInst(), I, isShapePreserving(), llvm::PatternMatch::m_Intrinsic(), llvm::PatternMatch::m_Store(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and N.

computeVectorAddr()

getShapedOperandsForInst()

getSubprogram()

isShapePreserving()

isSplat()

m_AnyAdd()

template<typename LTy, typename RTy>

m_AnyMul()

template<typename LTy, typename RTy>

STATISTIC() [1/3]

STATISTIC ( FlattenedMatrices ,
"Number of matrix flattenings" )

STATISTIC() [2/3]

STATISTIC ( ReshapedMatrices ,
"Number of matrix reshapes" )

STATISTIC() [3/3]

STATISTIC ( SplitMatrices ,
"Number of matrix splits" )

AllowContractEnabled

cl::opt< bool > AllowContractEnabled("matrix-allow-contract", cl::init(false), cl::Hidden, cl::desc("Allow the use of FMAs if available and profitable. This may " "result in different results, due to less rounding error.")) ( "matrix-allow-contract" , cl::init(false) , cl::Hidden , cl::desc("Allow the use of FMAs if available and profitable. This may " "result in different results, due to less rounding error.") ) static

ForceFusion

cl::opt< bool > ForceFusion("force-fuse-matrix", cl::init(false), cl::Hidden, cl::desc("Force matrix instruction fusion even if not profitable.")) ( "force-fuse-matrix" , cl::init(false) , cl::Hidden , cl::desc("Force matrix instruction fusion even if not profitable.") ) static

FuseMatrix

cl::opt< bool > FuseMatrix("fuse-matrix", cl::init(true), cl::Hidden, cl::desc("Enable/disable fusing matrix instructions.")) ( "fuse-matrix" , cl::init(true) , cl::Hidden , cl::desc("Enable/disable fusing matrix instructions.") ) static

MatrixLayout

cl::opt< MatrixLayoutTy > MatrixLayout("matrix-default-layout", cl::init(MatrixLayoutTy::ColumnMajor), cl::desc("Sets the default matrix layout"), cl::values(clEnumValN(MatrixLayoutTy::ColumnMajor, "column-major", "Use column-major layout"), clEnumValN(MatrixLayoutTy::RowMajor, "row-major", "Use row-major layout"))) ( "matrix-default-layout" , cl::init(MatrixLayoutTy::ColumnMajor) , cl::desc("Sets the default matrix layout") , cl::values(clEnumValN(MatrixLayoutTy::ColumnMajor, "column-major", "Use column-major layout"), clEnumValN(MatrixLayoutTy::RowMajor, "row-major", "Use row-major layout")) ) static

PrintAfterTransposeOpt

cl::opt< bool > PrintAfterTransposeOpt("matrix-print-after-transpose-opt", cl::init(false)) ( "matrix-print-after-transpose-opt" , cl::init(false) ) static

SplitMatmulRemainderOverThreshold

cl::opt< unsigned > SplitMatmulRemainderOverThreshold("matrix-split-matmul-remainder-over-threshold", cl::Hidden, cl::desc("Illegal remainder vectors over this size in bits should be split " "in the inner loop of matmul"), cl::init(0)) ( "matrix-split-matmul-remainder-over-threshold" , cl::Hidden , cl::desc("Illegal remainder vectors over this size in bits should be split " "in the inner loop of matmul") , cl::init(0) ) static

TileSize

cl::opt< unsigned > TileSize("fuse-matrix-tile-size", cl::init(4), cl::Hidden, cl::desc( "Tile size for matrix instruction fusion using square-shaped tiles.")) ( "fuse-matrix-tile-size" , cl::init(4) , cl::Hidden , cl::desc( "Tile size for matrix instruction fusion using square-shaped tiles.") ) static

TileUseLoops

cl::opt< bool > TileUseLoops("fuse-matrix-use-loops", cl::init(false), cl::Hidden, cl::desc("Generate loop nest for tiling.")) ( "fuse-matrix-use-loops" , cl::init(false) , cl::Hidden , cl::desc("Generate loop nest for tiling.") ) static

VerifyShapeInfo

cl::opt< bool > VerifyShapeInfo("verify-matrix-shapes", cl::Hidden, cl::desc("Enable/disable matrix shape verification."), cl::init(false)) ( "verify-matrix-shapes" , cl::Hidden , cl::desc("Enable/disable matrix shape verification.") , cl::init(false) ) static