Repository navigation
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Global ELF function-binding changes require runtime compatibility validation for JNI, native UDF plugins, Bolt, and vcpkg/non-vcpkg builds that query benchmarks and mostly object-linked native tests do not provide.
No open issues 🎉
What changed in this PR
Optimizes Gluten’s native core and Velox backend by reducing indirect-call overhead within their shared libraries on non-Darwin platforms.
Changes:
- Adds
-Wl,-Bsymbolic-functionsto theglutenandveloxshared-library targets. - Preserves normal data-symbol binding and leaves Darwin linking unchanged.
| File | Description |
|---|---|
cpp/velox/CMakeLists.txt |
Enables local function binding within libvelox. |
cpp/core/CMakeLists.txt |
Enables local function binding within libgluten, including statically linked dependencies. |
Review effort: Balanced
90f4040 to
0064fba
Compare
0064fba to
b8bf0a9
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Broad ELF binding changes affect native ABI and UDF-plugin compatibility in both dependency configurations, while benchmarks and most native tests leave shared-library integration validation needing human confirmation.
No open issues 🎉
Review effort: Balanced
…elox 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 <hengrui.hu@intel.com> Co-Authored-By: Wangyang Guo <wangyang.guo@intel.com>
|
cc @jackylee-ch @philo-he @zhztheplayer @zhouyuan, could you help review? This sits next to the libstdc++ isolation from #12557, and only changes function binding (data symbols, including STB_GNU_UNIQUE statics, are unchanged). |
philo-he
left a comment
There was a problem hiding this comment.
LGTM, thanks!
I also checked whether this affects using jemalloc via LD_PRELOAD. It doesn't: -Bsymbolic-functions only binds calls to functions defined inside the same library, and malloc/free come from libc, so they still resolve to the preloaded jemalloc.
|
I planned to add LTO / PGO to Gluten as well but was unaware of this improvement, numbers are promising but would be nice if larger data set can be tested, e.g., SF 1000 or higher |
What changes are proposed in this pull request?
libvelox.soandlibgluten.soare not linked with-Bsymbolic, so calls between exported functions in the same library go through PLT stubs (an extra indirect jump each). Hot small functions likesnappy::MemCopy64andDecodedVector::isNullAtmake these stubs 2.0–2.4% of all cycles on TPC-H / TPC-DS.How was this patch tested?
TPC-H / TPC-DS SF300 (snappy Parquet) on an Intel Xeon 6960P, 3 executors × 4 cores. Each build ran 3 times, interleaved with the baseline; numbers are the mean.
Query results match the baseline.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)