[Mlir-commits] [mlir] [mlir] Optimize ThreadLocalCache by removing atomic bottleneck (attempt #3) (PR #93315)

Jeff Niu llvmlistbot at llvm.org
Thu May 30 19:17:02 PDT 2024


================
@@ -25,28 +25,80 @@ namespace mlir {
 /// cache has very large lock contention.
 template <typename ValueT>
 class ThreadLocalCache {
+  struct PerInstanceState;
+
+  /// The "observer" is owned by a thread-local cache instance. It is
+  /// constructed the first time a `ThreadLocalCache` instance is accessed by a
+  /// thread, unless `perInstanceState` happens to get re-allocated to the same
+  /// address as a previous one. This class is destructed the thread in which
+  /// the `thread_local` cache lives is destroyed.
----------------
Mogball wrote:

Yep. Thanks!

https://github.com/llvm/llvm-project/pull/93315


More information about the Mlir-commits mailing list