MLIR 22.0.0git
Loops.cpp File Reference

Go to the source code of this file.

Classes

class  mlir::impl::ConvertLinalgToAffineLoopsPassBase< DerivedT >
class  mlir::impl::ConvertLinalgToLoopsPassBase< DerivedT >
class  mlir::impl::ConvertLinalgToParallelLoopsPassBase< DerivedT >
struct  InputAndOutputIndices

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::impl
 Attribute collections provide a dictionary-like interface.

Macros

#define GEN_PASS_DEF_CONVERTLINALGTOAFFINELOOPSPASS
#define GEN_PASS_DEF_CONVERTLINALGTOLOOPSPASS
#define GEN_PASS_DEF_CONVERTLINALGTOPARALLELLOOPSPASS

Functions

std::unique_ptr<::mlir::Passmlir::impl::createConvertLinalgToAffineLoopsPass ()
std::unique_ptr<::mlir::Passmlir::createConvertLinalgToAffineLoopsPass ()
std::unique_ptr<::mlir::Passmlir::impl::createConvertLinalgToLoopsPass ()
std::unique_ptr<::mlir::Passmlir::createConvertLinalgToLoopsPass ()
std::unique_ptr<::mlir::Passmlir::impl::createConvertLinalgToParallelLoopsPass ()
std::unique_ptr<::mlir::Passmlir::createConvertLinalgToParallelLoopsPass ()
static SmallVector< ValuemakeCanonicalAffineApplies (OpBuilder &b, Location loc, AffineMap map, ArrayRef< Value > vals)
template<typename LoadOpTy, typename StoreOpTy, typename OpType>
static void inlineRegionAndEmitStore (OpBuilder &b, Location loc, OpType op, ArrayRef< Value > indexedValues, ArrayRef< SmallVector< Value > > indexing, ArrayRef< Value > outputBuffers)
template<typename SingleInputPoolingOp>
static InputAndOutputIndices getInputAndOutputIndices (OpBuilder &b, Location loc, ArrayRef< Value > allIvs, SingleInputPoolingOp op)
template<typename LoadOpTy, typename StoreOpTy>
static void emitScalarImplementation (OpBuilder &b, Location loc, ArrayRef< Value > allIvs, LinalgOp linalgOp)
 Emits the MLIR for the scalar part of the generic op by:
static void replaceIndexOpsByInductionVariables (RewriterBase &rewriter, LinalgOp linalgOp, ArrayRef< Operation * > loopOps)
 Replace the index operations in the body of the loop nest by the matching induction variables.
template<typename LoopTy>
static FailureOr< LinalgLoopslinalgOpToLoopsImpl (RewriterBase &rewriter, LinalgOp linalgOp)

Macro Definition Documentation

◆ GEN_PASS_DEF_CONVERTLINALGTOAFFINELOOPSPASS

#define GEN_PASS_DEF_CONVERTLINALGTOAFFINELOOPSPASS

Definition at line 29 of file Loops.cpp.

◆ GEN_PASS_DEF_CONVERTLINALGTOLOOPSPASS

#define GEN_PASS_DEF_CONVERTLINALGTOLOOPSPASS

Definition at line 30 of file Loops.cpp.

◆ GEN_PASS_DEF_CONVERTLINALGTOPARALLELLOOPSPASS

#define GEN_PASS_DEF_CONVERTLINALGTOPARALLELLOOPSPASS

Definition at line 31 of file Loops.cpp.

Function Documentation

◆ emitScalarImplementation()

template<typename LoadOpTy, typename StoreOpTy>
void emitScalarImplementation ( OpBuilder & b,
Location loc,
ArrayRef< Value > allIvs,
LinalgOp linalgOp )
static

Emits the MLIR for the scalar part of the generic op by:

  1. Emitting load ops for each input and output view in order. This is achieved by applying the appropriate input or output map to the enclosing induction variables.
  2. Emitting a call to op.fun() that takes as arguments the scalars from point 1. above.
  3. Emitting store ops to store the results of 2. to the output views.

An example output may resemble:

scf.for %i = %c0 to %0 step %c1 {
scf.for %j = %c0 to %1 step %c1 {
scf.for %k = %c0 to %4 step %c1 {
%11 = load %arg0[%i, %j] :
%12 = load %arg1[%i, %j, %k] :
%13 = load %arg2[%i, %k, %j] :
%14:2 = call @foo(%11, %12, %13) : (f32, f32, f32) -> (f32, f32)
store %14#0, %arg1[%i, %j, %k] :
memref<?x?x?Xf32, stride_specification>
store %14#1, %arg2[%i, %k, %j] :
memref<?x?x?Xf32, stride_specification>
}
}
}
auto load
Eliminates variable at the specified position using Fourier-Motzkin variable elimination.

Definition at line 128 of file Loops.cpp.

References b.

◆ getInputAndOutputIndices()

template<typename SingleInputPoolingOp>
InputAndOutputIndices getInputAndOutputIndices ( OpBuilder & b,
Location loc,
ArrayRef< Value > allIvs,
SingleInputPoolingOp op )
static

Definition at line 87 of file Loops.cpp.

References b, and makeCanonicalAffineApplies().

◆ inlineRegionAndEmitStore()

template<typename LoadOpTy, typename StoreOpTy, typename OpType>
void inlineRegionAndEmitStore ( OpBuilder & b,
Location loc,
OpType op,
ArrayRef< Value > indexedValues,
ArrayRef< SmallVector< Value > > indexing,
ArrayRef< Value > outputBuffers )
static

◆ linalgOpToLoopsImpl()

template<typename LoopTy>
FailureOr< LinalgLoops > linalgOpToLoopsImpl ( RewriterBase & rewriter,
LinalgOp linalgOp )
static

◆ makeCanonicalAffineApplies()

◆ replaceIndexOpsByInductionVariables()

void replaceIndexOpsByInductionVariables ( RewriterBase & rewriter,
LinalgOp linalgOp,
ArrayRef< Operation * > loopOps )
static

Replace the index operations in the body of the loop nest by the matching induction variables.

Definition at line 179 of file Loops.cpp.