[Mlir-commits] [mlir] [mlir] DistinctAttributeAllocator: fix race (PR #132935)
Mehdi Amini
llvmlistbot at llvm.org
Tue Mar 25 09:26:58 PDT 2025
joker-eph wrote:
I suspect there is a more fundamental problem here.
If `PassManager::runWithCrashRecovery()` is executed for multiple threads you can have the following sequence:
```
ctx->disableThreadLocalStorage(); // T1
ctx->disableThreadLocalStorage(); // T2
ctx->enableThreadLocalStorage(); // T1
```
At this point T2 can execute while the thread local storage it enabled again.
If we need to lock, I suspect the scope has to be for the entire duration of `PassManager::runWithCrashRecovery()` ; or use a semaphore mechanism (increment an atomic integer instead of using a boolean).
Assuming I am correct with this, I would instead revert the original PR.
https://github.com/llvm/llvm-project/pull/132935
More information about the Mlir-commits
mailing list