public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/cachelib] f44: Fix the folly F14 fallback for libstdc++ 16, which broke ppc64le
@ 2026-09-18 20:43 Michel Lind
  0 siblings, 0 replies; only message in thread
From: Michel Lind @ 2026-09-18 20:43 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/cachelib
            Branch : f44
            Commit : 5c8ce4fd584b876587e1c520d1588de3475d2178
            Author : Michel Lind <salimma@fedoraproject.org>
            Date   : 2026-09-18T19:16:39+01:00
            Stats  : +121/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/cachelib/c/5c8ce4fd584b876587e1c520d1588de3475d2178?branch=f44

            Log:
            Fix the folly F14 fallback for libstdc++ 16, which broke ppc64le

The first koji build failed on ppc64le only (task 150370573): folly's
F14 containers fall back to a std::unordered_set/map wrapper where there
are no SSE2/NEON intrinsics, and that wrapper's `using Super::find;`,
count and equal_range collide with libstdc++ 16's own C++20
heterogeneous lookup overloads (enabled by folly's transparent hashers),
so every heterogeneous find is ambiguous:

  folly/container/EvictingCacheMap.h:765:26: error: call of overloaded
  'find(const long unsigned int&)' is ambiguous

Carry the fix as Patch7: the fallback forwards exact-key overloads
instead of using-declarations, which hides the base templates, as
F14MapFallback already did for find, count and contains. Reproduced
and verified on aarch64 with -DFOLLY_F14_FORCE_FALLBACK=1 under GCC
16.2.1 (four ambiguity errors before, none after, in both modes); the
fix is on the folly fork as 4193514eb for internal submission.

Assisted-by: Claude Code:claude-fable-5-1
Signed-off-by: Michel Lind <salimma@fedoraproject.org>

---
diff --git a/0008-folly-F14-fallback-forward-exact-key-lookups.patch b/0008-folly-F14-fallback-forward-exact-key-lookups.patch
new file mode 100644
index 0000000..850a7b1
--- /dev/null
+++ b/0008-folly-F14-fallback-forward-exact-key-lookups.patch
@@ -0,0 +1,117 @@
+From 4193514ebc75c8d36a606505b18e266a9643fc28 Mon Sep 17 00:00:00 2001
+From: Michel Lind <salimma@fedoraproject.org>
+Date: Fri, 18 Sep 2026 19:14:04 +0100
+Subject: [PATCH] F14 fallback: forward exact-key lookups instead of
+ using-declarations
+
+F14SetFallback and F14MapFallback derive from std::unordered_set/map and
+add heterogeneous find/count/contains/equal_range templates next to
+`using Super::find;` and friends. Since C++20 (P0919R3, P1690R1) the
+standard containers have heterogeneous overloads of the same shape,
+enabled whenever the hasher and key_equal are transparent, which
+folly's defaults are. With libstdc++ from GCC 16 the using-declaration
+then brings in a second viable template and every heterogeneous lookup
+is ambiguous:
+
+  folly/container/EvictingCacheMap.h:765:26: error: call of overloaded
+  'find(const long unsigned int&)' is ambiguous
+    candidate 1: std::unordered_set<...>::find(const _Kt&) const
+      /usr/include/c++/16/bits/unordered_set.h:790:9
+    candidate 2: folly::f14::detail::F14BasicSet<...>::find(K const&) const
+      folly/container/detail/F14SetFallback.h:266:46
+  folly/container/detail/F14SetFallback.h:274:16: error: call of
+  overloaded 'find(const std::basic_string_view<char>&)' is ambiguous
+    (from Immutables.cpp:40 globalFrozenSettingProjects().rlock()->contains(project))
+
+Only the fallback is affected, i.e. targets without SSE2 or NEON such as
+ppc64le, which is where the Fedora build of CacheLib failed:
+https://koji.fedoraproject.org/koji/taskinfo?taskID=150370573
+(folly at d8d3f3f6, gcc-16.2.1-2.fc46, libstdc++ 16, -std=gnu++20).
+
+Replace the using-declarations with exact-key_type overloads that
+forward to Super, which hide the base class's templates. F14MapFallback
+already did this for find, count and contains and only had equal_range
+via using-declaration; F14SetFallback had all of count, find and
+equal_range via using-declarations. contains was already forwarded in
+both, which is why it never appeared in the errors on its own.
+
+Verified with GCC 16.2.1 on aarch64 by forcing the fallback:
+
+  g++ -std=gnu++20 -fsyntax-only -DFOLLY_F14_FORCE_FALLBACK=1 t.cpp
+
+where t.cpp exercises heterogeneous find/contains/equal_range on
+F14FastSet<std::string> and F14FastMap<std::string, int> with a
+string_view key, the exact-key overloads on const and non-const
+containers, and the F14HashToken find path. Before: 4 ambiguity errors
+(and the same failure inside F14SetFallback.h's contains). After: none,
+with or without the forced fallback.
+
+Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
+Signed-off-by: Michel Lind <salimma@fedoraproject.org>
+---
+ folly/container/detail/F14MapFallback.h |  9 ++++++++-
+ folly/container/detail/F14SetFallback.h | 15 ++++++++++++---
+ 2 files changed, 20 insertions(+), 4 deletions(-)
+
+diff --git a/vendor/folly/folly/container/detail/F14MapFallback.h b/vendor/folly/folly/container/detail/F14MapFallback.h
+index b6fcaec99..9513954e9 100644
+--- a/vendor/folly/folly/container/detail/F14MapFallback.h
++++ b/vendor/folly/folly/container/detail/F14MapFallback.h
+@@ -427,7 +427,14 @@ class F14BasicMap : public std::unordered_map<K, M, H, E, A> {
+   }
+ 
+  public:
+-  using Super::equal_range;
++  std::pair<iterator, iterator> equal_range(key_type const& key) {
++    return Super::equal_range(key);
++  }
++
++  std::pair<const_iterator, const_iterator> equal_range(
++      key_type const& key) const {
++    return Super::equal_range(key);
++  }
+ 
+   template <typename K2>
+   EnableHeterogeneousFind<K2, std::pair<iterator, iterator>> equal_range(
+diff --git a/vendor/folly/folly/container/detail/F14SetFallback.h b/vendor/folly/folly/container/detail/F14SetFallback.h
+index 623f6a60a..33b711b04 100644
+--- a/vendor/folly/folly/container/detail/F14SetFallback.h
++++ b/vendor/folly/folly/container/detail/F14SetFallback.h
+@@ -248,14 +248,16 @@ class F14BasicSet
+   }
+ 
+  public:
+-  using Super::count;
++  size_type count(key_type const& key) const { return Super::count(key); }
+ 
+   template <typename K>
+   EnableHeterogeneousFind<K, size_type> count(K const& key) const {
+     return contains(key) ? 1 : 0;
+   }
+ 
+-  using Super::find;
++  iterator find(key_type const& key) { return Super::find(key); }
++
++  const_iterator find(key_type const& key) const { return Super::find(key); }
+ 
+   template <typename K>
+   EnableHeterogeneousFind<K, iterator> find(K const& key) {
+@@ -286,7 +288,14 @@ class F14BasicSet
+   }
+ 
+  public:
+-  using Super::equal_range;
++  std::pair<iterator, iterator> equal_range(key_type const& key) {
++    return Super::equal_range(key);
++  }
++
++  std::pair<const_iterator, const_iterator> equal_range(
++      key_type const& key) const {
++    return Super::equal_range(key);
++  }
+ 
+   template <typename K>
+   EnableHeterogeneousFind<K, std::pair<iterator, iterator>> equal_range(
+-- 
+2.55.0
+

diff --git a/cachelib.spec b/cachelib.spec
index 5838ea8..a43aef5 100644
--- a/cachelib.spec
+++ b/cachelib.spec
@@ -112,6 +112,10 @@ Patch4:         0005-cmake-give-cachelib_nvmitem-a-SOVERSION.patch
 Patch5:         0006-fbthrift-keep-thrift-data-out-of-a-writable-rodata-section.patch
 # --shared-lib dropped $LDFLAGS from the shared library links; facebook/CacheLib#499
 Patch6:         0007-getdeps-keep-LDFLAGS-on-the-shared-library-links.patch
+# folly's F14 fallback (no SSE2/NEON: ppc64le) is ambiguous against
+# libstdc++ 16's own heterogeneous lookup; fix on Michel's fork, submitted
+# internally
+Patch7:         0008-folly-F14-fallback-forward-exact-key-lookups.patch
 
 ExclusiveArch:  x86_64 aarch64 ppc64le
 # -devel (last shipped as 17^20250203 in Fedora, 16^20230424 in EPEL 9) is gone:

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-18 20:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 20:43 [rpms/cachelib] f44: Fix the folly F14 fallback for libstdc++ 16, which broke ppc64le Michel Lind

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox