[Bug 50413] New: Polybench mm benchmarks with Polly and Wasm backend lead to runtime error

Skip to first unread message


May 20, 2021, 3:49:18 AMMay 20
to poll...@googlegroups.com
Bug ID 50413
Summary Polybench mm benchmarks with Polly and Wasm backend lead to runtime error
Product Polly
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity enhancement
Priority P
Component Other
Assignee poll...@googlegroups.com
Reporter manuel...@inria.fr
CC llvm...@lists.llvm.org

I am compiling the polybench to WebAssembly using clang. Activating Polly in
this compilation path lead to a runtime error when executing the generated wasm
code for the 2mm, 3mm and gemm benchmarks.

Here is the error, basically the code tries to access memory out of what has
been allocated :

╰─ wasmtime 2mm-wasm_polly 
Error: failed to run main module `2mm-wasm-polly`

Caused by:
    0: failed to invoke command default
    1: wasm trap: out of bounds memory access
       wasm backtrace:
           0:  0x3ec - <unknown>!polybench_alloc_data
           1:  0x491 - <unknown>!main
           2: 0x456a - <unknown>!__main_void
           3: 0x44e2 - <unknown>!__original_main
           4:  0x21a - <unknown>!_start
       note: run with `WASMTIME_BACKTRACE_DETAILS=1` environment variable to
display more information

Note that the error occurs with all the WebAssembly runtimes that we tried.

Maybe the issue is not on the Polly side, but in the WebAssembly backend one. I
didn't found a way to attach this request also to another product so that the
people from the backend could be notified too. Please let me know how to do

Finally, here are some information to reproduce the bug. Please let me know if
I can provide anything else that maybe useful for you to identify what is going

llvm commit : 1fbb484ea45f85740b7450b175096e5fcff6ecd9

compilation command (include and link options omitted) : clang -O3 -mllvm
-polly -2mm.c -DLARGE_DATASET -DPOLYBENCH_TIME --target=wasm32-wasi -o

Thank you for the support,


You are receiving this mail because:
  • You are the assignee for the bug.


Jun 4, 2021, 3:11:11 AMJun 4
to poll...@googlegroups.com
Manuel Selva changed bug 50413
What Removed Added
Assignee poll...@googlegroups.com unassig...@nondot.org
Product Polly libraries
Component Other Backend: WebAssembly
Version unspecified 1.0

Comment # 6 on bug 50413 from Manuel Selva
Hi Michael,

I investigated more on this issue, and I came with the following "minimal"
example that reproduce the problem :

#include <stdlib.h>

#define ni 800
#define nj 900
#define nk 1100

int main() {

  double (*A)[nk] = malloc(sizeof(double[ni][nk]));
  double (*B)[nj] = malloc(sizeof(double[nk][nj]));
  double (*D)[nj] = malloc(sizeof(double[ni][nj]));

  int i, j, k;
  for (i = 0; i < ni; i++) {
    for (j = 0; j < nj; j++){
      for (k = 0; k < nk; ++k)
        D[i][j] += A[i][k] * B[k][j];

  return 0;

I am on LLVM 1fbb484ea45f, and compiling this example (mm.c file) with the
following line leads to a wasm file that I can execute :

`clang-13 -O2 mm.c --sysroot wasi-sysroot --target=wasm32-wasi -o mm-wasm`

Nevertheless, when I add Polly, the resulting wasm file leads to a runtime

`clang-13 -O2 -mllvm -polly mm.c --sysroot wasi-sysroot --target=wasm32-wasi -o

Also I have not been able to get the IR file associated to each one of these 2

Do you mind to try reproducing the issue ?



Reply all
Reply to author
0 new messages