Closed Dtristone closed 2 years ago
Thanks for your interest in the tool. I think the problem is about the input. The "nlohmann json paser" assume there is a param.json
in the kernel folder. You can see one example here. Is there a param.json in your kernel folder? Please let me know if it still doesn't work after you put a param.json in the folder. I will try to provide a tutorial/readme meanwhile...
Yeah! This problem is solved after I add the file, but another problem occurs when "[generate dot for DFG]":
.....
==================================
[show opcode count]
add : 2
br : 4
fadd : 1
fmul : 1
getelementptr : 3
icmp : 2
load : 3
phi : 3
ret : 1
store : 1
DFG node count: 21; DFG edge count: 34
==================================
[generate dot for DFG]
opt: /home/llvmsrc/llvm/lib/Support/raw_ostream.cpp:839: virtual size_t llvm::raw_fd_ostream::preferred_buffer_size() const: Assertion `FD >= 0 && "File not yet open!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: opt -load ../../CGRA-Mapper/build/mapper/libmapperPass.so -mapperPass kernel.bc -o /dev/null
1. Running pass 'Function Pass Manager' on module 'kernel.bc'.
2. Running pass 'DFG Pass Analyse' on function '@_Z6kernelPfS_S_'
#0 0x0000561fa927eb3e llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/local/bin/opt+0x2c63b3e)
#1 0x0000561fa927c914 llvm::sys::RunSignalHandlers() (/usr/local/bin/opt+0x2c61914)
#2 0x0000561fa927ca58 SignalHandler(int) (/usr/local/bin/opt+0x2c61a58)
#3 0x00007f8c3e87e3c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x00007f8c3e34d18b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618b)
#5 0x00007f8c3e32c859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25859)
#6 0x00007f8c3e32c729 (/lib/x86_64-linux-gnu/libc.so.6+0x25729)
#7 0x00007f8c3e33df36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#8 0x0000561fa925865e llvm::raw_fd_ostream::preferred_buffer_size() const (/usr/local/bin/opt+0x2c3d65e)
#9 0x0000561fa9258c54 llvm::raw_ostream::SetBuffered() (/usr/local/bin/opt+0x2c3dc54)
#10 0x0000561fa92591ec llvm::raw_ostream::write(char const*, unsigned long) (/usr/local/bin/opt+0x2c3e1ec)
#11 0x0000561fa922ff2d llvm::Twine::print(llvm::raw_ostream&) const (/usr/local/bin/opt+0x2c14f2d)
#12 0x0000561fa922ff2d llvm::Twine::print(llvm::raw_ostream&) const (/usr/local/bin/opt+0x2c14f2d)
#13 0x00007f8c3e2b0e2e llvm::operator<<(llvm::raw_ostream&, llvm::Twine const&) (../../CGRA-Mapper/build/mapper/libmapperPass.so+0xeae2e)
#14 0x00007f8c3e2ad204 DFG::generateDot(llvm::Function&, bool) (../../CGRA-Mapper/build/mapper/libmapperPass.so+0xe7204)
#15 0x00007f8c3e2794a1 (anonymous namespace)::mapperPass::runOnFunction(llvm::Function&) (../../CGRA-Mapper/build/mapper/libmapperPass.so+0xb34a1)
#16 0x0000561fa8a3336c llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/local/bin/opt+0x241836c)
#17 0x0000561fa8a33a39 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/local/bin/opt+0x2418a39)
#18 0x0000561fa8a32527 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/bin/opt+0x2417527)
#19 0x0000561fa6dba7b5 main (/usr/local/bin/opt+0x79f7b5)
#20 0x00007f8c3e32e0b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#21 0x0000561fa6e573fe _start (/usr/local/bin/opt+0x83c3fe)
./run.sh: line 1: 9144 Aborted (core dumped) opt -load ../../CGRA-Mapper/build/mapper/libmapperPass.so -mapperPass kernel.bc -o /dev/null
I run the "run.sh" in the folder "CGRA-Bench/kernels/fir" but the result is the same with above.
Yeah! This problem is solved after I add the file, but another problem occurs when "[generate dot for DFG]":
..... ================================== [show opcode count] add : 2 br : 4 fadd : 1 fmul : 1 getelementptr : 3 icmp : 2 load : 3 phi : 3 ret : 1 store : 1 DFG node count: 21; DFG edge count: 34 ================================== [generate dot for DFG] opt: /home/llvmsrc/llvm/lib/Support/raw_ostream.cpp:839: virtual size_t llvm::raw_fd_ostream::preferred_buffer_size() const: Assertion `FD >= 0 && "File not yet open!"' failed. PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: opt -load ../../CGRA-Mapper/build/mapper/libmapperPass.so -mapperPass kernel.bc -o /dev/null 1. Running pass 'Function Pass Manager' on module 'kernel.bc'. 2. Running pass 'DFG Pass Analyse' on function '@_Z6kernelPfS_S_' #0 0x0000561fa927eb3e llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/local/bin/opt+0x2c63b3e) #1 0x0000561fa927c914 llvm::sys::RunSignalHandlers() (/usr/local/bin/opt+0x2c61914) #2 0x0000561fa927ca58 SignalHandler(int) (/usr/local/bin/opt+0x2c61a58) #3 0x00007f8c3e87e3c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0) #4 0x00007f8c3e34d18b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618b) #5 0x00007f8c3e32c859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25859) #6 0x00007f8c3e32c729 (/lib/x86_64-linux-gnu/libc.so.6+0x25729) #7 0x00007f8c3e33df36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36) #8 0x0000561fa925865e llvm::raw_fd_ostream::preferred_buffer_size() const (/usr/local/bin/opt+0x2c3d65e) #9 0x0000561fa9258c54 llvm::raw_ostream::SetBuffered() (/usr/local/bin/opt+0x2c3dc54) #10 0x0000561fa92591ec llvm::raw_ostream::write(char const*, unsigned long) (/usr/local/bin/opt+0x2c3e1ec) #11 0x0000561fa922ff2d llvm::Twine::print(llvm::raw_ostream&) const (/usr/local/bin/opt+0x2c14f2d) #12 0x0000561fa922ff2d llvm::Twine::print(llvm::raw_ostream&) const (/usr/local/bin/opt+0x2c14f2d) #13 0x00007f8c3e2b0e2e llvm::operator<<(llvm::raw_ostream&, llvm::Twine const&) (../../CGRA-Mapper/build/mapper/libmapperPass.so+0xeae2e) #14 0x00007f8c3e2ad204 DFG::generateDot(llvm::Function&, bool) (../../CGRA-Mapper/build/mapper/libmapperPass.so+0xe7204) #15 0x00007f8c3e2794a1 (anonymous namespace)::mapperPass::runOnFunction(llvm::Function&) (../../CGRA-Mapper/build/mapper/libmapperPass.so+0xb34a1) #16 0x0000561fa8a3336c llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/local/bin/opt+0x241836c) #17 0x0000561fa8a33a39 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/local/bin/opt+0x2418a39) #18 0x0000561fa8a32527 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/bin/opt+0x2417527) #19 0x0000561fa6dba7b5 main (/usr/local/bin/opt+0x79f7b5) #20 0x00007f8c3e32e0b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b3) #21 0x0000561fa6e573fe _start (/usr/local/bin/opt+0x83c3fe) ./run.sh: line 1: 9144 Aborted (core dumped) opt -load ../../CGRA-Mapper/build/mapper/libmapperPass.so -mapperPass kernel.bc -o /dev/null
I run the "run.sh" in the folder "CGRA-Bench/kernels/fir" but the result is the same with above.
I change the "kernel" from "_Z3firPfSS" to "main" in the param.json and the problem disappers.
Ha, yes. The kernel's name should be as same as it is shown in the IR (.ll). Different versions of the LLVM might give a function a different name. So now it can complete? And you probably have a _Z3firPfS_S_.dot
generated. And you can use dot.sh
to generate the DFG figure in .png
. You can also see the mapping of the DFG on the target CGRA (if it works well).
Ha, yes. The kernel's name should be as same as it is shown in the IR (.ll). Different versions of the LLVM might give a function a different name. So now it can complete? And you probably have a
_Z3firPfS_S_.dot
generated. And you can usedot.sh
to generate the DFG figure in.png
. You can also see the mapping of the DFG on the target CGRA (if it works well).
If I use the original "_Z3firPfSS“ as the kernel name, it will go wrong. But I if change the target kernel's name from "_Z3firPfSS" (with "_")to "fir" in the .ll file and convert it back to .bc file, the program works fine. Maybe the "_" in the kernel name can affect the creating of the target file in my computer environment?
You can either use the existing names to replace your .ll
or explicitly define a name in the param.json
. Both should work. Please let me know if there is anything else I can help!
Hello! I am trying to using your tools to map same simple kernel to a cgra for my researh. I installed the llvm-11 from source code and use cmake-16 firstly, and then I compiled the cgra mapper successfully, but I met the following bug when I run the test script “run.sh” under the test folder:
I lack the experience of developing a llvm pass so I donnot know how to solve it. Is it result from my using a cmake-1.6 rather than the required cmake1.0 or something else?