-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using LLVM to improve CppAD #66
Comments
Linking Standard Math Functions In the llvm branch execute the following command to configure cppad:
... snip ... If you now remove the lines containing
... snip ..
Then you can set break points in llvm_tst.cpp to see exactly what llvm commands are being used. |
Linking Standard Math Functions I think this is related to the following text: If no definition is found inside the JIT, it falls back to calling “dlsym("sin")” on the Kaleidoscope process itself. Since “sin” is defined within the JIT’s address space, it simply patches up calls in the module to call the libm version of sin directly. which appears in So I should be able to find the problem by looking at the llvm Kaleidoscope example. |
The main problem was that adding object files and adding shared libraries use different llvm routines. |
I have all the features of a ADFun working both for optimizing and jit compiling using llvm. Here are a few results: Size of the matrix: Retape for each function evaluation: Re-use the tape / jit complie: |
Introduciton
This is really a request for help in CppAD development that is closely related to CppADCodegen.
I have questions about how to use LLVM and I hoping this group can help me.
Optimization
I am working on using the llvm optimizer as a replacement for the CppAD optimizer; see the example:
https://github.com/coin-or/CppAD/blob/llvm/example/llvm/optimize.cpp
I am close to being able to test how this compares to the CppAD optimizer for a simple example.
Complied Object Files
As a side benefit, inspired by CppADCodeGen, CppAD should be able to directly general object libraries corresponding to the llvm IR representation of an ADFun; see the example
https://github.com/coin-or/CppAD/blob/llvm/example/llvm/grad_det_minor.cpp
I am not sure how this will compare to the CppADCodeGen method for generating code.
Development
Work on this effect is happening on the llvm branch of CppAD in the following files and directories
https://github.com/coin-or/CppAD/blob/llvm/include/cppad/core/llvm_ir.hpp
https://github.com/coin-or/CppAD/blob/llvm/include/cppad/core/llvm_link.hpp
https://github.com/coin-or/CppAD/tree/llvm/cppad_lib/llvm
https://github.com/coin-or/CppAD/tree/llvm/example/llvm
https://github.com/coin-or/CppAD/blob/llvm/test_more/general/llvm_tst.cpp
LLVM Version
This work is currently only tested with the following version of llvm:
https://github.com/llvm/llvm-project/tree/release/11.x
Questions
I will post individual questons below.
The text was updated successfully, but these errors were encountered: