support the ParseIRFile API in llvmlite
See original GitHub issueFeature request
Here is the thing. I wrote some C++ code for a new Numba type and its operations. At first, I compiled the C++ code into a pythonic .so file, and using ir.FunctionType to declare the C++ function, then generate the call IR to call the underlying C++ function. But awfully, I have to call this C++ functions frequently and switch the context from jitted function to .so, and back and forth many times. Thus this hurts the performance.
After a discussion with @gmarkall , I have to compile the C++ code to generate LLVM IR (say, from a foo.cpp to a foo.ll), read and convert it as a llvmlite IR module (during Numba compilation process, I guess this is kind of similar with @cuda.jit(link=[foo.cu]), then link it in the jitted IR module (the main module). Thus, LLVM can do some tricks about function inlining to avoid creating a new stack frame, switch registers, etc, to save much time.
But, llvmlite doesn’t provide this kind of interface/wrapper for the LLVM ParseIRFile API (I guess the corresponding API in nvptx is nvrtcCreateProgram). Say, I can use clang to convert a C++ file to the corresponding IR file (e.g., from foo.cpp to foo.ll), and stuck in this place.
So, I think this is a feature request. And I want to contribute a wrapper for this specific API in llvmlite. Or maybe we can discuss an alternative way to fulfill my goal.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)

Top Related StackOverflow Question
@dlee992 thank you for opening this. I have labelled this as a feature request and we probably ought to discuss this during the developer meeting next week. 👍
Awesome! OK to close this issue again?