ROCm / HIPIFY

HIPIFY: Convert CUDA to Portable C++ Code
https://rocm.docs.amd.com/projects/HIPIFY/en/latest/
MIT License
503 stars 70 forks source link

[HIPIFY] Compile HIPIFY with Rocm 4.0.0 #341

Closed brad-mengchi closed 3 years ago

brad-mengchi commented 3 years ago

Hi all,

I tried to compile HIPIFY with Rocm 4.0.0.

mkdir build dist cd build

cmake \ -DCMAKE_INSTALL_PREFIX=../dist \ -DCMAKE_BUILD_TYPE=Release \ ..

And at the last step:

make install

I got the compilation error as below:

[ 3%] Building CXX object CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o /home/echo/workspace/HIPIFY/src/HipifyAction.cpp:751:16: error: no matching constructor for initialization of 'clang::Lexer' clang::Lexer RawLex(SM.getMainFileID(), FromFile, SM, PP.getLangOpts()); ^ ~~~~~~~~~~ /opt/rocm/llvm/include/clang/Lex/Lexer.h:152:3: note: candidate constructor not viable: no known conversion from 'llcompat::Memory_Buffer' (aka 'llvm::MemoryBufferRef') to 'const llvm::MemoryBuffer ' for 2nd argument Lexer(FileID FID, const llvm::MemoryBuffer FromFile, ^ /opt/rocm/llvm/include/clang/Lex/Lexer.h:141:3: note: candidate constructor not viable: requires 3 arguments, but 4 were provided Lexer(FileID FID, const llvm::MemoryBuffer *InputFile, Preprocessor &PP); ^ /opt/rocm/llvm/include/clang/Lex/Lexer.h:146:3: note: candidate constructor not viable: requires 5 arguments, but 4 were provided Lexer(SourceLocation FileLoc, const LangOptions &LangOpts, ^ /opt/rocm/llvm/include/clang/Lex/Lexer.h:155:3: note: candidate constructor not viable: requires 1 argument, but 4 were provided Lexer(const Lexer &) = delete; ^ 1 error generated. CMakeFiles/hipify-clang.dir/build.make:425: recipe for target 'CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o' failed make[2]: [CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o] Error 1 CMakeFiles/Makefile2:164: recipe for target 'CMakeFiles/hipify-clang.dir/all' failed make[1]: [CMakeFiles/hipify-clang.dir/all] Error 2 Makefile:135: recipe for target 'all' failed make: *** [all] Error 2

Could anyone shed light on why it is happening? Do I miss some configurations that HIPIFY cannot recognize clang::Lexer?

Thanks!

Mengchi

emankov commented 3 years ago

Hipify-clang should be built by the vanilla LLVM (https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md#-hipify-clang-building). Rocm releases might differ and miss some headers and libs.

brad-mengchi commented 3 years ago

Thanks @emankov!

Will https://github.com/ROCm-Developer-Tools/llvm-project work? Or I need to clone and build from LLVM official (https://github.com/llvm/llvm-project)?

emankov commented 3 years ago

Thanks @emankov!

Will https://github.com/ROCm-Developer-Tools/llvm-project work? Or I need to clone and build from LLVM official (https://github.com/llvm/llvm-project)?

If you are not going to run hipify-clang unit tests you may use the last LLVM release only for building and running hipify-clang: https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.0. You need to build LLVM from sources only for testing hipify-clang.

emankov commented 3 years ago

Close the issue as answered