MLIR  16.0.0git
Namespaces | Macros | Functions
AMDGPUToROCDL.cpp File Reference
#include "mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/AMDGPU/AMDGPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/ROCDLDialect.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/STLExtras.h"
#include "mlir/Conversion/Passes.h.inc"
+ Include dependency graph for AMDGPUToROCDL.cpp:

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 

Macros

#define GEN_PASS_DEF_CONVERTAMDGPUTOROCDL
 

Functions

static Value createI32Constant (ConversionPatternRewriter &rewriter, Location loc, int32_t value)
 
static Value mfmaConcatIfNeeded (ConversionPatternRewriter &rewriter, Location loc, Value input)
 If input is a vector of bytes, concatentate those bytes in little-endian order to form a single integer of size 8 * [vector length]. More...
 
static Optional< StringRef > mfmaOpToIntrinsic (MFMAOp mfma, Chipset chipset)
 Return the rocdl intrinsic corresponding to a MFMA operation mfma if one exists. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_CONVERTAMDGPUTOROCDL

#define GEN_PASS_DEF_CONVERTAMDGPUTOROCDL

Definition at line 21 of file AMDGPUToROCDL.cpp.

Function Documentation

◆ createI32Constant()

static Value createI32Constant ( ConversionPatternRewriter rewriter,
Location  loc,
int32_t  value 
)
static

Definition at line 28 of file AMDGPUToROCDL.cpp.

References mlir::OpBuilder::createOrFold(), mlir::Builder::getI32Type(), and value.

Referenced by mfmaConcatIfNeeded().

◆ mfmaConcatIfNeeded()

static Value mfmaConcatIfNeeded ( ConversionPatternRewriter rewriter,
Location  loc,
Value  input 
)
static

If input is a vector of bytes, concatentate those bytes in little-endian order to form a single integer of size 8 * [vector length].

This works around a wart in the AMDGPU intrinsics where operations that logically take vectors of bytes instead integers. Since we do not want to expose this implementation detail to MLIR, we correct for it here.

Definition at line 286 of file AMDGPUToROCDL.cpp.

References mlir::OpBuilder::create(), createI32Constant(), mlir::OpBuilder::createOrFold(), mlir::Type::dyn_cast(), mlir::Builder::getIntegerAttr(), mlir::Builder::getIntegerType(), and mlir::Value::getType().

◆ mfmaOpToIntrinsic()

static Optional<StringRef> mfmaOpToIntrinsic ( MFMAOp  mfma,
Chipset  chipset 
)
static

Return the rocdl intrinsic corresponding to a MFMA operation mfma if one exists.

This includes checking to ensure the intrinsic is supported on the architecture you are compiling for.

Definition at line 314 of file AMDGPUToROCDL.cpp.

References mlir::Type::dyn_cast(), mlir::Type::isa(), mlir::Type::isBF16(), mlir::Type::isF16(), mlir::Type::isF32(), mlir::Type::isF64(), mlir::Type::isInteger(), and mlir::amdgpu::Chipset::minorVersion.