[llvm-dev] use virtual file with llvm::MemoryBuffer::getFileOrSTDIN instead of real file

Simeon Ehrig via llvm-dev llvm-dev at lists.llvm.org
Tue Jun 11 08:00:56 PDT 2019

Dear LLVM-Developers,

we extend the cling C++ interpreter 
(https://github.com/root-project/cling) with CUDA functionality for 
Nvidia GPUs.

Now we are refactoring the extension 
(https://github.com/root-project/cling/pull/284) to fix some conceptual 
errors and improve performance. One of our goals is to avoid file I/O. 
We have achieved this goal with one exception. We need to write the CUDA 
fatbinary code to a file because the CodeGen of the CUDA x86 backend 
uses a file path and uses llvm::MemoryBuffer::getFileOrSTDIN() to load 
the code from a file. See: 

Our question is, can we pass the fatbinary code to CodeGen without file 
I/O and without changing the source code of clang? We want to avoid 
changes in the clang code, as it would make it more complicated to 
update clang/LLVM base.  Maybe something is possible with the llvm 
virtual file system. Unfortunately, I am not familiar enough with it to 
find a solution.

Thank you so much for your help.

Best regards,
Simeon Ehrig

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190611/00e47c3e/attachment.html>

More information about the llvm-dev mailing list