mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Remove FAQ about increasing inlining threshold for Clang.
- Changing the inlining threshold for Clang as described has a minimal effect on user performance. - The problem that originally prompted the belief that it did was due to an erroneous CXX flag configuration (in user code). Change-Id: I03017241c0f87b8dcefb8c984ec3b192afd97fc2
This commit is contained in:
@@ -33,44 +33,6 @@ Building
|
||||
NDK. It has worse performance than the full fledged glog library
|
||||
and is much harder to control and use.
|
||||
|
||||
#. Increase the inlining threshold in Clang for Eigen.
|
||||
|
||||
By default, the inlining threshold (evaluated on a heuristic used by LLVM to
|
||||
guess how expensive a function will be to inline) can hobble Eigen, resulting in
|
||||
poor performance.
|
||||
|
||||
Ceres itself will always be compiled with an increased inline threshold
|
||||
(currently 600) when compiled with Clang. To experiment with this in your
|
||||
own code, you can use the following:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
# If using CMake >= 2.8.12:
|
||||
# We recommend you use target_compile_options() to add the inlining flags
|
||||
# to specific targets for fine grained control:
|
||||
#
|
||||
# Use a larger inlining threshold for Clang, since it can hobble Eigen,
|
||||
# resulting in reduced performance. The -Qunused-arguments is needed because
|
||||
# CMake passes the inline threshold to the linker and clang complains about
|
||||
# it (and dies, if compiling with -Werror).
|
||||
target_compile_options(<YOUR_TARGET_NAME> PUBLIC
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Qunused-arguments -mllvm -inline-threshold=600>)
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
# If using CMake < 2.8.12:
|
||||
# On CMake < 2.8.12 target_compile_options() is not available, so you
|
||||
# cannot add the flags only on a per-target level and must instead set them
|
||||
# for all targets declared after the flags are updated:
|
||||
#
|
||||
# Use a larger inlining threshold for Clang, since it can hobble Eigen,
|
||||
# resulting in reduced performance. The -Qunused-arguments is needed because
|
||||
# CMake passes the inline threshold to the linker and clang complains about
|
||||
# it (and dies, if compiling with -Werror).
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -Qunused-arguments -mllvm -inline-threshold=600")
|
||||
endif()
|
||||
|
||||
Modeling
|
||||
========
|
||||
|
||||
Reference in New Issue
Block a user