llvm / llvm/Polygeist

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

Open
#406 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
624
Forks
170
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied cgeist command with the MLIR input pathfinder.sme.no-opt.conf1.mlir and inspect its -v output. Trace how the --cuda-lower --cpuify-generated MLIR is expected to re-enter the compiler and how -fopenmp selects the cpu-openmp path. Done means establishing a supported command sequence or documenting that this round trip is not currently supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.