Confusion about one-shot-bufferization dealloc memory

Hi
at the slide of https://mlir.llvm.org/OpenMeetings/2022-01-13-One-Shot-Bufferization.pdf (page 63), it indicate the one-shot-buffer will dealloc automatically for allocs that do not escape block boundaries.

but at the Bufferization - MLIR, it said:

One-Shot Bufferize leaks all memory and does not generate any buffer deallocations. The -buffer-deallocation-pipeline has to be run afterwards to insert the deallocation operations.

pls help me to clear it, thanks

Hi @alanguo1234 , what is shown on the slides used to be the case, but there were recent changes. Please, take a look at:

  1. [mlir][bufferization] Add an ownership based buffer deallocation pass… · llvm/llvm-project@01334d1 · GitHub
  2. [PSA] Bufferization: New Buffer Deallocation Pipeline

Hope this helps.

Hi
it mean in the past versions, one-shot-bufferization dealloc automatically. now It don’t do that, after one-shot-bufferize, need to use buffer-deallocation-pipeline or OwnershipBasedBufferDeallocationPass to dealloc it, do i understand correctly? thanks

Correct, I suggest using: https://github.com/llvm/llvm-project/blob/58bdd165d505f3993d15442afd2286c4deedcba2/mlir/include/mlir/Dialect/Bufferization/Pipelines/Passes.h#L40

Hi chenlini
clear now, thanks for your patient guide.