llvm / llvm/Polygeist

mlir generated by cgeist is not valid to mlir-opt

Open
#307 3 comments 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

Hi, I tried to convert polybench c to mlir through cgeist and lower to gpu dialect through mlir-opt, however, seems mlir generated by cgeist is invalid to mlir-opt, do you have any inputs? thanks.

error:
:18:73: error: invalid memref element type
llvm.mlir.global external @stderr() {addr_space = 0 : i32} : memref, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr>, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr>, ptr>, i32, i32, i64, i16, i8, array<1 x i8>, ptr, i64, ptr>, ptr>, ptr>, ptr, i64, i32, array<20 x i8>)>>, i32, i32, i64, i16, i8, array<1 x i8>, ptr, i64, ptr>, ptr>, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr>, ptr>, i32, i32, i64, i16, i8, array<1 x i8>, ptr, i64, ptr>, ptr>, ptr>, ptr, i64, i32, array<20 x i8>)>>, ptr, i64, i32, array<20 x i8>)>>

command:
cgeist -S linear-algebra/kernels/3mm/3mm.c -I utilities -I linear-algebra/kernels/atax utilities/polybench.c -I /dev/shm/test/Polygeist/llvm-project/build/lib/clang/16.0.0/include -DPOLYBENCH_TIME --raise-scf-to-affine | polygeist-opt --lower-affine | polygeist-opt --raise-scf-to-affine | mlir-opt --canonicalize -pass-pipeline="func.func(convert-affine-for-to-gpu{gpu-block-dims=1 gpu-thread-dims=0})" --lower-affine --convert-scf-to-cf --split-input-file --gpu-kernel-outlining --pass-pipeline="gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin)" --gpu-to-llvm --lower-host-to-llvm | mlir-translate --mlir-to-llvmir

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 command with linear-algebra/kernels/3mm/3mm.c, utilities/polybench.c, and the listed include paths, then inspect the cgeist output around the stderr global reported at line 18. Compare the generated IR with what mlir-opt accepts; done means the output parses and the shown lowering pipeline proceeds past the invalid memref element type.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.