<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96698>96698</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[OMPT] Dispatch callback on single-threaded work sharing loops
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rpereira-dev
</td>
</tr>
</table>
<pre>
### The issue
LLVM's OpenMP does not raises the `ompt_callback_dispatch_t` callback when running with a single thread in `static` mode
### Standard
The standard 5.2 specifies
> The `ompt_callback_dispatch_t` type is used for callbacks that are dispatched when a thread begins to execute a section or loop iteration.
### Reproducer
```C
int main(void)
{
# pragma omp parallel for
for (int i = 0 ; i < 128 ; ++i) {}
return 0;
}
```
OMPT tool used
```bash
git clone -b llvm/untied-schedule https://github.com/rpereira-dev/ompt-dump.git
```
Compiled and run as
```
clang -Wall -Werror -Wextra -fopenmp main.c
OMP_NUM_THREADS=1 OMP_TOOL_LIBRARIES=path/to/libompt_dump.so ./a.out
```
Outputs
```
[OMPT] [INFO] ompt_callback_thread_begin
[OMPT] [INFO] ompt_callback_implicit_task
[OMPT] [INFO] ompt_callback_parallel_begin
[OMPT] [INFO] ompt_callback_implicit_task
[OMPT] [INFO] ompt_callback_work
[OMPT] [INFO] ompt_callback_work
[OMPT] [INFO] ompt_callback_sync_region
[OMPT] [INFO] ompt_callback_sync_region_wait
[OMPT] [INFO] ompt_callback_sync_region_wait
[OMPT] [INFO] ompt_callback_sync_region
[OMPT] [INFO] ompt_callback_implicit_task
[OMPT] [INFO] ompt_callback_parallel_end
[OMPT] [INFO] ompt_callback_implicit_task
[OMPT] [INFO] ompt_callback_thread_end
```
### Remark
Any other schedule mode triggers the callback properly (even `schedule(runtime)` and `OMP_SCHEDULE=static`)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VlFvozgQ_jXOyygRmISEBx6a0mgrtZtV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