summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
AgeCommit message (Collapse)Author
2025-08-19[mlir] Replace SmallSet with SmallPtrSet (NFC) (#154265)Kazu Hirata
This patch replaces SmallSet<T *, N> with SmallPtrSet<T *, N>. Note that SmallSet.h "redirects" SmallSet to SmallPtrSet for pointer element types: template <typename PointeeType, unsigned N> class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {}; We only have 30 instances that rely on this "redirection". Since the redirection doesn't improve readability, this patch replaces SmallSet with SmallPtrSet for pointer element types. I'm planning to remove the redirection eventually.
2025-07-24[mlir][NFC] update `mlir/Dialect` create APIs (15/n) (#149921)Maksim Levental
See https://github.com/llvm/llvm-project/pull/147168 for more info.
2025-07-13[mlir] Remove unused includes (NFC) (#148535)Kazu Hirata
2025-05-13[NFC] Use more isa and isa_and_nonnull instead dyn_cast for predicates (#137393)Max Graey
Also fix some typos in comments --------- Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
2025-04-28[MLIR][NFC] Retire let constructor for Async (#137461)lorenzo chelini
let constructor is legacy (do not use in tree!) since the tableGen backend emits most of the glue logic to build a pass. Note: The following constructor has been retired: ```cpp std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch, int32_t numWorkerThreads, int32_t minTaskSize); ``` To update your codebase, replace it with the new options-based API: ```cpp AsyncParallelForPassOptions options{/*asyncDispatch=*/, /*numWorkerThreads=*/, /*minTaskSize=*/}; createAsyncParallelForPass(options); ```
2023-08-30fix unused variable warnings in conditionalsMikhail Goncharov
warning was updated in 92023b15099012a657da07ebf49dd7d94a260f84
2023-05-12[mlir] Move casting calls from methods to function callsTres Popp
The MLIR classes Type/Attribute/Operation/Op/Value support cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast functionality in addition to defining methods with the same name. This change begins the migration of uses of the method to the corresponding function call as has been decided as more consistent. Note that there still exist classes that only define methods directly, such as AffineExpr, and this does not include work currently to support a functional cast/isa call. Caveats include: - This clang-tidy script probably has more problems. - This only touches C++ code, so nothing that is being generated. Context: - https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…" - Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443 Implementation: This first patch was created with the following steps. The intention is to only do automated changes at first, so I waste less time if it's reverted, and so the first mass change is more clear as an example to other teams that will need to follow similar steps. Steps are described per line, as comments are removed by git: 0. Retrieve the change from the following to build clang-tidy with an additional check: https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check 1. Build clang-tidy 2. Run clang-tidy over your entire codebase while disabling all checks and enabling the one relevant one. Run on all header files also. 3. Delete .inc files that were also modified, so the next build rebuilds them to a pure state. 4. Some changes have been deleted for the following reasons: - Some files had a variable also named cast - Some files had not included a header file that defines the cast functions - Some files are definitions of the classes that have the casting methods, so the code still refers to the method instead of the function without adding a prefix or removing the method declaration at the same time. ``` ninja -C $BUILD_DIR clang-tidy run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\ -header-filter=mlir/ mlir/* -fix rm -rf $BUILD_DIR/tools/mlir/**/*.inc git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\ mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\ mlir/lib/**/IR/\ mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\ mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\ mlir/test/lib/Dialect/Test/TestTypes.cpp\ mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\ mlir/test/lib/Dialect/Test/TestAttributes.cpp\ mlir/unittests/TableGen/EnumsGenTest.cpp\ mlir/test/python/lib/PythonTestCAPI.cpp\ mlir/include/mlir/IR/ ``` Differential Revision: https://reviews.llvm.org/D150123
2022-08-31[MLIR] Update pass declarations to new autogenerated filesMichele Scuttari
The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow dropping the old infrastructure. Reviewed By: mehdi_amini, rriddle Differential Review: https://reviews.llvm.org/D132838
2022-08-30Revert "[MLIR] Update pass declarations to new autogenerated files"Michele Scuttari
This reverts commit 2be8af8f0e0780901213b6fd3013a5268ddc3359.
2022-08-30[MLIR] Update pass declarations to new autogenerated filesMichele Scuttari
The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow dropping the old infrastructure. Reviewed By: mehdi_amini, rriddle Differential Review: https://reviews.llvm.org/D132838
2022-06-20[mlir] Don't use Optional::getValue (NFC)Kazu Hirata
2022-03-01[mlir] Rename the Standard dialect to the Func dialectRiver Riddle
The last remaining operations in the standard dialect all revolve around FuncOp/function related constructs. This patch simply handles the initial renaming (which by itself is already huge), but there are a large number of cleanups unlocked/necessary afterwards: * Removing a bunch of unnecessary dependencies on Func * Cleaning up the From/ToStandard conversion passes * Preparing for the move of FuncOp to the Func dialect See the discussion at https://discourse.llvm.org/t/standard-dialect-the-final-chapter/6061 Differential Revision: https://reviews.llvm.org/D120624
2022-02-06[mlir] Split out a new ControlFlow dialect from StandardRiver Riddle
This dialect is intended to model lower level/branch based control-flow constructs. The initial set of operations are: AssertOp, BranchOp, CondBranchOp, SwitchOp; all split out from the current standard dialect. See https://discourse.llvm.org/t/standard-dialect-the-final-chapter/6061 Differential Revision: https://reviews.llvm.org/D118966
2022-01-02Apply clang-tidy fixes for performance-for-range-copy to MLIR (NFC)Mehdi Amini
Differential Revision: https://reviews.llvm.org/D116248
2021-09-27[mlir] AsyncRuntime: use int64_t for ref counting operationsEugene Zhulenev
Workaround for SystemZ ABI problem: https://bugs.llvm.org/show_bug.cgi?id=51898 Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D110550
2021-09-04[mlir] Async: check awaited operand error state after sync awaitEugene Zhulenev
Previously only await inside the async function (coroutine after lowering to async runtime) would check the error state Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D109229
2021-06-29[mlir:Async] Add an async reference counting pass based on the user defined ↵Eugene Zhulenev
policy Depends On D104999 Automatic reference counting based on the liveness analysis can add a lot of reference counting overhead at runtime. If the IR is known to be constrained to few particular "shapes", it's much more efficient to provide a custom reference counting policy that will specify where it is required to update the async value reference count. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D105037
2021-05-27[mlir] AsyncRefCounting: check that LivenessBlockInfo is not nullptrEugene Zhulenev
Differential Revision: https://reviews.llvm.org/D103270
2021-05-27[mlir] Async reference counting for block successors with divergent ↵Eugene Zhulenev
reference counted liveness 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 ``` Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D103102
2021-04-13[mlir] Convert async dialect passes from function passes to op agnostic passesEugene Zhulenev
Differential Revision: https://reviews.llvm.org/D100401
2021-04-12[mlir] Async: add automatic reference counting at async.runtime operations levelEugene Zhulenev
Depends On D95311 Previous automatic-ref-counting pass worked with high level async operations (e.g. async.execute), however async values reference counting is a runtime implementation detail. New pass mostly relies on the save liveness analysis to place drop_ref operations, and does better verification of CFG with different liveIn sets in block successors. This is almost NFC change. No new reference counting ideas, just a cleanup of the previous version. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D95390