MLIR  20.0.0git
Namespaces | Macros | Functions
GPUToLLVMConversion.cpp File Reference
#include "mlir/Conversion/GPUCommon/GPUCommonPass.h"
#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
#include "mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h"
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
#include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
#include "mlir/Conversion/ConvertToLLVM/ToLLVMPass.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
#include "mlir/Dialect/Async/IR/Async.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/GPU/Transforms/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FormatVariadic.h"
#include "mlir/Conversion/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 

Macros

#define DEBUG_TYPE   "gpu-to-llvm"
 
#define GEN_PASS_DEF_GPUTOLLVMCONVERSIONPASS
 
#define DECLARE_CONVERT_OP_TO_GPU_RUNTIME_CALL_PATTERN(op_name)
 Generic rewriting rule for operation on sparse matrices. More...
 

Functions

static int32_t getCuSparseIndexTypeFrom (Type type)
 
static int32_t getCuSparseLtDataTypeFrom (Type type)
 
static int32_t getCuSparseDataTypeFrom (Type type)
 
static gpu::Prune2To4SpMatFlag get2To4PruneFlag (Value spMat)
 
static bool is2To4Sparsity (Value spMat)
 
static bool isSpMMCusparseLtOp (Value op)
 
static LogicalResult areAllLLVMTypes (Operation *op, ValueRange operands, ConversionPatternRewriter &rewriter)
 
static LogicalResult isAsyncWithOneDependency (ConversionPatternRewriter &rewriter, gpu::AsyncOpInterface op)
 
static bool isGpuAsyncTokenType (Value value)
 
static bool isDefinedByCallTo (Value value, StringRef functionName)
 
static Value bitAndAddrspaceCast (Location loc, ConversionPatternRewriter &rewriter, LLVM::LLVMPointerType destinationType, Value sourcePtr, const LLVMTypeConverter &typeConverter)
 
template<typename T >
static Value genConstInt32From (OpBuilder &builder, Location loc, T tValue)
 
template<typename T >
static Value genConstFloat32From (OpBuilder &builder, Location loc, T tValue)
 
template<typename T >
static void addOpaquePointerConversion (LLVMTypeConverter &converter)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "gpu-to-llvm"

Definition at line 43 of file GPUToLLVMConversion.cpp.

◆ DECLARE_CONVERT_OP_TO_GPU_RUNTIME_CALL_PATTERN

#define DECLARE_CONVERT_OP_TO_GPU_RUNTIME_CALL_PATTERN (   op_name)
Value:
class Convert##op_name##ToGpuRuntimeCallPattern \
: public ConvertOpToGpuRuntimeCallPattern<gpu::op_name> { \
public: \
Convert##op_name##ToGpuRuntimeCallPattern( \
const LLVMTypeConverter &typeConverter) \
: ConvertOpToGpuRuntimeCallPattern<gpu::op_name>(typeConverter) {} \
\
private: \
LogicalResult \
matchAndRewrite(gpu::op_name op, OpAdaptor adaptor, \
ConversionPatternRewriter &rewriter) const override; \
};
This class implements a pattern rewriter for use with ConversionPatterns.
Conversion from types to the LLVM IR dialect.
Definition: TypeConverter.h:35

Generic rewriting rule for operation on sparse matrices.

Currently supports CUDA (by means of cuSparse and cuSparseLt).

Definition at line 484 of file GPUToLLVMConversion.cpp.

◆ GEN_PASS_DEF_GPUTOLLVMCONVERSIONPASS

#define GEN_PASS_DEF_GPUTOLLVMCONVERSIONPASS

Definition at line 46 of file GPUToLLVMConversion.cpp.

Function Documentation

◆ addOpaquePointerConversion()

template<typename T >
static void addOpaquePointerConversion ( LLVMTypeConverter converter)
static

◆ areAllLLVMTypes()

static LogicalResult areAllLLVMTypes ( Operation op,
ValueRange  operands,
ConversionPatternRewriter rewriter 
)
static

◆ bitAndAddrspaceCast()

static Value bitAndAddrspaceCast ( Location  loc,
ConversionPatternRewriter rewriter,
LLVM::LLVMPointerType  destinationType,
Value  sourcePtr,
const LLVMTypeConverter typeConverter 
)
static

◆ genConstFloat32From()

template<typename T >
static Value genConstFloat32From ( OpBuilder builder,
Location  loc,
tValue 
)
static

◆ genConstInt32From()

template<typename T >
static Value genConstInt32From ( OpBuilder builder,
Location  loc,
tValue 
)
static

◆ get2To4PruneFlag()

static gpu::Prune2To4SpMatFlag get2To4PruneFlag ( Value  spMat)
static

Definition at line 628 of file GPUToLLVMConversion.cpp.

References mlir::Value::getDefiningOp().

◆ getCuSparseDataTypeFrom()

static int32_t getCuSparseDataTypeFrom ( Type  type)
static

◆ getCuSparseIndexTypeFrom()

static int32_t getCuSparseIndexTypeFrom ( Type  type)
static

Definition at line 573 of file GPUToLLVMConversion.cpp.

References mlir::Type::isInteger().

◆ getCuSparseLtDataTypeFrom()

static int32_t getCuSparseLtDataTypeFrom ( Type  type)
static

Definition at line 581 of file GPUToLLVMConversion.cpp.

References mlir::Type::isF16(), and mlir::Type::isInteger().

◆ is2To4Sparsity()

static bool is2To4Sparsity ( Value  spMat)
static

Definition at line 639 of file GPUToLLVMConversion.cpp.

References mlir::Value::getDefiningOp(), and mlir::Operation::print().

Referenced by isSpMMCusparseLtOp().

◆ isAsyncWithOneDependency()

static LogicalResult isAsyncWithOneDependency ( ConversionPatternRewriter rewriter,
gpu::AsyncOpInterface  op 
)
static

Definition at line 681 of file GPUToLLVMConversion.cpp.

References mlir::RewriterBase::notifyMatchFailure().

◆ isDefinedByCallTo()

static bool isDefinedByCallTo ( Value  value,
StringRef  functionName 
)
static

◆ isGpuAsyncTokenType()

static bool isGpuAsyncTokenType ( Value  value)
static

Definition at line 814 of file GPUToLLVMConversion.cpp.

References mlir::Value::getType().

◆ isSpMMCusparseLtOp()

static bool isSpMMCusparseLtOp ( Value  op)
static

Definition at line 657 of file GPUToLLVMConversion.cpp.

References mlir::Value::getUsers(), and is2To4Sparsity().