LLVM 22.0.0git
LowerMatrixIntrinsics.cpp File Reference

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 DISubprogramgetSubprogram (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>
auto m_AnyMul (const LTy &L, const RTy &R)
 Match any mul operation (fp or integer).
template<typename LTy, typename RTy>
auto m_AnyAdd (const LTy &L, const RTy &R)
 Match any add operation (fp or integer).

Variables

static cl::opt< boolFuseMatrix ("fuse-matrix", cl::init(true), cl::Hidden, cl::desc("Enable/disable fusing matrix instructions."))
static cl::opt< unsignedTileSize ("fuse-matrix-tile-size", cl::init(4), cl::Hidden, cl::desc("Tile size for matrix instruction fusion using square-shaped tiles."))
static cl::opt< boolTileUseLoops ("fuse-matrix-use-loops", cl::init(false), cl::Hidden, cl::desc("Generate loop nest for tiling."))
static cl::opt< boolForceFusion ("force-fuse-matrix", cl::init(false), cl::Hidden, cl::desc("Force matrix instruction fusion even if not profitable."))
static cl::opt< boolAllowContractEnabled ("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< boolVerifyShapeInfo ("verify-matrix-shapes", cl::Hidden, cl::desc("Enable/disable matrix shape verification."), cl::init(false))
static cl::opt< MatrixLayoutTyMatrixLayout ("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< boolPrintAfterTransposeOpt ("matrix-print-after-transpose-opt", cl::init(false))

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "lower-matrix-intrinsics"

Definition at line 57 of file LowerMatrixIntrinsics.cpp.

Enumeration Type Documentation

◆ MatrixLayoutTy

enum class MatrixLayoutTy
strong
Enumerator
ColumnMajor 
RowMajor 

Definition at line 87 of file LowerMatrixIntrinsics.cpp.

Function Documentation

◆ getSubprogram()

DISubprogram * getSubprogram ( DIScope * Scope)
static

Helper function to either return Scope, if it is a subprogram or the attached subprogram for a local scope.

Definition at line 102 of file LowerMatrixIntrinsics.cpp.

References llvm::cast(), llvm::dyn_cast(), and llvm::DILocalScope::getSubprogram().

◆ isSplat()

◆ m_AnyAdd()

template<typename LTy, typename RTy>
auto m_AnyAdd ( const LTy & L,
const RTy & R )

Match any add operation (fp or integer).

Definition at line 124 of file LowerMatrixIntrinsics.cpp.

References llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_CombineOr(), and llvm::PatternMatch::m_FAdd().

◆ m_AnyMul()

template<typename LTy, typename RTy>
auto m_AnyMul ( const LTy & L,
const RTy & R )

Match any mul operation (fp or integer).

Definition at line 118 of file LowerMatrixIntrinsics.cpp.

References llvm::PatternMatch::m_CombineOr(), llvm::PatternMatch::m_FMul(), and llvm::PatternMatch::m_Mul().

◆ 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"  )

Variable Documentation

◆ 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

◆ 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