[Mlir-commits] [mlir] [mlir] DistinctAttributeAllocator: fix race (PR #132935)
Emilio Cota
llvmlistbot at llvm.org
Tue Mar 25 07:28:32 PDT 2025
cota wrote:
> Would introducing a lock in disableThreadLocalStorage avoid the problem as well?
That lock would protect `useThreadLocalAllocator` and we'd have to acquire the lock on all the other accesses to it. It's easier to reuse the existing lock.
> When reviewing I was under the impression that we can check this flags safely since they are only set in single-thread code
`DistinctAttributeAllocator` is a member of `MLIRContext` and therefore can be accessed by different threads when threading is enabled. We should either (1) have the bitfields in DistinctAttributeAllocator as immutable members, therefore being read-only and thus requiring no atomics, or (2) properly deal with multi-threaded accesses if we don't want the bitfields to be immutable. I think @abulavin should make the call since they have all the context.
https://github.com/llvm/llvm-project/pull/132935
More information about the Mlir-commits
mailing list