Skip to content

Some fixes in folly itself and small_vector in particular - #17

Closed
asl wants to merge 5 commits into
meta:masterfrom
asl:master
Closed

asl wants to merge 5 commits into
meta:masterfrom
asl:master

Conversation

@asl

@asl asl commented Oct 13, 2012

Copy link
Copy Markdown
Contributor

This is first patchset which fixes some portability issues (gets rid of some gcc-isms) and also fixes some bugs in small_vector. More to follow :)

@tudor

tudor commented Oct 15, 2012

Copy link
Copy Markdown
Contributor

@asl Before we can accept your changes, you'll have to sign the Facebook Contributor License Agreement: https://developers.facebook.com/opensource/cla

Thanks!
-Tudor.

@asl

asl commented Oct 15, 2012

Copy link
Copy Markdown
Contributor Author

Done

@jdelong

jdelong commented Dec 16, 2012

Copy link
Copy Markdown
Contributor

Sorry for the delay asl. I'm merging these into our local repo now (a couple of them have been fixed already). They'll be back out in the next public push.

Thanks!

@jdelong jdelong closed this Dec 16, 2012
@tian-yuan tian-yuan mentioned this pull request Jul 23, 2016
@tdauth tdauth mentioned this pull request Mar 3, 2017
facebook-github-bot pushed a commit that referenced this pull request Jun 1, 2017
Summary:
Test output before the fix is applied:
```
folly/experimental/Bits.h:247:59: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
     #0 folly/experimental/Bits.h:247 folly::Bits<...>::set(int*, unsigned long, unsigned long, int)
     #1 folly/experimental/test/BitsTest.cpp:228 std::enable_if<...>::type (anonymous namespace)::testSet<...>(unsigned char*, unsigned long, unsigned long, int)
     #2 folly/experimental/test/BitsTest.cpp:263 Bits_Boundaries_Test::TestBody()
    #17 folly/experimental/test/BitsTest.cpp:381 main
```

Reviewed By: philippv

Differential Revision: D5160789

fbshipit-source-id: 43f1926d58f1a5c019d4f8794d10a7a80a5c4749
facebook-github-bot pushed a commit that referenced this pull request Oct 17, 2018
fbshipit-source-id: 0e4317ea86a60c50408cf415972bd048596ac0b2
sandraiser pushed a commit to sandraiser/folly that referenced this pull request Mar 4, 2019
fbshipit-source-id: 0e4317ea86a60c50408cf415972bd048596ac0b2
facebook-github-bot pushed a commit that referenced this pull request Dec 18, 2019
Summary:
Exposed by UBSAN's unsigned-integer-overflow:
```
> folly/experimental/observer/detail/Core.cpp:179:9: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
>     #0 0x7f605837dfea in folly::observer_detail::Core::removeStaleDependents()::$_4::operator()(std::vector<std::weak_ptr<folly::observer_detail::Core>, std::allocator<std::weak_ptr<folly::observer_detail::Core> > >&) const folly/experimental/observer/detail/Core.cpp:179
>     #1 0x7f6058344b0c in auto folly::SynchronizedBase<folly::Synchronized<std::vector<std::weak_ptr<folly::observer_detail::Core>, std::allocator<std::weak_ptr<folly::observer_detail::Core> > >, folly::SharedMutexImpl<false, void, std::atomic, false, false> >, (folly::detail::MutexLevel)1>::withWLock<folly::observer_detail::Core::removeStaleDependents()::$_4>(folly::observer_detail::Core::removeStaleDependents()::$_4&&) folly/Synchronized.h:210
>     #2 0x7f6058344917 in folly::observer_detail::Core::removeStaleDependents() folly/experimental/observer/detail/Core.cpp:174
>     #3 0x7f60583785cb in folly::observer_detail::Core::~Core()::$_2::operator()(std::unordered_set<std::shared_ptr<folly::observer_detail::Core>, std::hash<std::shared_ptr<folly::observer_detail::Core> >, std::equal_to<std::shared_ptr<folly::observer_detail::Core> >, std::allocator<std::shared_ptr<folly::observer_detail::Core> > > const&) const folly/experimental/observer/detail/Core.cpp:156
>     #4 0x7f6058343cdc in auto folly::SynchronizedBase<folly::Synchronized<std::unordered_set<std::shared_ptr<folly::observer_detail::Core>, std::hash<std::shared_ptr<folly::observer_detail::Core> >, std::equal_to<std::shared_ptr<folly::observer_detail::Core> >, std::allocator<std::shared_ptr<folly::observer_detail::Core> > >, folly::SharedMutexImpl<false, void, std::atomic, false, false> >, (folly::detail::MutexLevel)1>::withWLock<folly::observer_detail::Core::~Core()::$_2>(folly::ob
server_detail::Core::~Core()::$_2&&) folly/Synchronized.h:210
>     #5 0x7f6058343a17 in folly::observer_detail::Core::~Core() folly/experimental/observer/detail/Core.cpp:154
>     #6 0x7f605838b8ca in std::_Sp_counted_ptr<folly::observer_detail::Core*, (__gnu_cxx::_Lock_policy)2>::_M_dispose() buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/bits/shared_ptr_base.h:378
>     #7 0x7f605834d411 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/bits/shared_ptr_base.h:156
>     #8 0x7f605834d332 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/bits/shared_ptr_base.h:686
>     #9 0x7f605834d23a in std::__shared_ptr<folly::observer_detail::Core, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/bits/shared_ptr_base.h:1125
>     #10 0x7f605833c416 in std::shared_ptr<folly::observer_detail::Core>::~shared_ptr() buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/bits/shared_ptr.h:93
>     #11 0x7f6058376413 in folly::observer_detail::ObserverManager::scheduleRefresh(std::shared_ptr<folly::observer_detail::Core>, unsigned long)::'lambda'()::~() folly/experimental/observer/detail/ObserverManager.h:91
>     #12 0x7f6058377014 in unsigned long folly::detail::function::execSmall<folly::observer_detail::ObserverManager::scheduleRefresh(std::shared_ptr<folly::observer_detail::Core>, unsigned long)::'lambda'()>(folly::detail::function::Op, folly::detail::function::Data*, folly::detail::function::Data*) folly/Function.h:592
>     #13 0x7f6058377788 in folly::Function<void ()>::exec(folly::detail::function::Op, folly::detail::function::Data*, folly::detail::function::Data*) const folly/Function.h:649
>     #14 0x7f6058376380 in folly::Function<void ()>::~Function() folly/Function.h:781
>     #15 0x7f6058477b99 in folly::observer_detail::ObserverManager::UpdatesManager::CurrentQueue::CurrentQueue()::'lambda'()::operator()() const folly/experimental/observer/detail/ObserverManager.cpp:73
>     #16 0x7f6058473de8 in void std::__invoke_impl<void, folly::observer_detail::ObserverManager::UpdatesManager::CurrentQueue::CurrentQueue()::'lambda'()>(std::__invoke_other, folly::observer_detail::ObserverManager::UpdatesManager::CurrentQueue::CurrentQueue()::'lambda'()&&) buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/bits/invoke.h:60
>     #17 0x7f6058473c08 in std::__invoke_result<folly::observer_detail::ObserverManager::UpdatesManager::CurrentQueue::CurrentQueue()::'lambda'()>::type std::__invoke<folly::observer_detail::ObserverManager::UpdatesManager::CurrentQueue::CurrentQueue()::'lambda'()>(folly::observer_detail::ObserverManager::UpdatesManager::CurrentQueue::CurrentQueue()::'lambda'()&&) buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/bits/invok
e.h:95
>     #18 0x7f6058473b66 in decltype(std::__invoke(_S_declval<0ul>())) std::thread::_Invoker<std::tuple<folly::observer_detail::ObserverManager::UpdatesManager::CurrentQueue::CurrentQueue()::'lambda'()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/thread:234
>     #19 0x7f6058473a43 in std::thread::_Invoker<std::tuple<folly::observer_detail::ObserverManager::UpdatesManager::CurrentQueue::CurrentQueue()::'lambda'()> >::operator()() buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/thread:243
>     #20 0x7f6058473549 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<folly::observer_detail::ObserverManager::UpdatesManager::CurrentQueue::CurrentQueue()::'lambda'()> > >::_M_run() buck-out/cells/fbsource/gen/third-party/gcc/7.x/stdc++-headers#header-mode-symlink-tree-with-header-map,headers/thread:186
>     #21 0x7f60576bac5f in std::execute_native_thread_routine(void*) third-party/gcc/7.x/libstdc++-v3/src/c++11/thread.cc:83
>     #22 0x7f605639e6b5 in start_thread /home/engshare/third-party2/glibc/2.26/src/glibc-2.26/nptl/pthread_create.c:465:7
>     #23 0x7f6055ecdebe in __GI___clone /home/engshare/third-party2/glibc/2.26/src/glibc-2.26/sysdeps/unix/sysv/linux/x86_64/clone.S:95
>
> SUMMARY: UndefinedBehaviorSanitizer: unsigned-integer-overflow folly/experimental/observer/detail/Core.cpp:179:9
```

