[Mlir-commits] [mlir] [MLIR:Python] Fix race on PyOperations. (PR #139721)
Maksim Levental
llvmlistbot at llvm.org
Wed May 14 08:40:41 PDT 2025
================
@@ -725,19 +733,27 @@ class PyOperation : public PyOperationBase, public BaseContextObject {
/// parent context's live operations map, and sets the valid bit false.
void erase();
- /// Invalidate the operation.
- void setInvalid() { valid = false; }
-
/// Clones this operation.
nanobind::object clone(const nanobind::object &ip);
+ /// Invalidate the operation.
+ void setInvalid() {
+ nanobind::ft_lock_guard lock(getContext()->liveOperationsMutex);
+ setInvalidLocked();
+ }
+ /// Like setInvalid(), but requires the liveOperations mutex to be held.
+ void setInvalidLocked() { valid = false; }
----------------
makslevental wrote:
whoops should've read everything first - guess you already did rename things. cool
https://github.com/llvm/llvm-project/pull/139721
More information about the Mlir-commits
mailing list