[VL] Support LTO in builds - #12894
Conversation
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a build-time ENABLE_LTO toggle to enable IPO/LTO in the CMake build, and adjusts a HUGEINT byte-reversal path to avoid an invalid loop in LTO builds.
Changes:
- Introduce
--enable_lto/ENABLE_LTOplumbing in Velox and backend build scripts. - Add CMake IPO/LTO enablement guarded by an
ENABLE_LTOoption with capability checks. - Replace manual byte reversal with
std::reverse_copyin HUGEINT conversion logic.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| ep/build-velox/src/build-velox.sh | Adds ENABLE_LTO argument and forwards -DVELOX_ENABLE_LTO=ON to Velox build. |
| dev/builddeps-veloxbe.sh | Wires --enable_lto through to Velox and Gluten CMake configuration. |
| cpp/velox/operators/serializer/VeloxRowToColumnarConverter.cc | Updates HUGEINT byte reversal implementation (uses reverse_copy). |
| cpp/CMakeLists.txt | Adds ENABLE_LTO option and enables IPO/LTO via CheckIPOSupported. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
cpp/velox/operators/serializer/VeloxRowToColumnarConverter.cc:118
bytesValue[0]is accessed even whenlength == 0, which is undefined behavior (and is likely the remaining issue that shows up under LTO/optimizations). The sign-extension logic should only run when at least one byte was read.
if (length > 0) {
std::reverse_copy(bytesValue.begin(), bytesValue.begin() + length, bytesValue2);
}
if (static_cast<int8_t>(bytesValue[0]) < 0) {
memset(bytesValue2 + length, 255, 16 - length);
}
Adds option
ENABLE_LTOin build to enable link-time optimization using CMake defaults.Fixes a bug in code for LTO build.