MLIR  20.0.0git
Classes | Functions | Variables
GPUToSPIRV.cpp File Reference
#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/Dialect/SPIRV/IR/TargetAndABI.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Transforms/DialectConversion.h"
#include <optional>

Go to the source code of this file.

Classes

class  GPUAllReduceConversion
 Pattern to convert a gpu.all_reduce op into a SPIR-V group op. More...
 
class  GPUSubgroupReduceConversion
 Pattern to convert a gpu.subgroup_reduce op into a SPIR-V group op. More...
 

Functions

static spirv::FuncOp lowerAsEntryFunction (gpu::GPUFuncOp funcOp, const TypeConverter &typeConverter, ConversionPatternRewriter &rewriter, spirv::EntryPointABIAttr entryPointInfo, ArrayRef< spirv::InterfaceVarABIAttr > argABIInfo)
 
static LogicalResult getDefaultABIAttrs (const spirv::TargetEnv &targetEnv, gpu::GPUFuncOp funcOp, SmallVectorImpl< spirv::InterfaceVarABIAttr > &argABI)
 Populates argABI with spirv.interface_var_abi attributes for lowering gpu.func to spirv.func if no arguments have the attributes set already. More...
 
template<typename UniformOp , typename NonUniformOp >
static Value createGroupReduceOpImpl (OpBuilder &builder, Location loc, Value arg, bool isGroup, bool isUniform)
 
static std::optional< ValuecreateGroupReduceOp (OpBuilder &builder, Location loc, Value arg, gpu::AllReduceOperation opType, bool isGroup, bool isUniform)
 
static std::string makeVarName (spirv::ModuleOp moduleOp, llvm::Twine prefix)
 

Variables

static constexpr const char kSPIRVModule [] = "__spv__"
 

Function Documentation

◆ createGroupReduceOp()

static std::optional<Value> createGroupReduceOp ( OpBuilder builder,
Location  loc,
Value  arg,
gpu::AllReduceOperation  opType,
bool  isGroup,
bool  isUniform 
)
static

◆ createGroupReduceOpImpl()

template<typename UniformOp , typename NonUniformOp >
static Value createGroupReduceOpImpl ( OpBuilder builder,
Location  loc,
Value  arg,
bool  isGroup,
bool  isUniform 
)
static

◆ getDefaultABIAttrs()

static LogicalResult getDefaultABIAttrs ( const spirv::TargetEnv targetEnv,
gpu::GPUFuncOp  funcOp,
SmallVectorImpl< spirv::InterfaceVarABIAttr > &  argABI 
)
static

Populates argABI with spirv.interface_var_abi attributes for lowering gpu.func to spirv.func if no arguments have the attributes set already.

Returns failure if any argument has the ABI attribute set already.

Definition at line 284 of file GPUToSPIRV.cpp.

References mlir::spirv::getInterfaceVarABIAttr(), mlir::spirv::getInterfaceVarABIAttrName(), and mlir::spirv::needsInterfaceVarABIAttrs().

◆ lowerAsEntryFunction()

static spirv::FuncOp lowerAsEntryFunction ( gpu::GPUFuncOp  funcOp,
const TypeConverter typeConverter,
ConversionPatternRewriter rewriter,
spirv::EntryPointABIAttr  entryPointInfo,
ArrayRef< spirv::InterfaceVarABIAttr argABIInfo 
)
static

◆ makeVarName()

static std::string makeVarName ( spirv::ModuleOp  moduleOp,
llvm::Twine  prefix 
)
static

Definition at line 614 of file GPUToSPIRV.cpp.

Variable Documentation

◆ kSPIRVModule

constexpr const char kSPIRVModule[] = "__spv__"
staticconstexpr

Definition at line 29 of file GPUToSPIRV.cpp.