MLIR 24.0.0git
MemorySlotInterfacesImpl.cpp File Reference

Go to the source code of this file.

Functions

static bool isUnitStrideSliceOfStaticParent (memref::SubViewOp subView)
 Checks the requirements shared by static and dynamic subview aliases: a parent with a static shape and a valid vector element type, no rank reduction, and unit slice strides.
static bool isAliasableStaticShapeSubView (memref::SubViewOp subView)
 Returns whether static subView can alias a slice of the parent vector using vector.extract_strided_slice and vector.insert_strided_slice.
static bool isAliasableDynamicShapeSubView (memref::SubViewOp subView)
 Returns whether dynamic subView can alias the whole parent vector.
static SmallVector< int64_t > getStaticSubViewOffsets (memref::SubViewOp subView)
 Returns the static offsets of subView within the parent vector for vector.extract_strided_slice and vector.insert_strided_slice.
static VectorType getWholeParentVectorType (memref::SubViewOp subView)
 The vector type covering subView's whole parent buffer, which is the type the alias slot of a dynamically-shaped subview takes.
static memref::SubViewOp getDynamicSubView (Value slotPtr)
 If slotPtr is a dynamic subview, returns it.
static Value buildSubViewMask (OpBuilder &builder, Location loc, memref::SubViewOp subView)
 Builds the mask of subView's valid region: a vector.create_mask of the subview's sizes, in the shape of the whole parent that its alias holds.

Function Documentation

◆ buildSubViewMask()

Value buildSubViewMask ( OpBuilder & builder,
Location loc,
memref::SubViewOp subView )
static

Builds the mask of subView's valid region: a vector.create_mask of the subview's sizes, in the shape of the whole parent that its alias holds.

Definition at line 145 of file MemorySlotInterfacesImpl.cpp.

References mlir::Builder::getI1Type(), mlir::getValueOrCreateConstantIndexOp(), and getWholeParentVectorType().

Referenced by mlir::memref::buildDynamicSubViewMask().

◆ getDynamicSubView()

memref::SubViewOp getDynamicSubView ( Value slotPtr)
static

If slotPtr is a dynamic subview, returns it.

Definition at line 136 of file MemorySlotInterfacesImpl.cpp.

References mlir::Value::getDefiningOp(), and isAliasableDynamicShapeSubView().

Referenced by mlir::memref::buildDynamicSubViewMask(), and mlir::memref::isDynamicSubViewSlot().

◆ getStaticSubViewOffsets()

SmallVector< int64_t > getStaticSubViewOffsets ( memref::SubViewOp subView)
static

Returns the static offsets of subView within the parent vector for vector.extract_strided_slice and vector.insert_strided_slice.

Definition at line 117 of file MemorySlotInterfacesImpl.cpp.

References mlir::getConstantIntValue().

◆ getWholeParentVectorType()

VectorType getWholeParentVectorType ( memref::SubViewOp subView)
static

The vector type covering subView's whole parent buffer, which is the type the alias slot of a dynamically-shaped subview takes.

Definition at line 129 of file MemorySlotInterfacesImpl.cpp.

Referenced by buildSubViewMask().

◆ isAliasableDynamicShapeSubView()

bool isAliasableDynamicShapeSubView ( memref::SubViewOp subView)
static

Returns whether dynamic subView can alias the whole parent vector.

The alias uses the parent vector's shape because vector dimensions cannot be dynamic. Requires a static source shape, a dynamic result shape, zero offsets, unit strides, and no rank reduction.

TODO: Allow non-zero offsets by improving buildSubViewMask().

Definition at line 104 of file MemorySlotInterfacesImpl.cpp.

References isUnitStrideSliceOfStaticParent().

Referenced by getDynamicSubView().

◆ isAliasableStaticShapeSubView()

bool isAliasableStaticShapeSubView ( memref::SubViewOp subView)
static

Returns whether static subView can alias a slice of the parent vector using vector.extract_strided_slice and vector.insert_strided_slice.

Requires static source and result shapes, constant offsets, unit strides, and no rank reduction.

Definition at line 87 of file MemorySlotInterfacesImpl.cpp.

References isUnitStrideSliceOfStaticParent().

◆ isUnitStrideSliceOfStaticParent()

bool isUnitStrideSliceOfStaticParent ( memref::SubViewOp subView)
static

Checks the requirements shared by static and dynamic subview aliases: a parent with a static shape and a valid vector element type, no rank reduction, and unit slice strides.

Definition at line 64 of file MemorySlotInterfacesImpl.cpp.

Referenced by isAliasableDynamicShapeSubView(), and isAliasableStaticShapeSubView().