Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.td | ||
---|---|---|
177 | Add: It modifies the payload. Dead allocations, loads and stores are silently dropped from all mappings. | |
mlir/lib/Dialect/MemRef/Utils/MemRefUtils.cpp | ||
128 | I would implement in terms of: static bool valueIsNotRead(OpResult opResult, std::vector<Operation *> &users) and call with the result of the AllocOp. | |
132–133 | You can query memory side effects instead of hard-coding the ops here: Add a templatized copy of bool isMemoryEffectFree(Operation *op); to SideEffectInterface.h and SideEffectInterfaces.cpp, where the side effect can be specified as template parameter. In the implementation, use !hasEffect<EffectTy>(op) instead of !memInterface.hasNoEffect(). Then call this function here: if (useOp->getNumResults() == 0 && mlir::isSideEffectFree<MemoryEffects::Read>(useOp)) { // There are no reads and no alias is created. ... } (Still need special handling for memref::DeallocOp.) | |
134 | If it's a memref.subview, you can call allUsesAreStores recursively. (Or have a worklist of operations in this function.) Then you can also handle memref.subview(memref.subview(alloc)). | |
144 | You need a RewriterBase &rewriter here and modify the IR with that rewriter. (Pass it from applyToOne.) Otherwise, the transform dialect state will be inconsistent. | |
146 | Could also do this for memref::AllocaOp. |
address comments
mlir/lib/Dialect/MemRef/Utils/MemRefUtils.cpp | ||
---|---|---|
132–133 | I used SideEffect. I'm not very familiar with them, please take a look if I implemented something wrong. Thanks! | |
134 | I don't follow the suggestion. Isn't it already doing what you mentioned? If it is a memref.subview op, it calls the method recursively. |
Add: It modifies the payload. Dead allocations, loads and stores are silently dropped from all mappings.