|
MLIR 22.0.0git
|
Helper class to produce LLVM dialect operations extracting or inserting elements of a MemRef descriptor. More...
#include "mlir/Conversion/LLVMCommon/MemRefBuilder.h"
Public Member Functions | |
| MemRefDescriptor (Value descriptor) | |
| Construct a helper for the given descriptor value. | |
| Value | allocatedPtr (OpBuilder &builder, Location loc) |
| Builds IR extracting the allocated pointer from the descriptor. | |
| void | setAllocatedPtr (OpBuilder &builder, Location loc, Value ptr) |
| Builds IR inserting the allocated pointer into the descriptor. | |
| Value | alignedPtr (OpBuilder &builder, Location loc) |
| Builds IR extracting the aligned pointer from the descriptor. | |
| void | setAlignedPtr (OpBuilder &builder, Location loc, Value ptr) |
| Builds IR inserting the aligned pointer into the descriptor. | |
| Value | offset (OpBuilder &builder, Location loc) |
| Builds IR extracting the offset from the descriptor. | |
| void | setOffset (OpBuilder &builder, Location loc, Value offset) |
| Builds IR inserting the offset into the descriptor. | |
| void | setConstantOffset (OpBuilder &builder, Location loc, uint64_t offset) |
| Builds IR inserting the offset into the descriptor. | |
| Value | size (OpBuilder &builder, Location loc, unsigned pos) |
| Builds IR extracting the pos-th size from the descriptor. | |
| Value | size (OpBuilder &builder, Location loc, Value pos, int64_t rank) |
| void | setSize (OpBuilder &builder, Location loc, unsigned pos, Value size) |
| Builds IR inserting the pos-th size into the descriptor. | |
| void | setConstantSize (OpBuilder &builder, Location loc, unsigned pos, uint64_t size) |
| Value | stride (OpBuilder &builder, Location loc, unsigned pos) |
| Builds IR extracting the pos-th size from the descriptor. | |
| void | setStride (OpBuilder &builder, Location loc, unsigned pos, Value stride) |
| Builds IR inserting the pos-th stride into the descriptor. | |
| void | setConstantStride (OpBuilder &builder, Location loc, unsigned pos, uint64_t stride) |
| Type | getIndexType () |
| Returns the type of array element in this descriptor. | |
| LLVM::LLVMPointerType | getElementPtrType () |
| Returns the (LLVM) pointer type this descriptor contains. | |
| Value | bufferPtr (OpBuilder &builder, Location loc, const LLVMTypeConverter &converter, MemRefType type) |
| Builds IR for getting the start address of the buffer represented by this memref: memref.alignedPtr + memref.offset * sizeof(type.getElementType()). | |
| Public Member Functions inherited from mlir::StructBuilder | |
| StructBuilder (Value v) | |
| Construct a helper for the given value. | |
| operator Value () | |
Static Public Member Functions | |
| static MemRefDescriptor | poison (OpBuilder &builder, Location loc, Type descriptorType) |
| Builds IR creating a poison value of the descriptor type. | |
| static MemRefDescriptor | fromStaticShape (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, MemRefType type, Value memory) |
| Builds IR creating a MemRef descriptor that represents type and populates it with static shape and stride information extracted from the type. | |
| static MemRefDescriptor | fromStaticShape (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, MemRefType type, Value memory, Value alignedMemory) |
| static Value | pack (OpBuilder &builder, Location loc, const LLVMTypeConverter &converter, MemRefType type, ValueRange values) |
| Builds IR populating a MemRef descriptor structure from a list of individual values composing that descriptor, in the following order: | |
| static void | unpack (OpBuilder &builder, Location loc, Value packed, MemRefType type, SmallVectorImpl< Value > &results) |
| Builds IR extracting individual elements of a MemRef descriptor structure and returning them as results list. | |
| static unsigned | getNumUnpackedValues (MemRefType type) |
| Returns the number of non-aggregate values that would be produced by unpack. | |
| Static Public Member Functions inherited from mlir::StructBuilder | |
| static StructBuilder | poison (OpBuilder &builder, Location loc, Type descriptorType) |
| Builds IR creating a poison value of the descriptor type. | |
Additional Inherited Members | |
| Protected Member Functions inherited from mlir::StructBuilder | |
| Value | extractPtr (OpBuilder &builder, Location loc, unsigned pos) const |
| Builds IR to extract a value from the struct at position pos. | |
| void | setPtr (OpBuilder &builder, Location loc, unsigned pos, Value ptr) |
| Builds IR to set a value in the struct at position pos. | |
| Protected Attributes inherited from mlir::StructBuilder | |
| Value | value |
| Type | structType |
Helper class to produce LLVM dialect operations extracting or inserting elements of a MemRef descriptor.
Wraps a Value pointing to the descriptor. The Value may be null, in which case none of the operations are valid.
Definition at line 33 of file MemRefBuilder.h.
|
explicit |
Construct a helper for the given descriptor value.
Definition at line 24 of file MemRefBuilder.cpp.
References kOffsetPosInMemRefDescriptor, MemRefDescriptor(), mlir::StructBuilder::StructBuilder(), and mlir::StructBuilder::value.
Referenced by fromStaticShape(), MemRefDescriptor(), poison(), and unpack().
| Value MemRefDescriptor< T, N >::alignedPtr | ( | OpBuilder & | builder, |
| Location | loc ) |
Builds IR extracting the aligned pointer from the descriptor.
Definition at line 88 of file MemRefBuilder.cpp.
References mlir::StructBuilder::extractPtr(), and kAlignedPtrPosInMemRefDescriptor.
Referenced by bufferPtr(), mlir::LLVMTypeConverter::promoteOperands(), and unpack().
| Value MemRefDescriptor< T, N >::allocatedPtr | ( | OpBuilder & | builder, |
| Location | loc ) |
Builds IR extracting the allocated pointer from the descriptor.
Definition at line 77 of file MemRefBuilder.cpp.
References mlir::StructBuilder::extractPtr(), and kAllocatedPtrPosInMemRefDescriptor.
Referenced by mlir::GPUReturnOpLowering::matchAndRewrite(), and unpack().
| Value MemRefDescriptor< T, N >::bufferPtr | ( | OpBuilder & | builder, |
| Location | loc, | ||
| const LLVMTypeConverter & | converter, | ||
| MemRefType | type ) |
Builds IR for getting the start address of the buffer represented by this memref: memref.alignedPtr + memref.offset * sizeof(type.getElementType()).
Definition at line 195 of file MemRefBuilder.cpp.
References alignedPtr(), createIndexAttrConstant(), mlir::LLVMTypeConverter::getIndexType(), and offset().
Referenced by getMemrefBuffPtr(), and mlir::LLVM::getStridedElementPtr().
|
static |
Builds IR creating a MemRef descriptor that represents type and populates it with static shape and stride information extracted from the type.
Definition at line 43 of file MemRefBuilder.cpp.
References fromStaticShape().
Referenced by fromStaticShape(), mlir::GPUFuncOpLowering::matchAndRewrite(), and packRankedMemRefDesc().
|
static |
Definition at line 49 of file MemRefBuilder.cpp.
References MemRefDescriptor(), offset(), and poison().
| LLVM::LLVMPointerType MemRefDescriptor< T, N >::getElementPtrType | ( | ) |
Returns the (LLVM) pointer type this descriptor contains.
Definition at line 189 of file MemRefBuilder.cpp.
References kAlignedPtrPosInMemRefDescriptor, and mlir::StructBuilder::value.
Referenced by getIndexedPtrs(), and mlir::LLVM::getStridedElementPtr().
|
inline |
Returns the type of array element in this descriptor.
Definition at line 88 of file MemRefBuilder.h.
|
static |
Returns the number of non-aggregate values that would be produced by unpack.
Definition at line 266 of file MemRefBuilder.cpp.
Referenced by unpack(), and wrapExternalFunction().
| Value MemRefDescriptor< T, N >::offset | ( | OpBuilder & | builder, |
| Location | loc ) |
Builds IR extracting the offset from the descriptor.
Definition at line 107 of file MemRefBuilder.cpp.
References kOffsetPosInMemRefDescriptor, and mlir::StructBuilder::value.
Referenced by bufferPtr(), fromStaticShape(), setConstantOffset(), setOffset(), and unpack().
|
static |
Builds IR populating a MemRef descriptor structure from a list of individual values composing that descriptor, in the following order:
Creates a MemRef descriptor structure from a list of individual values composing that descriptor, in the following order:
Definition at line 227 of file MemRefBuilder.cpp.
References kAlignedPtrPosInMemRefDescriptor, kAllocatedPtrPosInMemRefDescriptor, kOffsetPosInMemRefDescriptor, kSizePosInMemRefDescriptor, and poison().
Referenced by packRankedMemRefDesc(), and wrapExternalFunction().
|
static |
Builds IR creating a poison value of the descriptor type.
Builds IR creating an undef value of the descriptor type.
Definition at line 32 of file MemRefBuilder.cpp.
References MemRefDescriptor().
Referenced by mlir::ConvertToLLVMPattern::createMemRefDescriptor(), fromStaticShape(), and pack().
| void MemRefDescriptor< T, N >::setAlignedPtr | ( | OpBuilder & | builder, |
| Location | loc, | ||
| Value | ptr ) |
Builds IR inserting the aligned pointer into the descriptor.
Definition at line 93 of file MemRefBuilder.cpp.
References kAlignedPtrPosInMemRefDescriptor, and mlir::StructBuilder::setPtr().
| void MemRefDescriptor< T, N >::setAllocatedPtr | ( | OpBuilder & | builder, |
| Location | loc, | ||
| Value | ptr ) |
Builds IR inserting the allocated pointer into the descriptor.
Definition at line 82 of file MemRefBuilder.cpp.
References kAllocatedPtrPosInMemRefDescriptor, and mlir::StructBuilder::setPtr().
| void MemRefDescriptor< T, N >::setConstantOffset | ( | OpBuilder & | builder, |
| Location | loc, | ||
| uint64_t | offset ) |
Builds IR inserting the offset into the descriptor.
Definition at line 120 of file MemRefBuilder.cpp.
References createIndexAttrConstant(), offset(), and setOffset().
| void MemRefDescriptor< T, N >::setConstantSize | ( | OpBuilder & | builder, |
| Location | loc, | ||
| unsigned | pos, | ||
| uint64_t | size ) |
Definition at line 162 of file MemRefBuilder.cpp.
References createIndexAttrConstant(), setSize(), and size().
| void MemRefDescriptor< T, N >::setConstantStride | ( | OpBuilder & | builder, |
| Location | loc, | ||
| unsigned | pos, | ||
| uint64_t | stride ) |
Definition at line 183 of file MemRefBuilder.cpp.
References createIndexAttrConstant(), setStride(), and stride().
| void MemRefDescriptor< T, N >::setOffset | ( | OpBuilder & | builder, |
| Location | loc, | ||
| Value | offset ) |
Builds IR inserting the offset into the descriptor.
Definition at line 113 of file MemRefBuilder.cpp.
References kOffsetPosInMemRefDescriptor, offset(), and mlir::StructBuilder::value.
Referenced by setConstantOffset().
| void MemRefDescriptor< T, N >::setSize | ( | OpBuilder & | builder, |
| Location | loc, | ||
| unsigned | pos, | ||
| Value | size ) |
Builds IR inserting the pos-th size into the descriptor.
Definition at line 155 of file MemRefBuilder.cpp.
References kSizePosInMemRefDescriptor, size(), and mlir::StructBuilder::value.
Referenced by setConstantSize().
| void MemRefDescriptor< T, N >::setStride | ( | OpBuilder & | builder, |
| Location | loc, | ||
| unsigned | pos, | ||
| Value | stride ) |
Builds IR inserting the pos-th stride into the descriptor.
Definition at line 176 of file MemRefBuilder.cpp.
References kStridePosInMemRefDescriptor, stride(), and mlir::StructBuilder::value.
Referenced by setConstantStride().
| Value MemRefDescriptor< T, N >::size | ( | OpBuilder & | builder, |
| Location | loc, | ||
| unsigned | pos ) |
Builds IR extracting the pos-th size from the descriptor.
Definition at line 127 of file MemRefBuilder.cpp.
References kSizePosInMemRefDescriptor, and mlir::StructBuilder::value.
Referenced by getNumRecords(), setConstantSize(), setSize(), and unpack().
Definition at line 133 of file MemRefBuilder.cpp.
References createIndexAttrConstant(), mlir::Builder::getContext(), kSizePosInMemRefDescriptor, and mlir::StructBuilder::value.
| Value MemRefDescriptor< T, N >::stride | ( | OpBuilder & | builder, |
| Location | loc, | ||
| unsigned | pos ) |
Builds IR extracting the pos-th size from the descriptor.
Builds IR extracting the pos-th stride from the descriptor.
Definition at line 169 of file MemRefBuilder.cpp.
References kStridePosInMemRefDescriptor, and mlir::StructBuilder::value.
Referenced by getLinearIndexI32(), getNumRecords(), mlir::LLVM::getStridedElementPtr(), inferStride(), setConstantStride(), setStride(), and unpack().
|
static |
Builds IR extracting individual elements of a MemRef descriptor structure and returning them as results list.
Definition at line 248 of file MemRefBuilder.cpp.
References alignedPtr(), allocatedPtr(), getNumUnpackedValues(), MemRefDescriptor(), offset(), size(), and stride().
Referenced by mlir::LLVMTypeConverter::promoteOperands(), and wrapForExternalCallers().