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

How to run PolyBench/C benchmarks with polyhedral pluto optimization using Polygeist? #385

Open
arun-thmn opened this issue Feb 1, 2024 · 3 comments

Comments

@arun-thmn
Copy link

Hi,

I'm trying to run PolyBench/C benchmarks with polyhedral pluto optimization using Polygeist, but I cannot succeed.
I used the earlier script at https://github.com/wsmoses/Polygeist-Script/blob/main/polybench-c-4.2.1-beta/run.sh as reference.

I used the options as below and not able to proceed with polymer-opt:
clang -c -O3 ./utilities/polybench.c -o ./utilities/polybench.o -DEXTRALARGE_DATASET -DPOLYBENCH_TIME

clang -I ./utilities/ ./linear-algebra/blas/syr2k/syr2k.c -E -DEXTRALARGE_DATASET -DPOLYBENCH_TIME > ./syr2k.c

cgeist ./syr2k.c -S -o ./syr2k.mlir

polymer-opt -allow-unregistered-dialect -reg2mem -insert-redundant-load -extract-scop-stmt -canonicalize -pluto-opt="dump-clast-after-pluto=syr2k.cloog" -canonicalize ./syr2k.mlir

The error from 'polymer-opt':
./syr2k.mlir:10:73: error: invalid memref element type
llvm.mlir.global external @stderr() {addr_space = 0 : i32} : memref<?x!llvm.struct<(....)>>

It would be helpful, if some guide me with right set of options.

Thanks
Arun T

@wsmoses
Copy link
Member

wsmoses commented Feb 1, 2024 via email

@arun-thmn
Copy link
Author

Hi,
I did a recent clone from main a week back and did followed the instructions to built Polygeist and Polymer with '-DPOLYGEIST_ENABLE_POLYMER=1'
Thanks

@benroywillis
Copy link

Following up on this issue with a study that arrived here independently.

I built Polygeist as an external project in llvm (option 2 from the docs) on Ubuntu 22.04 LTS with gcc 11.4.0 and the following configuration:

~$: cmake -G Ninja ../llvm-project/llvm/ -DLLVM_ENABLE_PROJECTS="mlir;clang;openmp" -DLLVM_EXTERNAL_PROJECTS="polygeist" -DLLVM_EXTERNAL_POLYGEIST_SOURCE_DIR=../ -DLLVM_TARGETS_TO_BUILD="host" -DLLVM_ENABLE_ASSERTIONS=ON -DPOLYGEIST_ENABLE_POLYMER=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$(POLYGEIST_INSTALL)

when compiling the polybench gemm app with the following commands:

$(POLYGEIST_INSTALL)bin/cgeist -march=native -I $(POLYGEIST_INSTALL)lib/clang/18/omp/ -I /home/ben/Builds/PolygeistScripts/polybench-c-4.2.1-beta/utilities/ -D POLYBENCH_TIME -D POLYBENCH_NO_FLUSH_CACHE -D EXTRALARGE_DATASET -S gemm.c -o gemm.polymer.in.mlir
$(POLYGEIST_INSTALL)bin/polymer-opt -reg2mem -insert-redundant-load -extract-scop-stmt -canonicalize -pluto-opt=dump-clast-after-pluto=gemm.polymer.cloog -canonicalize gemm.polymer.in.mlir > gemm.polymer.out.mlir

polymer-opt fails with:
gemm.polymer.in.mlir:9: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, ptr, i32, i32, i64, i16, i8, array<1 x i8>, ptr, i64, ptr, ptr, ptr, ptr, i64, i32, array<20 x i8>)>>

Is there a workaround for this? If not, is this in the pipeline of things to fix?

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

3 participants