MLIR  16.0.0git
Macros | Functions
BuiltinTypes.cpp File Reference
#include "mlir/IR/BuiltinTypes.h"
#include "TypeDetail.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinDialect.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/FunctionInterfaces.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/TensorEncoding.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/TypeSwitch.h"
#include "mlir/IR/BuiltinTypes.cpp.inc"
+ Include dependency graph for BuiltinTypes.cpp:

Go to the source code of this file.

Macros

#define GET_TYPEDEF_CLASSES
 Tablegen Type Definitions. More...
 
#define GET_TYPEDEF_LIST
 

Functions

static LogicalResult checkTensorElementType (function_ref< InFlightDiagnostic()> emitError, Type elementType)
 
static void extractStridesFromTerm (AffineExpr e, AffineExpr multiplicativeFactor, MutableArrayRef< AffineExpr > strides, AffineExpr &offset)
 
static LogicalResult extractStrides (AffineExpr e, AffineExpr multiplicativeFactor, MutableArrayRef< AffineExpr > strides, AffineExpr &offset)
 Takes a single AffineExpr e and populates the strides array with the strides expressions for each dim position. More...
 
static LogicalResult getStridesAndOffset (MemRefType t, SmallVectorImpl< AffineExpr > &strides, AffineExpr &offset)
 A stride specification is a list of integer values that are either static or dynamic (encoded with ShapedType::kDynamic). More...
 

Macro Definition Documentation

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

Tablegen Type Definitions.

Definition at line 33 of file BuiltinTypes.cpp.

◆ GET_TYPEDEF_LIST

#define GET_TYPEDEF_LIST

Function Documentation

◆ checkTensorElementType()

static LogicalResult checkTensorElementType ( function_ref< InFlightDiagnostic()>  emitError,
Type  elementType 
)
static

◆ extractStrides()

static LogicalResult extractStrides ( AffineExpr  e,
AffineExpr  multiplicativeFactor,
MutableArrayRef< AffineExpr strides,
AffineExpr offset 
)
static

Takes a single AffineExpr e and populates the strides array with the strides expressions for each dim position.

The convention is that the strides for dimensions d0, .. dn appear in order to make indexing intuitive into the result.

Definition at line 663 of file BuiltinTypes.cpp.

References mlir::Add, mlir::CeilDiv, mlir::AffineExpr::dyn_cast(), extractStridesFromTerm(), mlir::failure(), mlir::FloorDiv, mlir::Mod, mlir::Mul, mlir::succeeded(), and mlir::success().

Referenced by foldExtractStridedOpFromInsertChain(), and getStridesAndOffset().

◆ extractStridesFromTerm()

static void extractStridesFromTerm ( AffineExpr  e,
AffineExpr  multiplicativeFactor,
MutableArrayRef< AffineExpr strides,
AffineExpr offset 
)
static

Definition at line 648 of file BuiltinTypes.cpp.

References mlir::AffineExpr::dyn_cast().

Referenced by extractStrides().

◆ getStridesAndOffset()

static LogicalResult getStridesAndOffset ( MemRefType  t,
SmallVectorImpl< AffineExpr > &  strides,
AffineExpr offset 
)
static

A stride specification is a list of integer values that are either static or dynamic (encoded with ShapedType::kDynamic).

Strides encode the distance in the number of elements between successive entries along a particular dimension.

For example, memref<42x16xf32, (64 * d0 + d1)> specifies a view into a non-contiguous memory region of 42 by 16 f32 elements in which the distance between two consecutive elements along the outer dimension is 1 and the distance between two consecutive elements along the inner dimension is 64.

The convention is that the strides for dimensions d0, .. dn appear in order to make indexing intuitive into the result.

Definition at line 720 of file BuiltinTypes.cpp.

References extractStrides(), mlir::failed(), mlir::failure(), mlir::getAffineConstantExpr(), mlir::AffineExpr::getContext(), mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumResults(), mlir::AffineMap::getNumSymbols(), mlir::AffineMap::getResult(), mlir::AffineMap::isIdentity(), mlir::makeCanonicalStridedLayoutExpr(), mlir::simplifyAffineExpr(), mlir::succeeded(), and mlir::success().