Fix the error by rearranging increment and decrement operations.

Reviewed By: leikahing

Differential Revision: D19164999

fbshipit-source-id: d3c9b638492d0bf44c2acaac1e95fafe8b785182
@zhngs zhngs mentioned this pull request Nov 21, 2022
facebook-github-bot pushed a commit that referenced this pull request Mar 8, 2023
Summary:
AsyncUDPSocket test cases are crashing when running under llvm15. During
debugging it seems that the issue is the fact that the code tries to allocated 0
size array. Changing the code to prevent such allocation.

This is not very clean why to fix, but I am not sure if there is better one.
Please let me know if you have any suggestions.

Sample crash:
```
$ buck test //folly/io/async/test:async_udp_socket_test
...
stdout:
Note: Google Test filter = AsyncUDPSocketTest.TestDetachAttach
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from AsyncUDPSocketTest
[ RUN      ] AsyncUDPSocketTest.TestDetachAttach

stderr:
fbcode/folly/io/async/AsyncUDPSocket.cpp:699:10: runtime error: variable length array bound evaluates to non-positive value 0
    #0 0x7f4d8ed93704 in folly::AsyncUDPSocket::writev(folly::SocketAddress const&, iovec const*, unsigned long, int) fbcode/folly/io/async/AsyncUDPSocket.cpp:698
    #1 0x7f4d8ed9081f in folly::AsyncUDPSocket::writeGSO(folly::SocketAddress const&, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>> const&, int) fbcode/folly/io/async/AsyncUDPSocket.cpp:528
    #2 0x7f4d8ed900b2 in folly::AsyncUDPSocket::write(folly::SocketAddress const&, std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf>> const&) fbcode/folly/io/async/AsyncUDPSocket.cpp:660
    #3 0x350a05 in AsyncUDPSocketTest_TestDetachAttach_Test::TestBody() fbcode/folly/io/async/test/AsyncUDPSocketTest.cpp:914
    #4 0x7f4d90dd1ad5 in testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2682:50
    #5 0x7f4d90dd1ad5 in testing::Test::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2672:6
    #6 0x7f4d90dd1c64 in testing::TestInfo::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2861:14
    #7 0x7f4d90dd1c64 in testing::TestInfo::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2833:6
    #8 0x7f4d90dd2321 in testing::TestSuite::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:3015:31
    #9 0x7f4d90dd2321 in testing::TestSuite::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2993:6
    #10 0x7f4d90dd2b1e in testing::internal::UnitTestImpl::RunAllTests() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:5855:47
    #11 0x7f4d90dd1d87 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:2665:29
    #12 0x7f4d90dd1d87 in testing::UnitTest::Run() /home/engshare/third-party2/googletest/1.11.0/src/googletest/googletest/src/gtest.cc:5438:55
    #13 0x7f4d90d5c990 in RUN_ALL_TESTS() fbcode/third-party-buck/platform010/build/googletest/include/gtest/gtest.h:2490
    #14 0x7f4d90d5c618 in main fbcode/common/gtest/LightMain.cpp:20
    #15 0x7f4d8ea2c656 in __libc_start_call_main /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #16 0x7f4d8ea2c717 in __libc_start_main@GLIBC_2.2.5 /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../csu/libc-start.c:409:3
    #17 0x33ea60 in _start /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../sysdeps/x86_64/start.S:116
...
```

Reviewed By: russoue, dmm-fb

Differential Revision: D43858875

fbshipit-source-id: 93749bab17027b6dfc0dbc01b6c183e501a5494c
facebook-github-bot pushed a commit that referenced this pull request Apr 5, 2025
Summary:
SVE variant of tagMatchIter is added, leveraging two features:

1. Only kCapacity (12/14) bytes of data are loaded to be compared, simd register is zero-extended on such load

2. Instead of doing an AND between the resulting mask and kFullMask, a SIMD AND between each byte lane and #17 is performed. This frees-up one general purpose register: kFullMask had to be loaded into a gp register using two instructions, to then perform the AND; now the AND is done using an immediate value.

We've noticed up to a ~5% performance imrpovement in the ManyFind benchmark:

BEFORE:

Find  f14node<NonSSOString, a[128]>[11]                    41.83ns    23.91M
Find   f14val<NonSSOString, a[128]>[11]         100.48%    41.63ns    24.02M
Find   f14vec<NonSSOString, a[128]>[11]         101.78%    41.10ns    24.33M
Find    unord<NonSSOString, a[128]>[11]         102.11%    40.97ns    24.41M
----------------------------------------------------------------------------
Find  f14node<NonSSOString, a[1]>[11]                      41.78ns    23.93M
Find   f14val<NonSSOString, a[1]>[11]           100.21%    41.69ns    23.98M
Find   f14vec<NonSSOString, a[1]>[11]           101.69%    41.09ns    24.34M
Find    unord<NonSSOString, a[1]>[11]           102.26%    40.86ns    24.47M
----------------------------------------------------------------------------
Find  f14node<std::string, a[128]>[11]                     39.63ns    25.23M
Find   f14val<std::string, a[128]>[11]          100.54%    39.42ns    25.37M
Find   f14vec<std::string, a[128]>[11]          101.03%    39.23ns    25.49M
Find    unord<std::string, a[128]>[11]          100.70%    39.35ns    25.41M
----------------------------------------------------------------------------
Find  f14node<std::string, a[1]>[11]                       39.89ns    25.07M
Find   f14val<std::string, a[1]>[11]            101.46%    39.31ns    25.44M
Find   f14vec<std::string, a[1]>[11]            100.56%    39.67ns    25.21M
Find    unord<std::string, a[1]>[11]            100.27%    39.78ns    25.14M
----------------------------------------------------------------------------
Find  f14node<uint64_t, a[128]>[11]                        10.11ns    98.92M
Find   f14val<uint64_t, a[128]>[11]             99.904%    10.12ns    98.82M
Find   f14vec<uint64_t, a[128]>[11]             93.462%    10.82ns    92.45M
Find    unord<uint64_t, a[128]>[11]             43.204%    23.40ns    42.74M
----------------------------------------------------------------------------
Find  f14node<uint64_t, a[1]>[11]                          10.11ns    98.89M
Find   f14val<uint64_t, a[1]>[11]               94.357%    10.72ns    93.31M
Find   f14vec<uint64_t, a[1]>[11]               94.076%    10.75ns    93.03M
Find    unord<uint64_t, a[1]>[11]               43.390%    23.31ns    42.91M
----------------------------------------------------------------------------
ManyFind  f14node<NonSSOString, a[128]>[11]                43.70ns    22.88M
ManyFind   f14val<NonSSOString, a[128]>[11]     98.075%    44.56ns    22.44M
ManyFind   f14vec<NonSSOString, a[128]>[11]     99.941%    43.73ns    22.87M
ManyFind    unord<NonSSOString, a[128]>[11]     108.98%    40.10ns    24.94M
----------------------------------------------------------------------------
ManyFind  f14node<NonSSOString, a[1]>[11]                  43.51ns    22.98M
ManyFind   f14val<NonSSOString, a[1]>[11]       98.351%    44.24ns    22.60M
ManyFind   f14vec<NonSSOString, a[1]>[11]       99.190%    43.87ns    22.80M
ManyFind    unord<NonSSOString, a[1]>[11]       109.12%    39.88ns    25.08M
----------------------------------------------------------------------------
ManyFind  f14node<std::string, a[128]>[11]                 36.51ns    27.39M
ManyFind   f14val<std::string, a[128]>[11]      99.165%    36.82ns    27.16M
ManyFind   f14vec<std::string, a[128]>[11]      100.27%    36.41ns    27.46M
ManyFind    unord<std::string, a[128]>[11]      121.70%    30.00ns    33.33M
----------------------------------------------------------------------------
ManyFind  f14node<std::string, a[1]>[11]                   36.24ns    27.60M
ManyFind   f14val<std::string, a[1]>[11]        99.108%    36.56ns    27.35M
ManyFind   f14vec<std::string, a[1]>[11]        101.22%    35.80ns    27.93M
ManyFind    unord<std::string, a[1]>[11]        120.80%    30.00ns    33.34M
----------------------------------------------------------------------------
ManyFind  f14node<uint64_t, a[128]>[11]                    11.16ns    89.64M
ManyFind   f14val<uint64_t, a[128]>[11]         95.927%    11.63ns    85.99M
ManyFind   f14vec<uint64_t, a[128]>[11]         98.809%    11.29ns    88.57M
ManyFind    unord<uint64_t, a[128]>[11]         66.528%    16.77ns    59.63M
----------------------------------------------------------------------------
ManyFind  f14node<uint64_t, a[1]>[11]                      11.18ns    89.41M
ManyFind   f14val<uint64_t, a[1]>[11]           99.205%    11.27ns    88.70M
ManyFind   f14vec<uint64_t, a[1]>[11]           96.841%    11.55ns    86.58M
ManyFind    unord<uint64_t, a[1]>[11]           66.700%    16.77ns    59.63M

