Unable to build ceres-solver for iOS with c/c++ flag `-fembed-bitcode` #282

Open
AndreasSchacherbauer opened this Issue May 9, 2017 · 6 comments

Comments

Projects
None yet
3 participants

AndreasSchacherbauer commented May 9, 2017 edited

Hi,
I tried to build ceres for iOS with the bitcode option enabled but I got the following error: clang: error: -mllvm is not supported with -fembed-bitcode.
I had to remove the -mllvm cxx flag in the main CMakeLists.txt file and was then able to specify -fembed-bitcode in the iOS.cmake toolchain file line 250-255.

For what is the -mllvm option needed or is there another way to resolve my bitcode build error?

Contributor

alexsmac commented May 10, 2017

The -mllvm option is required to pass the -inline-threshold=600 option through Clang to the LLVM pipeline. As per the comment in the CMakeLists, historically we have found that increasing the inlining threshold on Clang made a big performance improvement overall as otherwise Eigen was being hobbled as various functions were not being inlined.

As it seems from the Clang/LLVM code that -mllvm and -fembed-bitcode are incompatible options, I don't think that there is a workaround here other than removing the -mllvm -inline-threshold=600, however that would impact performance.

Contributor

sandwichmaker commented May 15, 2017

@alexsmac it maybe worth looking at the -inline-threshold again. Its been a while since we evaluated the need for it.

Contributor

sandwichmaker commented Jun 7, 2017

A quick informal test on my laptop does not indicate that this is particularly useful.
@alexsmac do you remember what prompted this inline threshold to begin with?

Contributor

sandwichmaker commented Jun 7, 2017

So this seems to be the CL that added this

3d6eceb

so I need to check as to what happens to the performance of ITERATIVE_SCHUR with and without this.

Contributor

alexsmac commented Jun 7, 2017

I think it was something @keir added to improve Jet performance, without it I think autodiff cost functions were being clobbered when evaluating Jets with larger parameter sizes.

Contributor

sandwichmaker commented Jun 8, 2017

Turns out this has to do with the Schur based solvers rather than Jets. And there is a performance differential, but I need to spend some time to see if we can do this via compiler annotations instead of compiler flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment