|
MLIR 24.0.0git
|
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"#include "IR/NVVMOps.h"#include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"#include "mlir/Dialect/GPU/IR/CompilationInterfaces.h"#include "mlir/IR/Builders.h"#include "mlir/IR/BuiltinAttributes.h"#include "mlir/IR/BuiltinTypes.h"#include "mlir/IR/Diagnostics.h"#include "mlir/IR/DialectImplementation.h"#include "mlir/IR/MLIRContext.h"#include "mlir/IR/Operation.h"#include "mlir/IR/OperationSupport.h"#include "mlir/IR/Types.h"#include "mlir/Target/LLVMIR/ModuleTranslation.h"#include "mlir/Transforms/InliningUtils.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/StringExtras.h"#include "llvm/ADT/TypeSwitch.h"#include "llvm/IR/ConstantRange.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/NVVMIntrinsicUtils.h"#include "llvm/Support/Casting.h"#include "llvm/Support/FormatVariadic.h"#include "llvm/Support/MathExtras.h"#include "llvm/Support/NVPTXAddrSpace.h"#include "llvm/Support/raw_ostream.h"#include <array>#include <cassert>#include <cmath>#include <optional>#include <string>#include <utility>#include "mlir/Dialect/LLVMIR/NVVMOpsDialect.cpp.inc"Go to the source code of this file.
Classes | |
| struct | ConvertFsubToFnegFadd |
Macros | |
| #define | CP_ASYNC_ID_IMPL(mod, size, suffix) |
| #define | GET_CP_ASYNC_ID(mod, size, has_cpsize) |
| #define | _none |
| #define | CVT_F2TF32_ID_IMPL(rnd, relu, sf) |
| #define | GET_CVT_F2TF32_ID(rnd, relu, sf) |
| #define | TCGEN05_CP_IMPL(shape_mc, src_fmt, cg) |
| #define | TCGEN05_CP_2CTA(shape_mc, src_fmt, is_2cta) |
| #define | GET_TCGEN05_CP_ID(shape_mc, src_fmt, is_2cta) |
| #define | TCGEN05LDRED(SHAPE, NUM, TYPE) |
Functions | |
| static bool | isPtrInAddrSpace (mlir::Value ptr, NVVMMemorySpace targetAS) |
| static bool | isPtrInGenericSpace (mlir::Value ptr) |
| static bool | isPtrInSharedCTASpace (mlir::Value ptr) |
| static bool | isPtrInSharedClusterSpace (mlir::Value ptr) |
| static llvm::Value * | castPtrToAddrSpace (llvm::IRBuilderBase &builder, llvm::Value *ptr, NVVMMemorySpace targetAS) |
| static llvm::nvvm::CTAGroupKind | getNVVMCtaGroupKind (NVVM::CTAGroupKind ctaGroup) |
| template<typename AttrTy> | |
| static ParseResult | parseEnumKeyword (OpAsmParser &parser, AttrTy &attr) |
| static LogicalResult | cpAsyncBulkTensorCommonVerifier (size_t tensorDims, bool isIm2Col, size_t numIm2ColOffsets, Location loc) |
| LogicalResult | CpAsyncBulkTensorOverrideAddrCommonVerifier (OperandRange coordinates, OperandRange tensorSize, OperandRange lowerStride, Value upperStride, bool isTile, Location loc) |
| static LogicalResult | verifyTMALoadParams (size_t tensorDims, size_t numIm2colOff, TMALoadMode mode, Location loc) |
| static LogicalResult | verifyMBarrierArriveLikeOp (Operation *op, Value addr, NVVM::MemScopeKind scope, Value retVal=nullptr, Value multicastMask=nullptr) |
| static LogicalResult | inferMBarrierArriveResultTypes (MLIRContext *context, Value addr, SmallVectorImpl< Type > &inferredReturnTypes) |
| Only shared_cluster (ptr<7>) produces zero results; all other address spaces (including generic) return i64. | |
| static bool | isCompatibleReturnTypesOptionalResult (TypeRange inferred, TypeRange actual) |
| For ops with optional results, allow the user to omit the result even when inference would produce one. | |
| static LogicalResult | verifyConvertF32x2ToFP16x2Op (Twine dstType, FPRoundingMode rnd, bool hasRandomBits, bool hasPzo, Operation *op) |
| 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 > ®s) |
| template<typename Op> | |
| static void | processOperandFragments (Op &op, std::array< MMAOperandFragment, 3 > &frags, SmallVectorImpl< Type > ®Types, 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) |
| static FailureOr< int > | getAllowedSizeK (NVVM::WGMMATypes typeA) |
| static LogicalResult | isAllowedWGMMADataType (NVVM::WGMMATypes typeD, NVVM::WGMMATypes typeA, NVVM::WGMMATypes typeB) |
| static LogicalResult | isAllowedSizeN (int sizeN, NVVM::WGMMATypes typeA) |
| template<typename OpType> | |
| static LogicalResult | verifyFloatBinaryOp (OpType op, StringRef opKind) |
| static llvm::Value * | packValInto64Bits (llvm::IRBuilderBase &builder, llvm::Value *result, llvm::Value *field, unsigned sizeInBits, unsigned start) |
| Packs the given field into the result. | |
| static llvm::Intrinsic::ID | getBarrierSyncIntrinsic (bool aligned, bool hasCount) |
| Maps the (aligned, hasCount) pair to the @llvm.nvvm.barrier.cta.sync.
| |
| static llvm::Intrinsic::ID | getBarrierReductionIntrinsic (bool aligned, NVVM::BarrierReduction kind) |
| Maps the (aligned, kind) pair to the @llvm.nvvm.barrier.cta.red.
| |
| static void | appendMBarrierMulticastArgs (Value multicastMask, LLVM::ModuleTranslation &mt, llvm::IRBuilderBase &builder, SmallVectorImpl< llvm::Value * > &args) |
| static void | appendN1ScaleArg (Value scaleFactor, LLVM::ModuleTranslation &mt, llvm::IRBuilderBase &builder, llvm::SmallVectorImpl< llvm::Value * > &args, std::optional< uint16_t > defaultScale=std::nullopt) |
| static llvm::Intrinsic::ID | getUE5M3IntrinsicID (NVVM::FPRoundingMode rnd, bool hasSatFinite, bool hasScale, ArrayRef< llvm::Intrinsic::ID > ids, ArrayRef< llvm::Intrinsic::ID > scaledIds) |
| static unsigned | isValidVectorLength (NVVM::Tcgen05LdStShape shape, unsigned vecLen) |
| static llvm::Value * | getAsPackedI32 (llvm::Value *arg, llvm::IRBuilderBase &builder) |
| static llvm::Value * | getParamCastedAddr (llvm::Value *addr, llvm::IRBuilderBase &builder) |
| static llvm::nvvm::Tcgen05MMAKind | getNVVMTcgen05MMAKind (NVVM::Tcgen05MMAKind kind) |
| static LogicalResult | verifyTcgen05MMAOp (bool isATensor, mlir::Value disableOutputLane, NVVM::CTAGroupKind ctaGroup, bool hasAShift, NVVM::Tcgen05MMACollectorOp collectorOp, Location loc) |
| static LogicalResult | verifyTcgen05MMABlockScaleOp (NVVM::Tcgen05MMACollectorOp collectorOp, NVVM::Tcgen05MMAKind kind, NVVM::Tcgen05MMABlockScale blockScale, Location loc) |
| static unsigned | getNumSPRegisters (Type type) |
| static bool | isValidSPRepFactor (unsigned repFactor) |
Variables | |
| static constexpr unsigned | notIntrinsic = llvm::Intrinsic::not_intrinsic |
| #define _none |
Definition at line 5190 of file NVVMDialect.cpp.
| #define CP_ASYNC_ID_IMPL | ( | mod, | |
| size, | |||
| suffix ) |
Definition at line 4640 of file NVVMDialect.cpp.
| #define CVT_F2TF32_ID_IMPL | ( | rnd, | |
| relu, | |||
| sf ) |
Definition at line 5192 of file NVVMDialect.cpp.
| #define GET_CP_ASYNC_ID | ( | mod, | |
| size, | |||
| has_cpsize ) |
Definition at line 4643 of file NVVMDialect.cpp.
| #define GET_CVT_F2TF32_ID | ( | rnd, | |
| relu, | |||
| sf ) |
Definition at line 5196 of file NVVMDialect.cpp.
| #define GET_TCGEN05_CP_ID | ( | shape_mc, | |
| src_fmt, | |||
| is_2cta ) |
Definition at line 6065 of file NVVMDialect.cpp.
| #define TCGEN05_CP_2CTA | ( | shape_mc, | |
| src_fmt, | |||
| is_2cta ) |
Definition at line 6061 of file NVVMDialect.cpp.
| #define TCGEN05_CP_IMPL | ( | shape_mc, | |
| src_fmt, | |||
| cg ) |
Definition at line 6058 of file NVVMDialect.cpp.
| #define TCGEN05LDRED | ( | SHAPE, | |
| NUM, | |||
| TYPE ) |
Definition at line 7351 of file NVVMDialect.cpp.
|
static |
Definition at line 2184 of file NVVMDialect.cpp.
References mlir::Builder::getAttr(), mlir::Builder::getContext(), and result.
|
static |
Definition at line 2200 of file NVVMDialect.cpp.
References mlir::getType(), and result.
|
static |
Definition at line 4251 of file NVVMDialect.cpp.
References mlir::LLVM::ModuleTranslation::lookupValue().
|
static |
Definition at line 5218 of file NVVMDialect.cpp.
References mlir::LLVM::ModuleTranslation::lookupValue().
|
static |
Definition at line 80 of file NVVMDialect.cpp.
|
static |
Definition at line 141 of file NVVMDialect.cpp.
References mlir::emitError(), and success().
| LogicalResult CpAsyncBulkTensorOverrideAddrCommonVerifier | ( | OperandRange | coordinates, |
| OperandRange | tensorSize, | ||
| OperandRange | lowerStride, | ||
| Value | upperStride, | ||
| bool | isTile, | ||
| Location | loc ) |
Definition at line 163 of file NVVMDialect.cpp.
References mlir::emitError(), and success().
|
static |
Definition at line 3085 of file NVVMDialect.cpp.
|
static |
Definition at line 6348 of file NVVMDialect.cpp.
|
static |
Maps the (aligned, kind) pair to the @llvm.nvvm.barrier.cta.red.
* intrinsic ID.
Definition at line 3939 of file NVVMDialect.cpp.
Maps the (aligned, hasCount) pair to the @llvm.nvvm.barrier.cta.sync.
* intrinsic ID.
Definition at line 3926 of file NVVMDialect.cpp.
Definition at line 7440 of file NVVMDialect.cpp.
|
static |
Definition at line 90 of file NVVMDialect.cpp.
|
static |
Definition at line 6597 of file NVVMDialect.cpp.
|
static |
Definition at line 6397 of file NVVMDialect.cpp.
|
static |
Definition at line 5424 of file NVVMDialect.cpp.
|
static |
Definition at line 2166 of file NVVMDialect.cpp.
References mlir::NamedAttrList::get(), and mlir::NamedAttrList::set().
|
static |
Only shared_cluster (ptr<7>) produces zero results; all other address spaces (including generic) return i64.
Definition at line 433 of file NVVMDialect.cpp.
References isPtrInSharedClusterSpace(), and success().
|
static |
Definition at line 2877 of file NVVMDialect.cpp.
References mlir::NVVM::inferMMAType().
|
static |
Definition at line 2219 of file NVVMDialect.cpp.
|
static |
Definition at line 3140 of file NVVMDialect.cpp.
References success().
|
static |
Definition at line 3099 of file NVVMDialect.cpp.
References success().
For ops with optional results, allow the user to omit the result even when inference would produce one.
This preserves backward compatibility: the result can be silently discarded (e.g., for fire-and-forget arrive ops).
Definition at line 480 of file NVVMDialect.cpp.
|
static |
Definition at line 945 of file NVVMDialect.cpp.
Referenced by isIntegerPtxType().
|
static |
Definition at line 949 of file NVVMDialect.cpp.
Referenced by isIntegerPtxType().
|
static |
Definition at line 953 of file NVVMDialect.cpp.
References isInt4PtxType(), and isInt8PtxType().
|
static |
Definition at line 1022 of file NVVMDialect.cpp.
Referenced by parseMmaProperties().
|
static |
Definition at line 63 of file NVVMDialect.cpp.
Referenced by isPtrInGenericSpace(), isPtrInSharedClusterSpace(), and isPtrInSharedCTASpace().
|
static |
Definition at line 68 of file NVVMDialect.cpp.
References isPtrInAddrSpace().
|
static |
Definition at line 76 of file NVVMDialect.cpp.
References isPtrInAddrSpace().
Referenced by inferMBarrierArriveResultTypes(), and verifyMBarrierArriveLikeOp().
|
static |
Definition at line 72 of file NVVMDialect.cpp.
References isPtrInAddrSpace().
Definition at line 7447 of file NVVMDialect.cpp.
Definition at line 6254 of file NVVMDialect.cpp.
|
static |
Packs the given field into the result.
The result is 64-bits and each field can be 32-bits or narrower.
Definition at line 3819 of file NVVMDialect.cpp.
References result.
|
static |
Definition at line 119 of file NVVMDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getContext(), mlir::AsmParser::getCurrentLocation(), mlir::AsmParser::parseKeywordOrString(), and success().
Referenced by parseMmaEnumPropertyValue().
|
static |
Definition at line 1009 of file NVVMDialect.cpp.
References mlir::NamedAttrList::append(), mlir::AsmParser::emitError(), mlir::NamedAttrList::get(), mlir::AsmParser::getCurrentLocation(), parseEnumKeyword(), mlir::AsmParser::parseEqual(), and success().
Referenced by parseMmaProperties().
|
static |
Definition at line 2101 of file NVVMDialect.cpp.
References mlir::AsmParser::OptionalSquare, mlir::AsmParser::parseKeyword(), mlir::OpAsmParser::parseOperandList(), and success().
|
static |
Definition at line 1031 of file NVVMDialect.cpp.
References mlir::NamedAttrList::append(), mlir::AsmParser::emitError(), mlir::NamedAttrList::get(), mlir::AsmParser::getBuilder(), mlir::AsmParser::getCurrentLocation(), mlir::Builder::getUnitAttr(), isMmaPropertyName(), mlir::AsmParser::parseKeyword(), parseMmaEnumPropertyValue(), parseMmaPropertyValue(), mlir::AsmParser::parseOptionalAttrDict(), mlir::AsmParser::parseOptionalComma(), and success().
|
static |
Definition at line 995 of file NVVMDialect.cpp.
References mlir::NamedAttrList::append(), mlir::AsmParser::emitError(), mlir::NamedAttrList::get(), mlir::AsmParser::getCurrentLocation(), mlir::AsmParser::parseCustomAttributeWithFallback(), mlir::AsmParser::parseEqual(), and success().
Referenced by parseMmaProperties().
|
static |
Definition at line 2142 of file NVVMDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), mlir::AsmParser::parseColon(), mlir::AsmParser::parseCommaSeparatedList(), mlir::AsmParser::parseLParen(), mlir::AsmParser::parseRParen(), mlir::AsmParser::parseType(), and success().
|
static |
Definition at line 981 of file NVVMDialect.cpp.
|
static |
Definition at line 973 of file NVVMDialect.cpp.
References mlir::AsmPrinter::printStrippedAttrOrType().
|
static |
Definition at line 988 of file NVVMDialect.cpp.
|
static |
Definition at line 2092 of file NVVMDialect.cpp.
References mlir::OpAsmPrinter::printOperands().
|
static |
Definition at line 2115 of file NVVMDialect.cpp.
|
static |
Definition at line 798 of file NVVMDialect.cpp.
References mlir::Operation::emitOpError(), and success().
|
static |
Definition at line 3684 of file NVVMDialect.cpp.
References mlir::Type::isBF16(), mlir::Type::isF16(), mlir::Type::isF64(), and success().
|
static |
Definition at line 369 of file NVVMDialect.cpp.
References mlir::Operation::emitError(), isPtrInSharedClusterSpace(), and success().
|
static |
Definition at line 7036 of file NVVMDialect.cpp.
References mlir::emitError(), and success().
|
static |
Definition at line 6765 of file NVVMDialect.cpp.
References mlir::emitError(), mlir::Value::getType(), and success().
|
static |
Definition at line 255 of file NVVMDialect.cpp.
References mlir::emitError(), and success().
|
staticconstexpr |
Definition at line 57 of file NVVMDialect.cpp.