Issue 83329
Summary Execution aborts in OpenMP runtime for wasm target when parallel region is encountered
Labels new issue
Assignees
Reporter mawi2017
    Currently, a parallel region in a wasm OpenMP application causes the following error:

```
Error: failed to run main module `example.wasm`

Caused by:
    0: failed to invoke command default
    1: error while executing at wasm backtrace:
 0: 0xafe73 - <unknown>!__kmp_invoke_microtask
           1: 0x283a4 - <unknown>!__kmp_invoke_task_func
           2: 0x22d00 - <unknown>!__kmp_fork_call
           3: 0x629f - <unknown>!__kmpc_fork_call
           4:  0xca2 - <unknown>!main
 5: 0xb590a - <unknown>!__main_void
           6:  0xbe9 - <unknown>!_start
       note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
    2: wasm trap: indirect call type mismatch
Error: error while executing at wasm backtrace:
    0: 0xafe73 - <unknown>!__kmp_invoke_microtask
    1: 0x283a4 - <unknown>!__kmp_invoke_task_func
```

It seems in [`__kmp_invoke_microtask`](https://github.com/llvm/llvm-project/blob/main/openmp/runtime/src/z_Linux_util.cpp#L2545) of the OpenMP runtime, the corresponding casts for each function call inside the `switch` are missing.  For example, using `((void (*)(int*, int*, void*))(*pkfn))(&gtid, &tid, p_argv[0]);` instead of just `(*pkfn)(&gtid, &tid, p_argv[0]);`.  This was also part of a previous PR [D142593](https://reviews.llvm.org/D142593).

As reproducer any parallel region (even empty) will do.  More comfortable might be using https://github.com/abrown/wasm-openmp-examples/ as it already includes a working Makefile for building and running.  For the llvm-project subfolder just use the latest version.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to