MLIR  16.0.0git
Public Member Functions | Public Attributes | List of all members
mlir::VectorTransferToSCFOptions Struct Reference

When lowering an N-d vector transfer op to an (N-1)-d vector transfer op, a temporary buffer is created through which individual (N-1)-d vector are staged. More...

#include "mlir/Conversion/VectorToSCF/VectorToSCF.h"

+ Collaboration diagram for mlir::VectorTransferToSCFOptions:

Public Member Functions

VectorTransferToSCFOptionssetTargetRank (unsigned r)
 
VectorTransferToSCFOptionsenableLowerPermutationMaps (bool l=true)
 
VectorTransferToSCFOptionsenableLowerTensors (bool l=true)
 
VectorTransferToSCFOptionsenableFullUnroll (bool u=true)
 

Public Attributes

unsigned targetRank = 1
 Minimal rank to which vector transfer are lowered. More...
 
bool lowerPermutationMaps = false
 
bool lowerTensors = false
 Allows vector transfers that operated on tensors to be lowered (this is an uncommon alternative). More...
 
bool unroll = false
 Triggers full unrolling (vs iterating with a loop) during transfer to scf. More...
 

Detailed Description

When lowering an N-d vector transfer op to an (N-1)-d vector transfer op, a temporary buffer is created through which individual (N-1)-d vector are staged.

This pattern can be applied multiple time, until the transfer op is 1-d. This is consistent with the lack of an LLVM instruction to dynamically index into an aggregate (see the Vector dialect lowering to LLVM deep dive).

An instruction such as:

vector.transfer_write %vec, %A[%a, %b, %c] :
vector<9x17x15xf32>, memref<?x?x?xf32>

Lowers to pseudo-IR resembling (unpacking one dimension):

%0 = alloca() : memref<vector<9x17x15xf32>>
store %vec, %0[] : memref<vector<9x17x15xf32>>
%1 = vector.type_cast %0 :
memref<vector<9x17x15xf32>> to memref<9xvector<17x15xf32>>
affine.for %I = 0 to 9 {
%dim = dim %A, 0 : memref<?x?x?xf32>
%add = affine.apply %I + %a
%cmp = arith.cmpi "slt", %add, %dim : index
scf.if %cmp {
%vec_2d = load %1[%I] : memref<9xvector<17x15xf32>>
vector.transfer_write %vec_2d, %A[%add, %b, %c] :
vector<17x15xf32>, memref<?x?x?xf32>

When applying the pattern a second time, the existing alloca() operation is reused and only a second vector.type_cast is added.

Definition at line 52 of file VectorToSCF.h.

Member Function Documentation

◆ enableFullUnroll()

VectorTransferToSCFOptions& mlir::VectorTransferToSCFOptions::enableFullUnroll ( bool  u = true)
inline

Definition at line 74 of file VectorToSCF.h.

References unroll.

◆ enableLowerPermutationMaps()

VectorTransferToSCFOptions& mlir::VectorTransferToSCFOptions::enableLowerPermutationMaps ( bool  l = true)
inline

Definition at line 61 of file VectorToSCF.h.

References lowerPermutationMaps.

◆ enableLowerTensors()

VectorTransferToSCFOptions& mlir::VectorTransferToSCFOptions::enableLowerTensors ( bool  l = true)
inline

Definition at line 68 of file VectorToSCF.h.

References lowerTensors.

◆ setTargetRank()

VectorTransferToSCFOptions& mlir::VectorTransferToSCFOptions::setTargetRank ( unsigned  r)
inline

Definition at line 55 of file VectorToSCF.h.

References targetRank.

Member Data Documentation

◆ lowerPermutationMaps

bool mlir::VectorTransferToSCFOptions::lowerPermutationMaps = false

Definition at line 60 of file VectorToSCF.h.

Referenced by enableLowerPermutationMaps().

◆ lowerTensors

bool mlir::VectorTransferToSCFOptions::lowerTensors = false

Allows vector transfers that operated on tensors to be lowered (this is an uncommon alternative).

Definition at line 67 of file VectorToSCF.h.

Referenced by enableLowerTensors().

◆ targetRank

unsigned mlir::VectorTransferToSCFOptions::targetRank = 1

Minimal rank to which vector transfer are lowered.

Definition at line 54 of file VectorToSCF.h.

Referenced by setTargetRank().

◆ unroll

bool mlir::VectorTransferToSCFOptions::unroll = false

Triggers full unrolling (vs iterating with a loop) during transfer to scf.

Definition at line 73 of file VectorToSCF.h.

Referenced by enableFullUnroll().


The documentation for this struct was generated from the following file: