MLIR  21.0.0git
Macros | Functions
LowerVectorShapeCast.cpp File Reference
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/UB//IR/UBOps.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Transforms/LoweringPatterns.h"
#include "mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include <numeric>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "vector-shape-cast-lowering"
 

Functions

static void inplaceAdd (int64_t lhs, ArrayRef< int64_t > base, MutableArrayRef< int64_t > rhs)
 Perform the inplace update rhs <- lhs + rhs. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "vector-shape-cast-lowering"

Definition at line 26 of file LowerVectorShapeCast.cpp.

Function Documentation

◆ inplaceAdd()

static void inplaceAdd ( int64_t  lhs,
ArrayRef< int64_t >  base,
MutableArrayRef< int64_t >  rhs 
)
static

Perform the inplace update rhs <- lhs + rhs.

where rhs is a number expressed in mixed base base with most signficant dimensions on the left. For example if rhs is {a,b,c} and base is {5,3,2} then rhs has value a*3*2 + b*2 + c.

Some examples where base is {5,3,2}: rhs = {0,0,0}, lhs = 1 --> rhs = {0,0,1} rhs = {0,0,1}, lhs = 1 --> rhs = {0,1,0} rhs = {0,0,0}, lhs = 25 --> rhs = {4,0,1}

Invalid: rhs = {0,0,2}, lhs = 1 : rhs not in base {5,3,2}

Overflows not handled correctly: rhs = {4,2,1}, lhs = 2 --> rhs = {0,0,0} (not {0,0,1})

Definition at line 47 of file LowerVectorShapeCast.cpp.