MLIR 24.0.0git
NVVMMmaOps.cpp File Reference
#include "mlir/Dialect/LLVMIR/NVVMMmaOps.h"
#include "IR/NVVMOps.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Types.h"
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/IntrinsicsNVPTX.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
#include <array>
#include <cassert>
#include <optional>
#include <string>
#include <utility>
#include "mlir/Dialect/LLVMIR/NVVMMmaOps.cpp.inc"

Go to the source code of this file.

Macros

#define GET_OP_CLASSES

Functions

template<typename AttrTy>
static ParseResult parseEnumKeyword (OpAsmParser &parser, AttrTy &attr)
static bool isInt4PtxType (MMATypes type)
static bool isInt8PtxType (MMATypes type)
static bool isIntegerPtxType (MMATypes type)
template<typename AttrTy>
static void printMmaProperty (OpAsmPrinter &printer, bool &isFirst, StringRef keyword, AttrTy value)
template<typename AttrTy>
static void printMmaEnumProperty (OpAsmPrinter &printer, bool &isFirst, StringRef keyword, AttrTy value)
static void printMmaUnitProperty (OpAsmPrinter &printer, bool &isFirst, StringRef keyword)
template<typename AttrTy>
static ParseResult parseMmaPropertyValue (OpAsmParser &parser, NamedAttrList &attributes, StringRef name)
template<typename AttrTy>
static ParseResult parseMmaEnumPropertyValue (OpAsmParser &parser, NamedAttrList &attributes, StringRef name)
static bool isMmaPropertyName (StringRef name)
static ParseResult parseMmaProperties (OpAsmParser &parser, NamedAttrList &attributes, ArrayRef< StringRef > allowedKeywords, ArrayRef< StringRef > requiredProperties)
static void printOperandList (OpAsmPrinter &p, StringRef name, ArrayRef< Value > operands)
static LogicalResult parseMmaOperand (OpAsmParser &parser, StringRef operandName, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &regs)
template<typename Op>
static void processOperandFragments (Op &op, std::array< MMAOperandFragment, 3 > &frags, SmallVectorImpl< Type > &regTypes, SmallVectorImpl< StringRef > &ignoreAttrNames)
static LogicalResult parseMmaTypeSignature (OpAsmParser &parser, SmallVectorImpl< Type > &operandTypes)
static void inferAndSetMultiplicandTypes (MLIRContext *ctx, NamedAttrList &attrs, const SmallVectorImpl< Type > &operandTypes)
template<typename OpType>
static void addBlockScaleProperties (OpBuilder &builder, OperationState &result, ArrayRef< int64_t > shape, ScaleVecSize scaleVecSize, BlockScaleFormat blockScaleFormat, MMABlockScaleKind kind)
static void addInferredMultiplicandTypes (MLIRContext *ctx, OperationState &result, ValueRange operandA, ValueRange operandB, std::optional< std::array< MMATypes, 2 > > multiplicandPtxTypes)
template<typename OpTy>
static MMATypes inferPtxTypeFromResult (OpTy op)
static std::pair< mlir::Type, unsigned > inferMMATypeFromMNK (NVVM::MMATypes type, NVVM::MMAFrag frag, int m, int n, int k, MLIRContext *context)

Macro Definition Documentation

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 2191 of file NVVMMmaOps.cpp.

Function Documentation

◆ addBlockScaleProperties()

template<typename OpType>
void addBlockScaleProperties ( OpBuilder & builder,
OperationState & result,
ArrayRef< int64_t > shape,
ScaleVecSize scaleVecSize,
BlockScaleFormat blockScaleFormat,
MMABlockScaleKind kind )
static

Definition at line 1329 of file NVVMMmaOps.cpp.

References mlir::Builder::getAttr(), mlir::Builder::getContext(), and result.

◆ addInferredMultiplicandTypes()

void addInferredMultiplicandTypes ( MLIRContext * ctx,
OperationState & result,
ValueRange operandA,
ValueRange operandB,
std::optional< std::array< MMATypes, 2 > > multiplicandPtxTypes )
static

Definition at line 1345 of file NVVMMmaOps.cpp.

References mlir::getType(), and result.

◆ inferAndSetMultiplicandTypes()

void inferAndSetMultiplicandTypes ( MLIRContext * ctx,
NamedAttrList & attrs,
const SmallVectorImpl< Type > & operandTypes )
static

Definition at line 1311 of file NVVMMmaOps.cpp.

References mlir::NamedAttrList::get(), and mlir::NamedAttrList::set().

◆ inferMMATypeFromMNK()

std::pair< mlir::Type, unsigned > inferMMATypeFromMNK ( NVVM::MMATypes type,
NVVM::MMAFrag frag,
int m,
int n,
int k,
MLIRContext * context )
static

Definition at line 1971 of file NVVMMmaOps.cpp.

References mlir::NVVM::inferMMAType().

◆ inferPtxTypeFromResult()

template<typename OpTy>
MMATypes inferPtxTypeFromResult ( OpTy op)
static

Definition at line 1364 of file NVVMMmaOps.cpp.

◆ isInt4PtxType()

bool isInt4PtxType ( MMATypes type)
static

Definition at line 94 of file NVVMMmaOps.cpp.

Referenced by isIntegerPtxType().

◆ isInt8PtxType()

bool isInt8PtxType ( MMATypes type)
static

Definition at line 98 of file NVVMMmaOps.cpp.

Referenced by isIntegerPtxType().

◆ isIntegerPtxType()

bool isIntegerPtxType ( MMATypes type)
static

Definition at line 102 of file NVVMMmaOps.cpp.

References isInt4PtxType(), and isInt8PtxType().

◆ isMmaPropertyName()

bool isMmaPropertyName ( StringRef name)
static

Definition at line 171 of file NVVMMmaOps.cpp.

Referenced by parseMmaProperties().

◆ parseEnumKeyword()

template<typename AttrTy>
ParseResult parseEnumKeyword ( OpAsmParser & parser,
AttrTy & attr )
static

◆ parseMmaEnumPropertyValue()

template<typename AttrTy>
ParseResult parseMmaEnumPropertyValue ( OpAsmParser & parser,
NamedAttrList & attributes,
StringRef name )
static

◆ parseMmaOperand()

LogicalResult parseMmaOperand ( OpAsmParser & parser,
StringRef operandName,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > & regs )
static

◆ parseMmaProperties()

◆ parseMmaPropertyValue()

template<typename AttrTy>
ParseResult parseMmaPropertyValue ( OpAsmParser & parser,
NamedAttrList & attributes,
StringRef name )
static

◆ parseMmaTypeSignature()

◆ printMmaEnumProperty()

template<typename AttrTy>
void printMmaEnumProperty ( OpAsmPrinter & printer,
bool & isFirst,
StringRef keyword,
AttrTy value )
static

Definition at line 130 of file NVVMMmaOps.cpp.

◆ printMmaProperty()

template<typename AttrTy>
void printMmaProperty ( OpAsmPrinter & printer,
bool & isFirst,
StringRef keyword,
AttrTy value )
static

Definition at line 122 of file NVVMMmaOps.cpp.

References mlir::AsmPrinter::printStrippedAttrOrType().

◆ printMmaUnitProperty()

void printMmaUnitProperty ( OpAsmPrinter & printer,
bool & isFirst,
StringRef keyword )
static

Definition at line 137 of file NVVMMmaOps.cpp.

◆ printOperandList()

void printOperandList ( OpAsmPrinter & p,
StringRef name,
ArrayRef< Value > operands )
static

Definition at line 1237 of file NVVMMmaOps.cpp.

References mlir::OpAsmPrinter::printOperands().

◆ processOperandFragments()

template<typename Op>
void processOperandFragments ( Op & op,
std::array< MMAOperandFragment, 3 > & frags,
SmallVectorImpl< Type > & regTypes,
SmallVectorImpl< StringRef > & ignoreAttrNames )
static

Definition at line 1260 of file NVVMMmaOps.cpp.