This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Async reference counting for block successors with divergent reference counted liveness
ClosedPublic

Authored by ezhulenev on May 25 2021, 10:45 AM.

Details

Summary

Support reference counted values implicitly passed (live) only to some of the successors.

Example: if branched to ^bb2 token will leak, unless drop_ref operation is properly created

^entry:
  %token = async.runtime.create : !async.token
   cond_br %cond, ^bb1, ^bb2
^bb1:
  async.runtime.await %token
  async.runtime.drop_ref %token
  br ^bb2
^bb2:
  return

Diff Detail

Event Timeline

ezhulenev created this revision.May 25 2021, 10:45 AM
ezhulenev requested review of this revision.May 25 2021, 10:45 AM
rriddle added inline comments.May 25 2021, 10:49 AM
mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
261

nit: SmallPtrSet?

301–308

This is only used once, can you just inline it and stream the args in?

emitOpError() << ".." << value;

346

Don't recompute the end iterator every loop

ezhulenev edited the summary of this revision. (Show Details)May 25 2021, 10:50 AM
ezhulenev added a reviewer: mehdi_amini.
ezhulenev marked 3 inline comments as done.

Address comments

mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
301–308

I removed value printing because in practice it will be too much details, e.g. it can print all the async region there

346

replaced with llvm::enumerate

mehdi_amini accepted this revision.May 26 2021, 8:47 PM
This revision is now accepted and ready to land.May 26 2021, 8:47 PM