MLIR  16.0.0git
Classes | Namespaces | Functions
SCFToSPIRV.cpp File Reference
#include "mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Transforms/DialectConversion.h"
+ Include dependency graph for SCFToSPIRV.cpp:

Go to the source code of this file.

Classes

struct  mlir::ScfToSPIRVContextImpl
 

Namespaces

 mlir
 Include the generated interface declarations.
 

Functions

template<typename ScfOp , typename OpTy >
static void replaceSCFOutputValue (ScfOp scfOp, OpTy newOp, ConversionPatternRewriter &rewriter, ScfToSPIRVContextImpl *scfToSPIRVContext, ArrayRef< Type > returnTypes)
 Helper function to replaces SCF op outputs with SPIR-V variable loads. More...
 
static Region::iterator getBlockIt (Region &region, unsigned index)
 

Function Documentation

◆ getBlockIt()

static Region::iterator getBlockIt ( Region region,
unsigned  index 
)
static

Definition at line 153 of file SCFToSPIRV.cpp.

References mlir::Region::begin().

◆ replaceSCFOutputValue()

template<typename ScfOp , typename OpTy >
static void replaceSCFOutputValue ( ScfOp  scfOp,
OpTy  newOp,
ConversionPatternRewriter rewriter,
ScfToSPIRVContextImpl scfToSPIRVContext,
ArrayRef< Type returnTypes 
)
static

Helper function to replaces SCF op outputs with SPIR-V variable loads.

We create VariableOp to handle the results value of the control flow region. spirv.mlir.loop/spirv.mlir.selection currently don't yield value. Right after the loop we load the value from the allocation and use it as the SCF op result.

Definition at line 127 of file SCFToSPIRV.cpp.

References mlir::OpBuilder::create(), mlir::spirv::PointerType::get(), mlir::ScfToSPIRVContextImpl::outputVars, mlir::ConversionPatternRewriter::replaceOp(), mlir::OpBuilder::setInsertionPoint(), and mlir::OpBuilder::setInsertionPointAfter().