Error when running polymer-opt on full input file translation
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 624
- Forks
- 170
- PR merge metrics
- No merged PRs in 30d
Description
Using this versioning:
- clang and llvm 11
- mlir-clang: e5b8b83312c7a5f6fd94ea1a2cda87e54c4451fd
- polybench-c-4.2.1-beta
- polymer: a7403a9ea584a8de1b3db930e687917cf60b199a
We run into an error.
An example, starting from a home folder that contains polybench-c-4.2.1-beta (kernel function had the 'static' attribute removed), Polygeist, and Polymer.
Running the following:
~/Polygeist/build/bin/mlir-clang ~/polybench-c-4.2.1-beta/linear-algebra/blas/gemm/gemm.c \
-DPOLYBENCH_USE_SCALAR_LB -I ~/Polygeist/llvm-project/clang/lib/Headers \
-I ~/polybench-c-4.2.1-beta/utilities -S --memref-fullrank > gemm.mlir
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/polymer/build/pluto/lib"
~/polymer/build/bin/polymer-opt gemm.mlir -extract-scop-stmt -pluto-opt > gemm-polymer.mlir
Produces this from Polymer:
<unknown>:0: error: 'std.return' op has 0 operands, but enclosing function (@main) returns 1
<unknown>:0: note: see current operation: "std.return"() : () -> ()
When translating only the kernel function with the flag '--kernel-function=kernel_gemm' in mlir-clang, polymer works fine.
However, when trying to translate the entire gemm.c file, we get the above error message.
The error is related to the extracted functions (S0, S1, S2, ...) existing within the main function, but we are unsure as to why.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with polybench-c-4.2.1-beta's gemm.c using the shown mlir-clang and polymer-opt commands, then compare it with --kernel-function=kernel_gemm. Start by examining how the extracted S0, S1, and S2 functions are handled inside @main. Done means full-file translation no longer produces the std.return operand mismatch while the kernel-only case continues to work.
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
- Mostly clear
- Newbie friendliness
- 35/100