This is an automated email from the ASF dual-hosted git repository.
zhztheplayer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 4773e32fe5 [VL] Avoid PLT overhead for intra-library calls in
libgluten and libvelox (#13819)
4773e32fe5 is described below
commit 4773e32fe5b898f2d3ad44bb47632e630da7eec9
Author: Zhu, Lipeng <[email protected]>
AuthorDate: Mon Nov 30 18:06:33 2026 +0800
[VL] Avoid PLT overhead for intra-library calls in libgluten and libvelox
(#13819)
libvelox.so exports every facebook::velox::* and gluten::* symbol
(about 120K dynamic symbols) and libgluten.so exports the statically
linked dependencies such as snappy. Neither library is linked with
-Bsymbolic, so a call from one function in the library to another
exported, non-inlined function in the same library goes through a PLT
stub, for example snappy::MemCopy64@plt, snappy::DeferMemCopy@plt and
DecodedVector::isNullAt@plt. On TPC-H and TPC-DS these stubs take 2.0-2.4%
of all cycles.
Link both libraries with -Wl,-Bsymbolic-functions. It binds function
references inside the library at link time and leaves data symbols (static
locals, STB_GNU_UNIQUE objects) with their normal binding, so the
libstdc++ isolation that libgluten relies on is not affected. The JUMP_SLOT
relocations drop from 29342 to 929 in libvelox.so and from 7408 to 247 in
libgluten.so.
Co-authored-by: hu hengrui <[email protected]>
Co-authored-by: Wangyang Guo <[email protected]>
---
cpp/core/CMakeLists.txt | 5 +++++
cpp/velox/CMakeLists.txt | 8 ++++++++
2 files changed, 13 insertions(+)
diff --git a/cpp/core/CMakeLists.txt b/cpp/core/CMakeLists.txt
index cf6227bc50..bcba13f2af 100644
--- a/cpp/core/CMakeLists.txt
+++ b/cpp/core/CMakeLists.txt
@@ -186,6 +186,11 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
target_link_options(
gluten PRIVATE -Wl,--exclude-libs,libstdc++.a -Wl,--exclude-libs,libgcc.a
-Wl,--exclude-libs,libgcc_eh.a)
+ # Bind intra-library function references locally so hot internal calls of the
+ # statically linked deps (snappy::MemCopy64 / DeferMemCopy, ...) and of
gluten
+ # itself do not go through PLT stubs. Functions only; data symbols keep their
+ # usual (unique/interposable) binding.
+ target_link_options(gluten PRIVATE -Wl,-Bsymbolic-functions)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
diff --git a/cpp/velox/CMakeLists.txt b/cpp/velox/CMakeLists.txt
index ba9c36a2af..68d77db47b 100644
--- a/cpp/velox/CMakeLists.txt
+++ b/cpp/velox/CMakeLists.txt
@@ -280,6 +280,14 @@ if(ENABLE_GLUTEN_VCPKG AND NOT CMAKE_SYSTEM_NAME MATCHES
"Darwin")
target_link_options(
velox PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
endif()
+if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ # Bind intra-library function references locally. libvelox exports every
+ # facebook::velox::* / gluten::* symbol, so without this each call from one
+ # Velox function to another exported (non-inlined) one goes through a PLT
stub
+ # (e.g. DecodedVector::isNullAt@plt). Functions only: data symbols (static
+ # locals, STB_GNU_UNIQUE) keep normal interposition semantics.
+ target_link_options(velox PRIVATE -Wl,-Bsymbolic-functions)
+endif()
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
# Make libvelox.dylib own the Velox mono archive. Test utilities can then
# resolve Velox symbols from the dylib instead of linking a second copy.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]