Replies: 1 comment
|
The current Gluten code selects The relevant project code only does this when no build type was supplied: if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build to Release.")
endif()Source: cpp/CMakeLists.txt. For an cmake -S cpp -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS_RELEASE='-O2 -DNDEBUG'For symbols with CMake's usual GNU balance, use: cmake -S cpp -B build -DCMAKE_BUILD_TYPE=RelWithDebInfoIf the intention is specifically production-equivalent cmake -S cpp -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO='-O3 -g -DNDEBUG'Those choices should be benchmarked on the actual Velox workload; there is no evidence in this CMake assignment alone that |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi community,
I am trying to understand the rationale for the current default optimization
level of the Velox backend native build.
The build scripts default to:
With the GNU CMake toolchain, this results in:
instead of -O2.
-O2 is commonly used as the default optimization level in Linux distribution
and general-purpose software builds. For example, Debian's default C/C++ build
flags include -g -O2:
https://wiki.debian.org/Hardening
This is often considered a balance among runtime performance, compilation time,
binary size, and predictable compiler behavior. On the other hand, -O3 can
benefit compute-intensive hot loops, but may also increase binary size and does
not necessarily improve every workload.
I traced the Gluten history and found that the C++ build has defaulted to
CMAKE_BUILD_TYPE=Release since the early backend setup. However, I could not
find a commit, benchmark result, or discussion explicitly explaining why -O3
was preferred over -O2. Therefore, it is currently unclear whether this is
an intentional performance decision or simply inherited from CMake's default
Release flags.
Could maintainers please clarify:
Was -O3 deliberately selected based on Gluten / Velox benchmark results,
or is it only inherited from CMake's default Release configuration?
Are there known workload-specific benefits of -O3 for the Velox backend?
Have correctness, compile-time, binary-size, or potential performance
regression trade-offs versus -O2 been evaluated?
Is -O3 still the recommended production optimization level across
supported compilers and platforms?
Could the rationale be documented, or could the optimization level be made
an explicit build option?
This is also relevant to a potential release-with-debug-symbols build. We would
like to preserve the intended production optimization level while adding -g,
but first want to confirm whether the current -O3 behavior is intentional.
Thanks!
All reactions