AFTER:

Find  f14node<NonSSOString, a[128]>[11]                    39.90ns    25.06M
Find   f14val<NonSSOString, a[128]>[11]         98.019%    40.71ns    24.57M
Find   f14vec<NonSSOString, a[128]>[11]         95.365%    41.84ns    23.90M
Find    unord<NonSSOString, a[128]>[11]         96.622%    41.30ns    24.21M
----------------------------------------------------------------------------
Find  f14node<NonSSOString, a[1]>[11]                      40.32ns    24.80M
Find   f14val<NonSSOString, a[1]>[11]           98.070%    41.12ns    24.32M
Find   f14vec<NonSSOString, a[1]>[11]           97.253%    41.46ns    24.12M
Find    unord<NonSSOString, a[1]>[11]           98.001%    41.15ns    24.30M
----------------------------------------------------------------------------
Find  f14node<std::string, a[128]>[11]                     39.23ns    25.49M
Find   f14val<std::string, a[128]>[11]          100.10%    39.19ns    25.52M
Find   f14vec<std::string, a[128]>[11]          97.790%    40.11ns    24.93M
Find    unord<std::string, a[128]>[11]          98.879%    39.67ns    25.21M
----------------------------------------------------------------------------
Find  f14node<std::string, a[1]>[11]                       38.99ns    25.65M
Find   f14val<std::string, a[1]>[11]            98.800%    39.46ns    25.34M
Find   f14vec<std::string, a[1]>[11]            96.837%    40.26ns    24.84M
Find    unord<std::string, a[1]>[11]            99.041%    39.37ns    25.40M
----------------------------------------------------------------------------
Find  f14node<uint64_t, a[128]>[11]                        10.11ns    98.92M
Find   f14val<uint64_t, a[128]>[11]             98.873%    10.22ns    97.80M
Find   f14vec<uint64_t, a[128]>[11]             93.050%    10.86ns    92.04M
Find    unord<uint64_t, a[128]>[11]             43.622%    23.18ns    43.15M
----------------------------------------------------------------------------
Find  f14node<uint64_t, a[1]>[11]                          10.07ns    99.33M
Find   f14val<uint64_t, a[1]>[11]               99.715%    10.10ns    99.04M
Find   f14vec<uint64_t, a[1]>[11]               94.446%    10.66ns    93.81M
Find    unord<uint64_t, a[1]>[11]               43.210%    23.30ns    42.92M
----------------------------------------------------------------------------
ManyFind  f14node<NonSSOString, a[128]>[11]                42.17ns    23.71M
ManyFind   f14val<NonSSOString, a[128]>[11]     98.697%    42.73ns    23.40M
ManyFind   f14vec<NonSSOString, a[128]>[11]     98.109%    42.99ns    23.26M
ManyFind    unord<NonSSOString, a[128]>[11]     106.93%    39.44ns    25.35M
----------------------------------------------------------------------------
ManyFind  f14node<NonSSOString, a[1]>[11]                  42.52ns    23.52M
ManyFind   f14val<NonSSOString, a[1]>[11]       99.053%    42.93ns    23.30M
ManyFind   f14vec<NonSSOString, a[1]>[11]       98.481%    43.18ns    23.16M
ManyFind    unord<NonSSOString, a[1]>[11]       107.15%    39.68ns    25.20M
----------------------------------------------------------------------------
ManyFind  f14node<std::string, a[128]>[11]                 35.91ns    27.85M
ManyFind   f14val<std::string, a[128]>[11]      97.608%    36.79ns    27.18M
ManyFind   f14vec<std::string, a[128]>[11]      99.751%    36.00ns    27.78M
ManyFind    unord<std::string, a[128]>[11]      119.91%    29.95ns    33.39M
----------------------------------------------------------------------------
ManyFind  f14node<std::string, a[1]>[11]                   35.92ns    27.84M
ManyFind   f14val<std::string, a[1]>[11]        97.626%    36.79ns    27.18M
ManyFind   f14vec<std::string, a[1]>[11]        99.663%    36.04ns    27.75M
ManyFind    unord<std::string, a[1]>[11]        119.35%    30.09ns    33.23M
----------------------------------------------------------------------------
ManyFind  f14node<uint64_t, a[128]>[11]                    11.25ns    88.87M
ManyFind   f14val<uint64_t, a[128]>[11]         99.098%    11.35ns    88.07M
ManyFind   f14vec<uint64_t, a[128]>[11]         99.378%    11.32ns    88.32M
ManyFind    unord<uint64_t, a[128]>[11]         66.179%    17.00ns    58.82M
----------------------------------------------------------------------------
ManyFind  f14node<uint64_t, a[1]>[11]                      11.27ns    88.72M
ManyFind   f14val<uint64_t, a[1]>[11]           100.77%    11.18ns    89.41M
ManyFind   f14vec<uint64_t, a[1]>[11]           100.26%    11.24ns    88.95M
ManyFind    unord<uint64_t, a[1]>[11]           66.820%    16.87ns    59.28M

Reviewed By: Gownta

Differential Revision:
D71911944

Privacy Context Container: L1099314

fbshipit-source-id: 67e7a539d28e054a6572a9f11efa713470f4f1d4
facebook-github-bot pushed a commit that referenced this pull request Apr 25, 2025
…hRttiImpl

Summary:
### Overview

I observed failures like:
```
==33555==ERROR: AddressSanitizer: unknown-crash on address 0x800000010516ecee at pc 0x0001062597f4 bp 0x00016b80d470 sp 0x00016b80cc08
READ of size 155 at 0x800000010516ecee thread T0
    #0 0x0001062597f0  (libclang_rt.asan_osx_dynamic.dylib:arm64+0x157f0)
    #1 0x000104f58508 in std::type_info::before[abi:ne180100](std::type_info const&) const+0x8c (core_tests_binary:arm64+0x10096c508)
    #2 0x000104f58418 in std::__1::type_index::operator<[abi:ne180100](std::__1::type_index const&) const+0xa4 (core_tests_binary:arm64+0x10096c418)
    #3 0x000104f57c00 in void* folly::detail::(anonymous namespace)::StaticSingletonManagerWithRttiImpl::create<folly::detail::StaticSingletonManagerWithRtti::Arg>(folly::detail::StaticSingletonManagerWithRtti::Arg&)+0x148 (core_tests_binary:arm64+0x10096bc00)
    #4 0x000104f58110 in void* folly::detail::StaticSingletonManagerWithRtti::create_<true>(folly::detail::StaticSingletonManagerWithRtti::Arg&)+0xc (core_tests_binary:arm64+0x10096c110)
    #5 0x000104fc0b64 in folly::detail::UniqueInstance::enforce(folly::detail::UniqueInstance::Arg&)+0x30c (core_tests_binary:arm64+0x1009d4b64)
    #6 0x000104793064 in __cxx_global_var_init.286+0x34 (core_tests_binary:arm64+0x1001a7064)
    #7 0x00018fc4ac14  (<unknown module>)
    #8 0x00018fc87014  (<unknown module>)
    #9 0x00018fca6ccc  (<unknown module>)
    #10 0x00018fca3abc  (<unknown module>)
    #11 0x00018fca51fc  (<unknown module>)
    #12 0x00018fc86ae4  (<unknown module>)
    #13 0x00018fc4a9cc  (<unknown module>)
    #14 0x00018fc52358  (<unknown module>)
    #15 0x00018fc4b168  (<unknown module>)
    #16 0x00018fc4f8d8  (<unknown module>)
    #17 0x00018fc4b474  (<unknown module>)
    #18 0x00018fc6c284  (<unknown module>)
    #19 0x00018fc2fda8  (<unknown module>)
    #20 0x00018fc2f180  (<unknown module>)
    #21 0x00018fc2eafc  (<unknown module>)

Address 0x800000010516ecee is a wild pointer inside of access range of size 0x00000000009b.
AddressSanitizer: unknown-crash (core_tests_binary:arm64+0x10096c508) in std::type_info::before[abi:ne180100](std::type_info const&) const+0x8c
==33555==ABORTING
```

Looks like the address sanitizer found a memory issue in the implementation of `std::type_info::before`, when I force it to use the more robust type_info comparison algorithm. I couldn't find any references to known problems around this, internally or externally, and unfortunately that's code we can't easily fix.

Instead of relying on the seemingly problematic implementation of `std::type_info::before`, I'm changing the `std::map` to an `std::unordered_map` which instead relies on equality comparison, which is in turn directly controlled by `_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION`. See discussion in the comments for additional context on this decision.

Reviewed By: yfeldblum

Differential Revision: D73379250

fbshipit-source-id: 257bb77a8b6bb69b364bf4c6edcbdb160c84ca74
meta-codesync Bot pushed a commit that referenced this pull request Feb 24, 2026
Summary:
Asked ARM folks about this approach and they said it should be better, as cmeq will only execute speculatively if the branch is assumed as not-taken

Benchmarks do not show any difference.
The new approach should be faster for matches after iterations where no match was found

For further reference, the instruction sequence before the changes looks like this:

  2c3d74:	ld1b	{z1.b}, p0/z, [x10, x15]

  2c3d78:	match	p1.b, p0/z, z1.b, z0.b

  2c3d7c:	b.eq	2c3db8 <end>  // ret

  2c3d80:	cmeq	v1.16b, v1.16b, v0.16b

  2c3d84:	add	x16, x14, #0x10

  2c3d88:	and	z1.b, z1.b, #0x11

  2c3d8c:	shrn	v1.8b, v1.8h, #4

  2c3d90:	fmov	x15, d1

Whereas now it looks like this:

  2c4d10:	ld1b	{z1.b}, p0/z, [x10, x14]

  2c4d14:	match	p1.b, p0/z, z1.b, z0.b

  2c4d18:	b.eq	2c4d50 <end>  // ret

  2c4d1c:	mov	z1.b, p1/z, #17

  2c4d20:	add	x14, x13, #0x10

  2c4d24:	shrn	v1.8b, v1.8h, #4

  2c4d28:	fmov	x15, d1

Reviewed By: yfeldblum

Differential Revision: D94030833

fbshipit-source-id: 55c486e1c9bd05cb52d5e206cbd60034cbeff40d
bolunfeng pushed a commit to bolunfeng/folly that referenced this pull request May 22, 2026
Summary:
Asked ARM folks about this approach and they said it should be better, as cmeq will only execute speculatively if the branch is assumed as not-taken

Benchmarks do not show any difference.
The new approach should be faster for matches after iterations where no match was found

For further reference, the instruction sequence before the changes looks like this:

  2c3d74:	ld1b	{z1.b}, p0/z, [x10, x15]

  2c3d78:	match	p1.b, p0/z, z1.b, z0.b

  2c3d7c:	b.eq	2c3db8 <end>  // ret

  2c3d80:	cmeq	v1.16b, v1.16b, v0.16b

  2c3d84:	add	x16, x14, #0x10

  2c3d88:	and	z1.b, z1.b, #0x11

  2c3d8c:	shrn	v1.8b, v1.8h, meta#4

  2c3d90:	fmov	x15, d1

Whereas now it looks like this:

  2c4d10:	ld1b	{z1.b}, p0/z, [x10, x14]

  2c4d14:	match	p1.b, p0/z, z1.b, z0.b

  2c4d18:	b.eq	2c4d50 <end>  // ret

  2c4d1c:	mov	z1.b, p1/z, meta#17

  2c4d20:	add	x14, x13, #0x10

  2c4d24:	shrn	v1.8b, v1.8h, meta#4

  2c4d28:	fmov	x15, d1

Reviewed By: yfeldblum

Differential Revision: D94030833

fbshipit-source-id: 55c486e1c9bd05cb52d5e206cbd60034cbeff40d
meta-codesync Bot pushed a commit that referenced this pull request Aug 27, 2026
Summary:
On by default wherever `svmatch` is available.

`F14Chunk::tagMatchIter` computes the match as an SVE predicate via `svmatch_u8`
and then throws it away, rebuilding the same 4-bit-spaced mask the plain-NEON
path uses so it can hand back a `SparseMaskIter`. On Neoverse V2 the generated
hot path is:

```
match  p1.b, p0/z, z1.b, z0.b     // sets NZCV itself
b.eq   <no-match>                 // svptest_any is free, folds into MATCH flags
mov    z1.b, p1/z, #17            -.
shrn   v1.8b, v1.8h, #4            | five instructions purely to rebuild
fmov   x3, d1                      | the index the predicate already held
rbit   x3, x3                      |
clz    x6, x3                     -'
```

`BRKB` sets the active lanes preceding the first match, so `CNTP` of that is the
index directly. That replaces the five-instruction chain with two, and keeps the
free `b.eq` early-out off MATCH's own flags.

After the optimization, hot path becomes:
```
match   p1.b, p0/z, z1.b, z0.b
b.eq   <no-match>
brkb    p2.b, p0/z, p1.b // -> lanes before first match
cntp    x3,   p0,  p2.b // -> first-match index i
```

`svbool_t` is a sizeless type, so it cannot be a class member or travel back
inside a `std::pair` — a predicate-native `SparseMaskIter` is not expressible.
Instead this adds `F14Chunk::forEachTagMatch`, which inverts the loop so the
predicate stays in a register. Everything except the SVE2 build gets a
`FOLLY_ALWAYS_INLINE` wrapper over the existing `tagMatchIter`, so the other
backends are unchanged. `tagMatchIter` had exactly two callers, `findImpl` and
`findMatching`, and both are rewritten to take a callback.

`FOLLY_F14_SVE_PREDICATE_NATIVE_ACTIVE` is `FOLLY_NEON &&
FOLLY_ARM_FEATURE_NEON_SVE_BRIDGE && FOLLY_ARM_FEATURE_SVE2` — exactly the
condition the `svmatch` `tagMatchIter` this replaces already compiles under — so
it turns on automatically wherever that path exists and is inert everywhere
else. `svmatch` is the only SVE2-only intrinsic in the sequence — `BRKB`,
`BRKA`, `CNTP` and predicate `BIC` are all SVE1 — so SVE2 is the correct gate.
There is no build knob: the two configurations where `FOLLY_ARM_FEATURE_SVE2` is
set but the body still cannot compile — an SVE2 target whose toolchain has no
`arm_neon_sve_bridge.h`, and `__CUDACC__`, where `Portability.h` forces
`FOLLY_NEON` to 0 — keep the generic wrapper because the macro tests those two
terms as well.

== Generated code ==

Full annotated probe loop for `F14ValueMap<K, std::array<uint8_t, 1>>` `Find`,
with `findImpl` inlined, `fbcode//mode/opt`, Grace (Neoverse V2). The two
excerpts above are taken from these. The source being compiled is one iteration
of:

```
ChunkPtr chunk = chunks_ + (index & chunkMask);
if (prefetch == Prefetch::ENABLED && Chunk::kChunkStride > 64)
  prefetchAddr(chunk->itemAddr(8));
ItemIter found{};
if (chunk->forEachTagMatch(needleV, [&](unsigned i) {
      if (FOLLY_LIKELY(this->keyMatchesItem(key, chunk->item(i)))) {
        found = ItemIter{chunk, i}; return true;
      }
      return false;
    })) { return found; }
if (FOLLY_LIKELY(chunk->outboundOverflowCount() == 0)) break;
index += step;
```

=== `uint64_t` key ===

Chunk stride 256 B, item 16 B. `keyMatchesItem` is a `cmp`, so there is no call
in the loop and nothing is ever spilled.

Before, `322d80 .. 322ddc`, 24 instructions:

```
  322d4c:  whilelo p0.b, wzr, w9         ; governing predicate, hoisted
  322d54:  mov x12, #0x7fffffffffffffff  ; mask constant, hoisted
loop:
  322d80:  and x2, x0, x1                ; index & chunkMask
  322d84:  lsl x3, x2, #8                ;   * sizeof(Chunk) = 256
  322d88:  add x2, x18, x3               ; chunk
  322d8c:  prfm pldl1keep, [x2, #144]    ; prefetchAddr(chunk->itemAddr(8))
  322d90:  ld1b {z1.b}, p0/z, [x18, x3]  ; tags_[0..15]
  322d94:  match p1.b, p0/z, z1.b, z0.b  ; svmatch_u8 -- also sets NZCV
  322d98:  b.eq 322dcc                   ; svptest_any() == false (free)
  322d9c:  mov z1.b, p1/z, #17           ; -. 0x11 per matching lane
  322da0:  shrn v1.8b, v1.8h, #4         ;  | narrow to 4 bits/lane
  322da4:  fmov x3, d1                   ;  | predicate -> GPR, the long way
  322da8:  rbit x3, x3                   ;  |
  322dac:  clz x4, x3                    ; -' x4 = first match index * 4
  322db0:  add x5, x2, x4, lsl #2        ; item = chunk + i*16
  322db4:  ldr x6, [x5, #16]             ; keyMatchesItem
  322db8:  cmp x15, x6
  322dbc:  b.eq 322de4                   ; hit -> ItemIter{chunk, i}
  322dc0:  lsr x4, x12, x4               ; SparseMaskIter advance; needs the
  322dc4:  ands x3, x4, x3               ;   hoisted 0x7fff.. constant
  322dc8:  b.ne 322dac                   ; next tag match
  322dcc:  ldrb w2, [x2, #15]            ; outboundOverflowCount()
  322dd0:  cbz w2, 322e44                ; == 0 -> break
  322dd4:  subs x17, x17, #0x1
  322dd8:  add x0, x16, x0               ; index += step
  322ddc:  b.ne 322d80
```

