[Mlir-commits] [mlir] [MLIR][OpenMP] Add omp.simd operation (PR #79843)

Dominik Adamski llvmlistbot at llvm.org
Thu Feb 8 06:06:12 PST 2024


DominikAdamski wrote:

Let me add some points to the discussion:   

**1. Exactness representation of wrapper approach.**
Wrapper approach allows to express the link between OpenMP code and MLIR code.
Code:
```
omp.distribute {
  omp.wsloop (%i ... ) ) {
  }
} 
```
denotes:
```
#pragma omp distribute
for (...)
```
[User is not allowed to specify another pragma after `distribute` construct](https://godbolt.org/z/aWh9v4ccc). That's why we always know what was the intention of the OpenMP user. IMO we don't need to know that given construct is composite or combined at MLIR level. The more important is the user intention. When we introduce `omp.simd` operation to denote that loop body should be executed by SIMD instructions we can clearly differentiate between:
```
#pragma omp parallel
#pragma omp simd
 for (...)
 ```
 and:
 ``` 
 #pragma omp parallel
 #pragma omp for simd
 for (...)
 ```

**2. Upstream definition of `omp.distribute` imply wrapper approach**
Upstream definition of distribute construct [describes `omp.distribute` as wrapper operation similar to `omp.parallel`](https://github.com/llvm/llvm-project/pull/67720) . I think that proposed `omp.simd` operation follows the same pattern.

https://github.com/llvm/llvm-project/pull/79843


More information about the Mlir-commits mailing list