MLIR  19.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/Support/LogicalResult.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)
 

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

Definition at line 486 of file GPUToSPIRV.cpp.

◆ 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 288 of file GPUToSPIRV.cpp.

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

◆ lowerAsEntryFunction()

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

Variable Documentation

◆ kSPIRVModule

constexpr const char kSPIRVModule[] = "__spv__"
staticconstexpr

Definition at line 30 of file GPUToSPIRV.cpp.