After, `3229c8 .. 322a1c`, 22 instructions:

```
  322998:  whilelo p0.b, wzr, w9         ; governing predicate, hoisted
loop:
  3229c8:  and x1, x18, x0               ; index & chunkMask
  3229cc:  lsl x2, x1, #8                ;   * sizeof(Chunk) = 256
  3229d0:  add x1, x17, x2               ; chunk
  3229d4:  prfm pldl1keep, [x1, #144]    ; prefetchAddr(chunk->itemAddr(8))
  3229d8:  ld1b {z1.b}, p0/z, [x17, x2]  ; tags_[0..15]
  3229dc:  match p1.b, p0/z, z1.b, z0.b  ; svmatch_u8 -- also sets NZCV
  3229e0:  b.eq 322a0c                   ; svptest_any() == false (free)
  3229e4:  brkb p2.b, p0/z, p1.b         ; lanes strictly before first match
  3229e8:  cntp x2, p0, p2.b             ; count them = the index
  3229ec:  ubfiz x2, x2, #4, #32         ;   * 16
  3229f0:  add x2, x1, x2                ; item = chunk + i*16
  3229f4:  ldr x3, [x2, #16]             ; keyMatchesItem
  3229f8:  cmp x14, x3
  3229fc:  b.eq 322a24                   ; hit -> ItemIter{chunk, i}
  322a00:  brka p2.b, p0/z, p1.b         ; lanes up to AND INCLUDING it
  322a04:  bics p1.b, p0/z, p1.b, p2.b   ; clear it; BICS sets the flags
  322a08:  b.ne 3229e4                   ; next tag match
  322a0c:  ldrb w1, [x1, #15]            ; outboundOverflowCount()
  322a10:  cbz w1, 322a84                ; == 0 -> break
  322a14:  subs x16, x16, #0x1
  322a18:  add x18, x15, x18             ; index += step
  322a1c:  b.ne 3229c8
```

`match` to item-address goes 6 -> 4 instructions, and the loop-invariant
`0x7fffffffffffffff` that `SparseMaskIter` needs disappears, freeing a register
across the whole loop.

=== `std::string` key ===

Chunk stride 576 B, item 40 B. Here `keyMatchesItem` is a size compare plus an
out-of-line `bcmp`, and that call is what makes the two arms diverge: under the
base AAPCS64 a normal callee clobbers all of `p0`-`p15`, so any live predicate
has to go to the stack. That is what `addvl sp, sp, #-2` reserves, and what
`str p` / `ldr p` move.

LLVM clones the probe loop here — `cbnz x21, <main loop>` at the foot of the
hash block dispatches on key length, so there is a second, call-free copy for
the empty-key case (30 -> 27 instructions, never executed by this benchmark).
The 48-instruction string-hash block that precedes the loop is byte-identical
between the two arms. Only the main loop is shown.

Before, `3235e0 .. 3236c0`, 57 instructions:

```
  323508:  addvl sp, sp, #-2             ; VL-scaled SVE spill area
  3235ac:  str p1, [x29, #-1, mul vl]    ; governing predicate spilled ONCE
loop:
  3235e0:  and x8, x28, x19
  3235e4:  mul x8, x8, x6                ; * 576
  3235e8:  add x25, x26, x8
  3235ec:  prfm pldl1keep, [x25, #336]   ; prefetchAddr(chunk->itemAddr(8))
  3235f0:  ld1b {z0.b}, p1/z, [x26, x8]  ; tags_[0..15]
  3235f4:  match p0.b, p1/z, z0.b, z1.b  ; svmatch_u8
  3235f8:  b.eq 3236b0                   ; no match
  3235fc:  mov z0.b, p0/z, #17           ; -. rebuild the nibble mask
  323600:  str w23, [sp, #44]
  323604:  str z1, [x29, #-2, mul vl]    ; needle vector spilled
  323608:  stp x12, x10, [sp, #24]
  32360c:  shrn v0.8b, v0.8h, #4         ;  |
  323610:  fmov x8, d0                   ;  |
  323614:  rbit x8, x8                   ;  |
  323618:  str x8, [sp, #56]             ; GPR spill: the reversed mask
  32361c:  clz x8, x8                    ;  -' index * 4
  323620:  mov w9, #0x28
  323624:  str x8, [sp, #48]             ; GPR spill: the index * 4
  323628:  lsr x8, x8, #2
  32362c:  umaddl x24, w8, w9, x25       ; item = chunk + i*40
  323630:  ldr x8, [x24, #24]            ; keyMatchesItem: size first
  323634:  cmp x21, x8
  323638:  b.ne 323690                   ; size mismatch -> next tag match
  32363c:  ldr x1, [x24, #16]
  323640:  mov x0, x22
  323644:  mov x2, x21
  323648:  mov x23, x22                  ; shuffle to keep x30/x22 alive
  32364c:  mov x22, x30                  ;   across the call
  323650:  bl bcmp                       ; CALL
  323654:  mov x3, #0xbfd6
  323658:  mov x1, #0xacc9
  32365c:  ldr p1, [x29, #-1, mul vl]    ; predicate refill
  323660:  movk x3, #0x7d8f, lsl #16
  323664:  movk x1, #0x962e, lsl #16
  323668:  mov x30, x22                  ; undo the shuffle
  32366c:  movk x3, #0x6556, lsl #32
  323670:  movk x1, #0x4b93, lsl #32
  323674:  mov x22, x23
  323678:  mov w6, #0x240
  32367c:  mov x5, #0xffffffffffffffff
  323680:  mov w4, #0x1
  323684:  movk x3, #0x4227, lsl #48
  323688:  movk x1, #0x8bb8, lsl #48
  32368c:  cbz w0, 323898                ; bcmp == 0 -> hit
  323690:  ldp x10, x9, [sp, #48]        ; refill index*4 and mask
  323694:  mov x8, #0x7fffffffffffffff
  323698:  ldr z1, [x29, #-2, mul vl]    ; refill needle
  32369c:  ldr w23, [sp, #44]
  3236a0:  lsr x8, x8, x10
  3236a4:  ldp x12, x10, [sp, #24]
  3236a8:  and x8, x8, x9
  3236ac:  cbnz x8, 323618               ; next tag match
  3236b0:  ldrb w8, [x25, #15]           ; outboundOverflowCount()
  3236b4:  cbz w8, 3238b8                ; == 0 -> break
  3236b8:  subs x12, x12, #0x1
  3236bc:  add x28, x28, x10             ; index += step
  3236c0:  b.ne 3235e0
```

