<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/130926>130926</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Clang][OpenMP] Implement Taskgraph support from the OpenMP 6.0 specification
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:openmp,
            openmp:libomp
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            jpinot
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jpinot
      </td>
    </tr>
</table>

<pre>
    OpenMP 6.0 introduces the [taskgraph](https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-6-0.pdf#section.14.3) construct, allowing tasks to be recorded and replayed within a specified region. Currently, OpenMP already supports a [record/replay](https://github.com/llvm/llvm-project/commit/36d4e4c9b5f6cd0577b6029055b825caaec2dd11) mechanism through runtime methods.

For example:
```cpp
#pragma omp taskgraph graph_id(1) graph_reset(false)
{
  for (int i = 0; i < NUM_TASKS; i++) {
    #pragma omp task
    fn();
  }
}
```

To fully support the taskgraph construct in Clang, the OpenMP runtime library must be extended to handle the new clauses defined in the 6.0 specification—namely `graph_id`, `graph_reset`, `if`, and `nogroup`—and to adopt the [`saved`](https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-6-0.pdf#section.7.2) modifier for the [`firstprivate`](https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-6-0.pdf#subsection.7.5.4) clause. Additionally, [`replayable`](https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-6-0.pdf#section.14.6) clause should be added to enable complete Taskgraph functionality in accordance with OpenMP 6.0.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8VU2P4ygQ_TXkUopF8Efsgw9JZyONVrM7UveeRxjKNrMYEODO5N-vsPPR0uxlLi1ZCRR21auq9woeghoMYkvKI2Hsh1PGRsIYKU8bPsfR-na1bTorr-3fDs3Xb1BlFJSJ3spZYIA4IpDyGHn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