llvm / llvm/llvm-project

[Flang][OpenMP] Support for scope construct

Open
#190,829 0 comments 0 reactions 1 assignee Claimed by @sshrestha-aa View on GitHub
flang:openmp
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Scope construct was introduced in OpenMP 5.1 and is not yet supported in Flang OpenMP. It is a structured block that every thread executes redundantly while also providing a dedicated environment for reductions, private variables, and synchronization.

Example:

```fortran
!$omp parallel private(thread_val)
! Each thread gets a unique value (its ID + 1)
thread_val = omp_get_thread_num() + 1

! The scope construct allows a reduction without a 'do' loop
!$omp scope reduction(+:total_sum)
total_sum = total_sum + thread_val
!$omp end scope

!$omp end parallel
```

Error:
```
llvm-project/flang/lib/Lower/OpenMP/OpenMP.cpp:2719: not yet implemented: Scope construct
LLVM ERROR: aborting
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.