After, `323220 .. 3232d8`, 47 instructions:

```
  323148:  addvl sp, sp, #-2             ; VL-scaled SVE spill area
  3231ec:  str p2, [x29, #-1, mul vl]    ; governing predicate spilled ONCE
loop:
  323220:  and x8, x28, x19
  323224:  mul x8, x8, x6                ; * 576
  323228:  add x27, x26, x8
  32322c:  prfm pldl1keep, [x27, #336]   ; prefetchAddr(chunk->itemAddr(8))
  323230:  ld1b {z0.b}, p2/z, [x26, x8]  ; tags_[0..15]
  323234:  match p1.b, p2/z, z0.b, z1.b  ; svmatch_u8
  323238:  b.eq 3232c8                   ; no match
  32323c:  str w23, [sp, #44]
  323240:  str z1, [x29, #-2, mul vl]    ; needle vector spilled
  323244:  stp x12, x10, [sp, #24]
  323248:  brkb p0.b, p2/z, p1.b         ; lanes before the first match
  32324c:  mov w9, #0x28
  323250:  str p1, [x29, #-2, mul vl]    ; THE NEW SPILL: match predicate
  323254:  cntp x8, p2, p0.b             ; count them = the index
  323258:  umaddl x23, w8, w9, x27       ; item = chunk + i*40
  32325c:  ldr x8, [x23, #24]            ; keyMatchesItem: size first
  323260:  cmp x21, x8
  323264:  b.ne 3232ac                   ; size mismatch -> next tag match
  323268:  ldr x1, [x23, #16]
  32326c:  mov x0, x22
  323270:  mov x2, x21                   ; no x30/x22 shuffle needed
  323274:  bl bcmp                       ; CALL
  323278:  mov x3, #0xbfd6
  32327c:  mov x1, #0xacc9
  323280:  ldr p2, [x29, #-1, mul vl]    ; governing predicate refill
  323284:  movk x3, #0x7d8f, lsl #16
  323288:  movk x1, #0x962e, lsl #16
  32328c:  mov w6, #0x240
  323290:  movk x3, #0x6556, lsl #32
  323294:  movk x1, #0x4b93, lsl #32
  323298:  mov x5, #0xffffffffffffffff
  32329c:  mov w4, #0x1
  3232a0:  movk x3, #0x4227, lsl #48
  3232a4:  movk x1, #0x8bb8, lsl #48
  3232a8:  cbz w0, 32349c                ; bcmp == 0 -> hit
  3232ac:  ldr p1, [x29, #-2, mul vl]    ; match predicate refill
  3232b0:  ldr z1, [x29, #-2, mul vl]    ; needle refill
  3232b4:  ldr w23, [sp, #44]
  3232b8:  ldp x12, x10, [sp, #24]
  3232bc:  brka p0.b, p2/z, p1.b         ; lanes up to AND INCLUDING it
  3232c0:  bics p1.b, p2/z, p1.b, p0.b   ; clear it; BICS sets the flags
  3232c4:  b.ne 323248                   ; next tag match
  3232c8:  ldrb w8, [x27, #15]           ; outboundOverflowCount()
  3232cc:  cbz w8, 3234bc                ; == 0 -> break
  3232d0:  subs x12, x12, #0x1
  3232d4:  add x28, x28, x10             ; index += step
  3232d8:  b.ne 323220
```

The trade is in one place. Before spills two GPRs (`[sp, #56]` the reversed
mask, `[sp, #48]` the index) and refills them with an `ldp`; after spills one
predicate and refills it with one `ldr`. Because the predicate carries the
iteration state directly, the five-instruction mask rebuild, the
`0x7fffffffffffffff` constant, and the four `mov`s shuffling `x22`/`x23`/`x30`
around the call all go away.

`str z1, [x29, #-2, mul vl]` and `str p1, [x29, #-2, mul vl]` read like the
second stomps the first; they do not. `mul vl` scales by VL for Z registers and
by VL/8 for P registers, so at VL=128 the two slots are `x29-32 .. x29-16` and
`x29-4 .. x29-2`.

=== Counts ===

| region | before | after | delta |
| --- | --- | --- | --- |
| `uint64_t` probe loop | 24 | 22 | -2 |
| -- match -> item address | 6 | 4 | -2 |
| -- next-match advance | 3 | 3 | 0 |
| `std::string` probe loop | 57 | 47 | **-10** |
| -- match -> `bl bcmp` | 24 | 17 | -7 |
| -- `bcmp` return -> loop-back | 28 | 25 | -3 |
| `std::string` empty-key clone | 30 | 27 | -3 |

`addvl sp, sp, #-2` is unchanged in both `std::string` arms (same SVE spill
area), while the fixed frame shrinks `0x40` -> `0x30` — exactly the 16 bytes of
GPR mask spills that go away.

For a *second* tag match in the same chunk the new path is 10 instructions
(`brkb` .. `b.ne`) against the old 8 (`clz` .. `b.ne`), because `brkb`+`cntp`
are re-executed where the old code re-entered at `clz`. False tag matches are
~1/255 per key, well below the first-match saving.

Depends on D117044647, which gates the pre-existing `svmatch` sites on SVE2 —
without it an SVE1 target cannot compile this file at all.

Result on Grace (Neoverse V2), `hash_maps_bench` find, ~5-6% faster.

Reviewed By: yfeldblum

Differential Revision: D117005509

fbshipit-source-id: 30f4dda50935e9bde72dab323408560a2c43b064
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants