This is an archive of the discontinued LLVM Phabricator instance.

[mlir][MemRef] Rewrite multi-buffering with proper composable abstractions
ClosedPublic

Authored by nicolasvasilache on Mar 1 2023, 3:53 AM.

Details

Summary

Rewrite and document multi-buffering properly:

  1. Use IndexingUtils / StaticValueUtils instead of duplicating functionality
  2. Properly plumb RewriterBase through.
  3. Add support
  4. Better debug messages.

This revision is otherwise almost NFC, if it weren't for the extra DeallocOp
support that would previoulsy make multi-buffering fail.

Depends on: D145036

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2023, 3:53 AM
nicolasvasilache requested review of this revision.Mar 1 2023, 3:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2023, 3:53 AM

Add test and fix Dealloc precondition.

qcolombet accepted this revision.Mar 1 2023, 6:30 AM
qcolombet added inline comments.
mlir/include/mlir/Dialect/Utils/StaticValueUtils.h
89

Nit: Dangling For each

93

What's different about this function and getValueOrCreateConstantIndexOp?
Put differently, do we need it?

mlir/lib/Dialect/MemRef/Transforms/MultiBuffer.cpp
71

Agree, we should fix this at some point. In particular I believe it goes against what we say in the developer guide for MLIR.

mlir/lib/Dialect/Utils/StaticValueUtils.cpp
153

Assuming we need this function, we can drop the comments here.
They are already in the header.

This revision is now accepted and ready to land.Mar 1 2023, 6:30 AM
nicolasvasilache marked 4 inline comments as done.Mar 1 2023, 7:25 AM
nicolasvasilache added inline comments.
mlir/include/mlir/Dialect/Utils/StaticValueUtils.h
93

yeah it's annoying... functionality has been duplicated.
Killing redundant uses, the price is an extra comment and a TODO for the future..