MLIR  15.0.0git
Classes | Macros | Enumerations | Functions
GPUDialect.cpp File Reference
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.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 "mlir/IR/DialectImplementation.h"
#include "mlir/IR/FunctionImplementation.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/TypeSwitch.h"
#include "mlir/Dialect/GPU/"
#include "mlir/Dialect/GPU/"
#include "mlir/Dialect/GPU/"
#include "mlir/Dialect/GPU/"
#include "mlir/Dialect/GPU/"
+ Include dependency graph for GPUDialect.cpp:

Go to the source code of this file.


struct  FoldLaunchArguments
 Simplify the gpu.launch when the range of a thread or block ID is trivially known to be one. More...


#define GET_OP_LIST


enum  GPUMemorySpace { kGenericMemorySpace = 0, kGlobalMemorySpace = 1, kSharedMemorySpace = 3 }
 GPU memory space identifiers. More...


static ParseResult parseAsyncDependencies (OpAsmParser &parser, Type &asyncTokenType, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &asyncDependencies)
 Parses an optional list of async operands with an optional leading keyword. More...
static void printAsyncDependencies (OpAsmPrinter &printer, Operation *op, Type asyncTokenType, OperandRange asyncDependencies)
 Prints optional async dependencies with its leading keyword. More...
static ParseResult parseAllReduceOperation (AsmParser &parser, AllReduceOperationAttr &attr)
static void printAllReduceOperation (AsmPrinter &printer, Operation *op, AllReduceOperationAttr attr)
static void printSizeAssignment (OpAsmPrinter &p, KernelDim3 size, KernelDim3 operands, KernelDim3 ids)
static ParseResult parseSizeAssignment (OpAsmParser &parser, MutableArrayRef< OpAsmParser::UnresolvedOperand > sizes, MutableArrayRef< OpAsmParser::UnresolvedOperand > regionSizes, MutableArrayRef< OpAsmParser::UnresolvedOperand > indices)
static ParseResult parseLaunchFuncOperands (OpAsmParser &parser, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &argNames, SmallVectorImpl< Type > &argTypes)
static void printLaunchFuncOperands (OpAsmPrinter &printer, Operation *, OperandRange operands, TypeRange types)
static ParseResult parseAttributions (OpAsmParser &parser, StringRef keyword, SmallVectorImpl< OpAsmParser::Argument > &args)
 Parses a GPU function memory attribution. More...
static void printAttributions (OpAsmPrinter &p, StringRef keyword, ArrayRef< BlockArgument > values)
static LogicalResult verifyAttributions (Operation *op, ArrayRef< BlockArgument > attributions, unsigned memorySpace)
static bool isLastMemrefDimUnitStride (MemRefType type)
 Return true if the last dimension of the MemRefType has unit stride. More...
static LogicalResult foldMemRefCast (Operation *op)
 This is a common class used for patterns of the form "someop(memrefcast) -> someop". More...

Macro Definition Documentation



Definition at line 1404 of file GPUDialect.cpp.





Definition at line 1407 of file GPUDialect.cpp.


#define GET_OP_LIST

Enumeration Type Documentation

◆ GPUMemorySpace

GPU memory space identifiers.


Generic memory space identifier.


Global memory space identifier.


Shared memory space identifier.

Definition at line 89 of file GPUDialect.cpp.

Function Documentation

◆ foldMemRefCast()

static LogicalResult foldMemRefCast ( Operation op)

This is a common class used for patterns of the form "someop(memrefcast) -> someop".

It folds the source of any memref.cast into the root operation directly.

Definition at line 1249 of file GPUDialect.cpp.

References mlir::RewritePatternSet::add(), mlir::RewriterBase::eraseOp(), mlir::failure(), mlir::Value::getDefiningOp(), mlir::Operation::getNumOperands(), mlir::Operation::getOpOperands(), mlir::OpRewritePattern< SourceOp >::OpRewritePattern(), mlir::RewriterBase::replaceOp(), mlir::success(), value, and mlir::verify().

◆ isLastMemrefDimUnitStride()

static bool isLastMemrefDimUnitStride ( MemRefType  type)

Return true if the last dimension of the MemRefType has unit stride.

Also return true for memrefs with no strides.

Definition at line 1157 of file GPUDialect.cpp.

References mlir::failed(), mlir::getStridesAndOffset(), and mlir::verify().

◆ parseAllReduceOperation()

static ParseResult parseAllReduceOperation ( AsmParser parser,
AllReduceOperationAttr &  attr 

◆ parseAsyncDependencies()

static ParseResult parseAsyncDependencies ( OpAsmParser parser,
Type asyncTokenType,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  asyncDependencies 

Parses an optional list of async operands with an optional leading keyword.

(async)? ([ ssa-id-list ])?

This method is used by the tablegen assembly format for async ops as well.

Definition at line 278 of file GPUDialect.cpp.

References mlir::AsmParser::emitError(), mlir::AsmParser::getBuilder(), mlir::AsmParser::getCurrentLocation(), mlir::OpAsmParser::getNumResults(), mlir::Builder::getType(), mlir::AsmParser::OptionalSquare, mlir::OpAsmParser::parseOperandList(), mlir::AsmParser::parseOptionalKeyword(), and mlir::succeeded().

Referenced by parseSizeAssignment().

◆ parseAttributions()

static ParseResult parseAttributions ( OpAsmParser parser,
StringRef  keyword,
SmallVectorImpl< OpAsmParser::Argument > &  args 

◆ parseLaunchFuncOperands()

static ParseResult parseLaunchFuncOperands ( OpAsmParser parser,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  argNames,
SmallVectorImpl< Type > &  argTypes 

◆ parseSizeAssignment()

◆ printAllReduceOperation()

static void printAllReduceOperation ( AsmPrinter printer,
Operation op,
AllReduceOperationAttr  attr 

Definition at line 361 of file GPUDialect.cpp.

◆ printAsyncDependencies()

static void printAsyncDependencies ( OpAsmPrinter printer,
Operation op,
Type  asyncTokenType,
OperandRange  asyncDependencies 

Prints optional async dependencies with its leading keyword.

(async)? ([ ssa-id-list ])?

Definition at line 294 of file GPUDialect.cpp.

References mlir::emitError(), and mlir::success().

◆ printAttributions()

static void printAttributions ( OpAsmPrinter p,
StringRef  keyword,
ArrayRef< BlockArgument values 

◆ printLaunchFuncOperands()

static void printLaunchFuncOperands ( OpAsmPrinter printer,
Operation ,
OperandRange  operands,
TypeRange  types 

◆ printSizeAssignment()

static void printSizeAssignment ( OpAsmPrinter p,
KernelDim3  size,
KernelDim3  operands,
KernelDim3  ids 

◆ verifyAttributions()

static LogicalResult verifyAttributions ( Operation op,
ArrayRef< BlockArgument attributions,
unsigned  memorySpace