Flang OpenMP Support

---
local:
---

This document outlines the OpenMP API features supported by Flang. It is intended as a general reference. For the most accurate information on unimplemented features, rely on the compiler’s TODO or “Not Yet Implemented” messages, which are considered authoritative. Flang provides complete implementation of the OpenMP 3.1 specification and partial implementation of OpenMP 4.0, with continued development efforts aimed at extending full support for the latter. The table below outlines the current status of OpenMP 4.0 feature support. Work is ongoing to add support for OpenMP 4.5 and newer versions; a support statement for these will be shared in the future. The table entries are derived from the information provided in the Version Differences subsection of the Features History section in the OpenMP standard.

The feature support information is provided as a table with three columns that are self explanatory. The Status column uses the letters P, Y, N for the implementation status:

  • P : Partial. When the implementation is incomplete for a few cases
  • Y : Yes. When the implementation is complete
  • N : No. When the implementation is absent

Note : No distinction is made between the support in Parser/Semantics, MLIR, Lowering or the OpenMPIRBuilder.

OpenMP 4.0

FeatureStatusComments
proc_bind clauseY
simd constructPImplicit linearization is skipped if iv is a pointer or allocatable
declare simd constructN
do simd constructPImplicit linearization is skipped if iv is a pointer or allocatable
target data constructY
target constructY
target update constructY
declare target directiveY
teams constructY
distribute constructY
distribute simd constructPImplicit linearization is skipped if iv is a pointer or allocatable
distribute parallel loop constructY
distribute parallel loop simd constructPImplicit linearization is skipped if iv is a pointer or allocatable
depend clauseY
declare reduction constructN
atomic construct extensionsY
cancel constructY
cancellation point constructY
parallel do simd constructPImplicit linearization is skipped if iv is a pointer or allocatable
target teams constructY
teams distribute constructY
teams distribute simd constructPImplicit linearization is skipped if iv is a pointer or allocatable
target teams distribute constructY
teams distribute parallel loop constructY
target teams distribute parallel loop constructY
teams distribute parallel loop simd constructPImplicit linearization is skipped if iv is a pointer or allocatable
target teams distribute parallel loop simd constructPImplicit linearization is completely skipped

Extensions

ATOMIC construct

The implementation of the ATOMIC construct follows OpenMP 6.0 with the following extensions:

  • x = x is an allowed form of ATOMIC UPDATE. This is motivated by the fact that the equivalent forms x = x+0 or x = x*1 are allowed.
  • Explicit type conversions are allowed in ATOMIC READ, WRITE or UPDATE constructs, and in the capture statement in ATOMIC UPDATE CAPTURE. The OpenMP spec requires intrinsic- or pointer-assignments, which include (as per the Fortran standard) implicit type conversions. Since such conversions need to be handled, allowing explicit conversions comes at no extra cost.
  • A literal .true. or .false. is an allowed condition in ATOMIC UPDATE COMPARE. [1]
  • A logical variable is an allowed form of the condition even if its value is not computed within the ATOMIC UPDATE COMPARE construct [1].
  • expr equalop x is an allowed condition in ATOMIC UPDATE COMPARE. [1]

[1] Code generation for ATOMIC UPDATE COMPARE is not implemented yet.