[all-commits] [llvm/llvm-project] a86a9b: [mlir] Automatic reference counting for Async valu...

Eugene Zhulenev via All-commits all-commits at lists.llvm.org
Fri Nov 20 03:09:05 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a86a9b5ef777552d1683e2b9031e2045d39de2f0
      https://github.com/llvm/llvm-project/commit/a86a9b5ef777552d1683e2b9031e2045d39de2f0
  Author: Eugene Zhulenev <ezhulenev at google.com>
  Date:   2020-11-20 (Fri, 20 Nov 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/Async/IR/Async.h
    M mlir/include/mlir/Dialect/Async/IR/AsyncBase.td
    M mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
    M mlir/include/mlir/Dialect/Async/Passes.h
    M mlir/include/mlir/Dialect/Async/Passes.td
    M mlir/include/mlir/ExecutionEngine/AsyncRuntime.h
    M mlir/integration_test/Dialect/Async/CPU/test-async-parallel-for-1d.mlir
    M mlir/integration_test/Dialect/Async/CPU/test-async-parallel-for-2d.mlir
    M mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
    A mlir/lib/Dialect/Async/Transforms/AsyncRefCounting.cpp
    A mlir/lib/Dialect/Async/Transforms/AsyncRefCountingOptimization.cpp
    M mlir/lib/Dialect/Async/Transforms/CMakeLists.txt
    M mlir/lib/ExecutionEngine/AsyncRuntime.cpp
    M mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
    A mlir/test/Dialect/Async/async-ref-counting-optimization.mlir
    A mlir/test/Dialect/Async/async-ref-counting.mlir
    M mlir/test/Dialect/Async/ops.mlir
    M mlir/test/mlir-cpu-runner/async-group.mlir
    M mlir/test/mlir-cpu-runner/async.mlir

  Log Message:
  -----------
  [mlir] Automatic reference counting for Async values + runtime support for ref counted objects

Depends On D89963

**Automatic reference counting algorithm outline:**

1. `ReturnLike` operations forward the reference counted values without
    modifying the reference count.
2. Use liveness analysis to find blocks in the CFG where the lifetime of
   reference counted values ends, and insert `drop_ref` operations after
   the last use of the value.
3. Insert `add_ref` before the `async.execute` operation capturing the
   value, and pairing `drop_ref` before the async body region terminator,
   to release the captured reference counted value when execution
   completes.
4. If the reference counted value is passed only to some of the block
   successors, insert `drop_ref` operations in the beginning of the blocks
   that do not have reference coutned value uses.

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D90716




More information about the All-commits mailing list