Polygeist icon indicating copy to clipboard operation
Polygeist copied to clipboard

mlir generated by cgeist is not valid to mlir-opt

Open jzhoulon opened this issue 2 years ago • 3 comments

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<?x!llvm.struct<(i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr<struct<()>>, ptr<struct<"struct._IO_FILE", (i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr<struct<"struct._IO_marker", opaque>>, ptr<struct<"struct._IO_FILE">>, i32, i32, i64, i16, i8, array<1 x i8>, ptr, i64, ptr<struct<"struct._IO_codecvt", opaque>>, ptr<struct<"struct._IO_wide_data", opaque>>, ptr<struct<"struct._IO_FILE">>, ptr, i64, i32, array<20 x i8>)>>, i32, i32, i64, i16, i8, array<1 x i8>, ptr, i64, ptr<struct<()>>, ptr<struct<()>>, ptr<struct<"struct._IO_FILE", (i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr<struct<"struct._IO_marker", opaque>>, ptr<struct<"struct._IO_FILE">>, i32, i32, i64, i16, i8, array<1 x i8>, ptr, i64, ptr<struct<"struct._IO_codecvt", opaque>>, ptr<struct<"struct._IO_wide_data", opaque>>, ptr<struct<"struct._IO_FILE">>, 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

jzhoulon avatar Dec 14 '22 05:12 jzhoulon