Skip to content
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

Is it possible to take MLIR generated by CUDA-to-CPU flow to the cpu-openmp executable? #406

Open
ericxu233 opened this issue May 5, 2024 · 1 comment

Comments

@ericxu233
Copy link

I want to modify the MLIR generated by --cuda-lower --cpuify and then take it back to the compiler and generate the opemp executable. Is there a way to do that?

I tried the cgeist command like this:

/home/xuhanya1/CUDAtoX/Polygeist/build/bin/cgeist -fopenmp -O2 --function=* -c -O2 -I/home/xuhanya1/CUDAtoX/Polygeist/build/projects/openmp/runtime/src/ -resource-dir=/home/xuhanya1/CUDAtoX/Polygeist/build/lib/clang/18/ -I/home/xuhanya1/CUDAtoX/Polygeist/build/projects/openmp/runtime/src/ -I/usr/local/cuda/include/ --cuda-gpu-arch=sm_75 --cuda-path=/usr/local/cuda/ --polygeist-alternatives-mode=static -std=c++17 -I/home/xuhanya1/CUDAtoX/rodinia/common// -include my_timing.h -include my_verification.h -D_MY_COMPILER_NAME_=\"c7094f0e7bca.polygeist.mincut.inner-serialize=1.raise-scf-to-affine.scal-rep=0\" -DMY_VERIFICATION_DISABLE pathfinder.sme.no-opt.conf1.mlir -o pathfinder.o -I../util -v

However, it seems that it does nothing and the -v output looks like this:

clang version 18.0.0 (https://github.com/llvm/llvm-project.git 26eb4285b56edd8c897642078d91f16ff0fd3472)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/xuhanya1/CUDAtoX/Polygeist/build/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda/, version 12.1
@ivanradanov
Copy link
Collaborator

Sorry for the delay.

Currently there is no way to do that with cgeist, as it expects a c/c++ file. It should be easy to add, however, you can currently use polygeist-opt with --lower-affine, --convert-polygeist-to-llvm and then mlir-translate to convert that to llvm IR, which can then be compiled to an object file using clang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants