<style type="text/css">
  .none { background-color: #FFCCCC }
  .part { background-color: #FFFF99 }
  .good { background-color: #CCFF99 }
</style>
:local:

OpenMP Support

Clang fully supports OpenMP 4.5, almost all of 5.0 and most of 5.1/2. Clang supports offloading to X86_64, AArch64, PPC64[LE], NVIDIA GPUs (all models) and AMD GPUs (all models).

In addition, the LLVM OpenMP runtime libomp supports the OpenMP Tools Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and macOS. OMPT is also supported for NVIDIA and AMD GPUs.

For the list of supported features from OpenMP 5.0 and 5.1 see {ref}OpenMP implementation details <openmp-implementation-details> and {ref}OpenMP 51 implementation details <openmp-51-implementation-details>.

General improvements

  • New collapse clause scheme to avoid expensive remainder operations. Compute loop index variables after collapsing a loop nest via the collapse clause by replacing the expensive remainder operation with multiplications and additions.
  • When using the collapse clause on a loop nest the default behavior is to automatically extend the representation of the loop counter to 64 bits for the cases where the sizes of the collapsed loops are not known at compile time. To prevent this conservative choice and use at most 32 bits, compile your program with the -fopenmp-optimistic-collapse.

GPU devices support

Data-sharing modes

Clang supports two data-sharing models for Cuda devices: Generic and Cuda modes. The default mode is Generic. Cuda mode can give an additional performance and can be activated using the -fopenmp-cuda-mode flag. In Generic mode all local variables that can be shared in the parallel regions are stored in the global memory. In Cuda mode local variables are not shared between the threads and it is user responsibility to share the required data between the threads in the parallel regions. Often, the optimizer is able to reduce the cost of Generic mode to the level of Cuda mode, but the flag, as well as other assumption flags, can be used for tuning.

Features not supported or with limited support for Cuda devices

  • Cancellation constructs are not supported.
  • Doacross loop nest is not supported.
  • User-defined reductions are supported only for trivial types.
  • Nested parallelism: inner parallel regions are executed sequentially.
  • Debug information for OpenMP target regions is supported, but sometimes it may be required to manually specify the address class of the inspected variables. In some cases the local variables are actually allocated in the global memory, but the debug info may be not aware of it.

(openmp-implementation-details)=

OpenMP 5.0 Implementation Details

The following table provides a quick overview over various OpenMP 5.0 features and their implementation status. Please post on the Discourse forums (Runtimes - OpenMP category) for more information or if you want to help with the implementation.

CategoryFeatureStatusReviews
loopsupport != in the canonical loop form{good}doneD54441
loop#pragma omp loop (directive){part}partialD145823 (combined forms)
loop#pragma omp loop bind{part}worked onD144634 (needs review)
loopcollapse imperfectly nested loop{good}done
loopcollapse non-rectangular nested loop{good}done
loopC++ range-base for loop{good}done
loopclause: if for SIMD directives{good}done
loopinclusive scan (matching C++17 PSTL){good}done
memory managementmemory allocators{good}doner341687,r357929
memory managementallocate directive and allocate clause{good}doner355614,r335952
OMPDOMPD interfaces{good}doneD99914 (Supports only HOST(CPU) and Linux
OMPTOMPT interfaces (callback support){good}done
thread affinitythread affinity{good}done
tasktaskloop reduction{good}done
tasktask affinity{part}not upstreamhttps://github.com/jklinkenberg/openmp/tree/task-affinity
taskclause: depend on the taskwait construct{good}doneD113540 (regular codegen only)
taskdepend objects and detachable tasks{good}done
taskmutexinoutset dependence-type for tasks{good}doneD53380,D57576
taskcombined taskloop constructs{good}done
taskmaster taskloop{good}done
taskparallel master taskloop{good}done
taskmaster taskloop simd{good}done
taskparallel master taskloop simd{good}done
SIMDatomic and simd constructs inside SIMD code{good}done
SIMDSIMD nontemporal{good}done
deviceinfer target functions from initializers{part}worked on
deviceinfer target variables from initializers{good}doneD146418
deviceOMP_TARGET_OFFLOAD environment variable{good}doneD50522
devicesupport full ‘defaultmap’ functionality{good}doneD69204
devicedevice specific functions{good}done
deviceclause: device_type{good}done
deviceclause: extended device{good}done
deviceclause: uses_allocators clause{good}donePR157025
deviceclause: in_reduction{part}worked onr308768
deviceomp_get_device_num(){good}doneD54342,D128347
devicestructure mapping of references{none}unclaimed
devicenested target declare{good}doneD51378
deviceimplicitly map ‘this’ (this[:1]){good}doneD55982
deviceallow access to the reference count (omp_target_is_present){good}done
devicerequires directive{good}done
deviceclause: unified_shared_memory{good}doneD52625,D52359
deviceclause: unified_address{part}partial
deviceclause: reverse_offload{part}partialD52780,D155003
deviceclause: atomic_default_mem_order{good}doneD53513
deviceclause: dynamic_allocators{part}unclaimed partsD53079
deviceuser-defined mappers{good}doneD56326,D58638,D58523,D58074,D60972,D59474
devicemap array-section with implicit mapper{good}donePR101101
devicemapping lambda expression{good}doneD51107
deviceclause: use_device_addr for target data{good}done
devicesupport close modifier on map clause{good}doneD55719,D55892
deviceteams construct on the host device{good}doner371553
devicesupport non-contiguous array sections for target update{good}donePR144635
devicepointer attachment{part}being repaired@abhinavgaba (PR153683)
atomichints for the atomic construct{good}doneD51233
base languageC11 support{good}done
base languageC++11/14/17 support{good}done
base languagelambda support{good}done
miscarray shaping{good}doneD74144
misclibrary shutdown (omp_pause_resource[_all]){good}doneD55078
miscmetadirectives{part}mostly doneD91944, PR128640
miscconditional modifier for lastprivate clause{good}done
misciterator and multidependences{good}done
miscdepobj directive and depobj dependency kind{good}done
miscuser-defined function variants{good}done.D67294, D64095, D71847, D71830, D109635
miscpointer/reference to pointer based array reductions{good}done
miscprevent new type definitions in clauses{good}done
memory modelmemory model update (seq_cst, acq_rel, release, acquire,...){good}done

(openmp-51-implementation-details)=

OpenMP 5.1 Implementation Details

The following table provides a quick overview over various OpenMP 5.1 features and their implementation status. Please post on the Discourse forums (Runtimes - OpenMP category) for more information or if you want to help with the implementation.

CategoryFeatureStatusReviews
atomic‘compare’ clause on atomic construct{good}doneD120290, D120007, D118632, D120200, D116261, D118547, D116637
atomic‘fail’ clause on atomic construct{part}worked onD123235 (in progress)
base languageC++ attribute specifier syntax{good}doneD105648
device‘present’ map type modifier{good}doneD83061, D83062, D84422
device‘present’ motion modifier{good}doneD84711, D84712
device‘present’ in defaultmap clause{good}doneD92427
devicemap clause reordering based on ‘present’ modifier{none}unclaimed
devicedevice-specific environment variables{none}unclaimed
deviceomp_target_is_accessible routine{good}donePR138294
deviceomp_get_mapped_ptr routine{good}doneD141545
devicenew async target memory copy routines{good}doneD136103
devicethread_limit clause on target construct{part}partialD141540 (offload), D152054 (host, in progress)
devicehas_device_addr clause on target construct{none}unclaimed
deviceuse_device_ptr/addr preserve host address when lookup fails{good}donePR174659
deviceiterators in map clause or motion clauses{good}donePR159112
deviceindirect clause on declare target directive{part}In Progress
deviceallow virtual functions calls for mapped object on device{part}partial
deviceinterop construct{part}partialparsing/sema done: D98558, D98834, D98815
deviceassorted routines for querying interoperable properties{part}partialD106674
loopLoop tiling transformation{good}doneD76342
loopLoop unrolling transformation{good}doneD99459
loop‘reproducible’/‘unconstrained’ modifiers in ‘order’ clause{part}partialD127855
memory managementalignment for allocate directive and clause{good}doneD115683
memory management‘allocator’ modifier for allocate clause{good}donePR114883
memory management‘align’ modifier for allocate clause{good}donePR121814
memory managementnew memory management routines{none}unclaimed
memory managementchanges to omp_alloctrait_key enum{none}unclaimed
memory modelseq_cst clause on flush construct{good}donePR114072
misc‘omp_all_memory’ keyword and use in ‘depend’ clause{good}doneD125828, D126321
miscerror directive{good}doneD139166
miscscope construct{good}doneD157933, PR109197
miscroutines for controlling and querying team regions{part}partialD95003 (libomp only)
miscomp_display_env routine{good}doneD74956
miscextended OMP_PLACES syntax{none}unclaimed
miscOMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT env vars{good}doneD138769
misc‘target_device’ selector in context specifier{part}worked on
miscbegin/end declare variant{good}doneD71179
miscdispatch construct and function variant argument adjustment{part}worked onD99537, D99679
miscassumes directives{part}worked on
miscassume directive{good}done
miscnothing directive{good}doneD123286
miscmasked construct and related combined constructs{good}doneD99995, D100514, PR121741 (parallel_masked_taskloop) PR121746 (parallel_masked_task_loop_simd), PR121914 (masked_taskloop) PR121916 (masked_taskloop_simd)
miscdefault(firstprivate) & default(private){good}doneD75591 (firstprivate), D125912 (private)
otherdeprecating master construct{none}unclaimed
OMPTchanges to ompt_scope_endpoint_t enum{good}doneD90752
OMPTnew barrier types added to ompt_sync_region_t enum{good}doneD90752
OMPTasync data transfers added to ompt_target_data_op_t enum{good}doneD90752
OMPTnew barrier state values added to ompt_state_t enum{good}doneD90752
OMPTnew ‘emi’ callbacks for external monitoring interfaces{good}done
OMPTdevice tracing interface{part}in progressjplehr
task‘strict’ modifier for taskloop construct{none}unclaimed
taskinoutset in depend clause{good}doneD97085, D118383
tasknowait clause on taskwait{part}partialparsing/sema done: D131830, D141531

(openmp-5-2-implementation-details)=

OpenMP 5.2 Implementation Details

The following table provides a quick overview of various OpenMP 5.2 features and their implementation status. Please post on the Discourse forums (Runtimes - OpenMP category) for more information or if you want to help with the implementation.

FeatureC/C++ StatusFortran StatusReviews
omp_in_explicit_task(){none}unclaimed{none}unclaimed
semantics of explicit_task_var and implicit_task_var{none}unclaimed{none}unclaimed
ompx sentinel for C/C++ directive extensions{none}unclaimed{none}unclaimed
ompx prefix for clause extensions{none}unclaimed{none}unclaimed
if clause on teams construct{none}unclaimed{none}unclaimed
step modifier added{none}unclaimed{none}unclaimed
declare mapper: Add iterator modifier on map clause{none}unclaimed{none}unclaimed
declare mapper: Add iterator modifier on map clause{none}unclaimed{none}unclaimed
memspace and traits modifiers to uses allocator i{none}unclaimed{none}unclaimed
Add otherwise clause to metadirectives{none}unclaimed{none}unclaimed
doacross clause with support for omp_cur_iteration{none}unclaimed{none}unclaimed
position of interop_type in init clause on iterop{none}unclaimed{none}unclaimed
implicit map type for target enter/exit data{none}unclaimed{none}unclaimed
work OMPT type for work-sharing loop constructs{good}done{good}donePR189347, PR97429
extend ompt_dispatch_t for new enum values{good}done{good}doneD122107
allocate and firstprivate on scope directive{none}unclaimed{none}unclaimed
Change loop consistency for order clause{none}unclaimed{none}unclaimed
Add memspace and traits modifiers to uses_allocators{none}unclaimed{none}unclaimed
Keep original base pointer on map w/o matched candidate{none}unclaimed{none}unclaimed
Pure procedure support for certain directives{none}N/A{none}unclaimed
ALLOCATE statement support for allocators{none}N/A{none}unclaimed
dispatch construct extension to support end directive{none}N/A{none}unclaimed

(openmp-5-2-deprecations)=

OpenMP 5.2 Deprecations

C/C++ StatusFortran StatusReviews
Linear clause syntax{none}unclaimed{none}unclaimed
The minus operator{none}unclaimed{none}unclaimed
Map clause modifiers without commas{none}unclaimed{none}unclaimed
The use of allocate directives with ALLOCATE statement{good}N/A{none}unclaimed
uses_allocators list syntax{none}unclaimed{none}unclaimed
The default clause on metadirectives{none}unclaimed{none}unclaimed
The delimited form of the declare target directive{none}unclaimed{good}N/A
The use of the to clause on the declare target directive{none}unclaimed{none}unclaimed
The syntax of the destroy clause on the depobj construct{none}unclaimed{none}unclaimed
keyword source and sink as task-dependence modifiers{none}unclaimed{none}unclaimed
interop types in any position on init clause of interop{none}unclaimed{none}unclaimed
ompd prefix usage for some ICVs{none}unclaimed{none}unclaimed

(openmp-6-0-implementation-details)=

OpenMP 6.0 Implementation Details

The following table provides a quick overview of various OpenMP 6.0 features and their implementation status. Please post on the Discourse forums (Runtimes - OpenMP category) for more information or if you want to help with the implementation.

FeatureC/C++ StatusFortran StatusReviews
free-agent threads{none}unclaimed{none}unclaimed
threadset clause{part}partial{none}unclaimedParse/Sema/Codegen: PR13580
Recording of task graphs{part}in progress{part}in progressclang: jtb20, flang: kparzysz
Parallel inductions{none}unclaimed{none}unclaimed
init_complete for scan directive{none}unclaimed{none}unclaimed
loop interchange transformation{good}done{none}unclaimedClang (interchange): PR93022 Clang (permutation): PR92030
loop reverse transformation{good}done{none}unclaimedPR92916
loop stripe transformation{good}done{none}unclaimedPR119891
loop fusion transformation{part}in progress{good}donePR139293 PR161213 PR168898
loop index set splitting transformation with count clause{part}in progress{none}unclaimed@amitamd7
loop transformation apply clause{none}unclaimed{none}unclaimed
loop fuse transformation{good}done{none}unclaimed
workdistribute construct{none}in progress@skc7, @mjklemm
task_iteration{none}unclaimed{none}unclaimed
memscope clause for atomic and flush{none}unclaimed{none}unclaimed
transparent clause (hull tasks){part}partial{none}unclaimedClang parsing/sema PR174646
rule-based compound directives{part}In Progress{part}In Progresskparzysz Testing for Fortran missing
C23, C++23{none}unclaimed
Fortran 2023{none}unclaimed
decl attribute for declarative directives{none}unclaimed{none}unclaimed
C attribute syntax{none}unclaimed
pure directives in DO CONCURRENT{none}unclaimed
Optional argument for all clauses{part}partial{part}In ProgressParse/Sema (nowait): PR159628
Function references for locator list items{none}unclaimed{none}unclaimed
All clauses accept directive name modifier{none}unclaimed{none}unclaimed
Extensions to depobj construct{none}unclaimed{none}unclaimed
Extensions to atomic construct{none}unclaimed{none}unclaimed
Private reductions{part}mostly{none}unclaimedParse/Sema: PR129938 Codegen: PR134709
Self maps{part}partial{none}unclaimedparsing/sema done: PR129888
Release map type for declare mapper{none}unclaimed{none}unclaimed
Extensions to interop construct{none}unclaimed{none}unclaimed
no_openmp_constructs{good}done{none}unclaimedPR125933
safe_sync and progress with identifier and API{none}unclaimed{none}unclaimed
OpenMP directives in concurrent loop regions{good}done{none}unclaimedPR125621
atomics constructs on concurrent loop regions{good}done{none}unclaimedPR125621
Loop construct with DO CONCURRENT{part}In Progress
device_type clause for target construct{none}unclaimed{none}unclaimed
nowait for ancestor target directives{none}unclaimed{none}unclaimed
New API for devices' num_teams/thread_limit{none}unclaimed{none}unclaimed
Host and device environment variables{part}in progress{none}unclaimed@amitamd7
num_threads ICV and clause accepts list{none}unclaimed{none}unclaimed
Numeric names for environment variables{none}unclaimed{none}unclaimed
Increment between places for OMP_PLACES{none}unclaimed{none}unclaimed
OMP_AVAILABLE_DEVICES envirable{none}unclaimed{none}unclaimed(should wait for “Traits for default device envirable” being done)
Traits for default device envirable{part}in progress{none}unclaimedro-i
Optionally omit array length expression{good}done{none}unclaimed(Parse) PR148048, (Sema) PR152786
Canonical loop sequences{part}in progress{part}in progressClang: PR139293
Clarifications to Fortran map semantics{none}unclaimed{none}unclaimed
default clause at target construct{good}done{none}unclaimedPR162910
ref count update use_device_{ptr, addr}{none}unclaimed{none}unclaimed
Clarifications to implicit reductions{none}unclaimed{none}unclaimed
ref modifier for map clauses{part}In Progress{none}unclaimed
map-type modifiers in arbitrary position{good}done{none}unclaimedPR90499
Lift nesting restriction on concurrent loop{good}done{none}unclaimedPR125621
priority clause for target constructs{none}unclaimed{none}unclaimed
changes to target_data construct{none}unclaimed{none}unclaimed
Non-const do_not_sync for nowait/nogroup{none}unclaimed{none}unclaimed
need_device_addr modifier for adjust_args clause{part}partial{none}unclaimedParsing/Sema: PR143442 PR149586
need_device_ptr modifier for adjust_args clause{none}unclaimed{none}unclaimed
Prescriptive num_threads{good}done{none}unclaimedPR160659 PR146403 PR146404 PR146405
Message and severity clauses{good}done{none}unclaimedPR146093
Local clause on declare target{good}done{none}unclaimedclang Parse/Sema: PR186281 clang Codegen: PR196431
groupprivate directive{part}In Progress{part}partialFlang: kparzysz, mjklemm Flang parser: PR153807 Flang sema: PR154779 Clang parse/sema: PR158134
variable-category on default clause{good}done{none}unclaimed
Changes to omp_target_is_accessible{part}In Progress{part}In Progress
defaultmap implicit-behavior ‘storage’{good}done{none}unclaimedPR158336
defaultmap implicit-behavior ‘private’{good}done{none}unclaimedPR158712
OMPT: ompt_get_buffer_limits entry point{part}partial{good}N/ADefinition: PR195829
OMPT: ompt_any_record_ompt_t for device tracing{good}done{good}N/APR195829
OMPT: ompt_target_data_transfer_rect(_async) & subvolume{part}partial{good}N/AEnum: PR195829
OMPT: ompt_target_data_transfer(_async){part}partial{good}N/AEnum: PR195829
OMPT: ompt_target_data_memset(_async){part}partial{good}N/AEnum: PR195829 Callbacks: PR194168
OMPT: workdistribute work callback enum{part}partial{good}N/AEnum: PR195829
OMPT: transparent task flag enum (importing/exporting){part}partial{good}N/AEnum: PR195829
OMPT: dependence type {out, inout}_all_memory{part}partial{good}N/AEnum: PR195829
OMPT: removed master callback{none}unclaimed{good}N/A
OMPT: removed sync_region_barrier(_implicit) enum value{none}unclaimed{good}N/A

(openmp-6-0-deprecations)=

OpenMP 6.0 Deprecations

C/C++ StatusFortran StatusReviews
OMPT: non-emi target callbacks{none}unclaimed{good}N/A
OMPT: transfer_to_device / transfer_from_device enums{none}unclaimed{good}N/A

(openmp-6-1-implementation-details)=

OpenMP 6.1 Implementation Details (Experimental)

The following table provides a quick overview over various OpenMP 6.1 features and their implementation status. Since OpenMP 6.1 has not yet been released, the following features are experimental and are subject to change at any time. Please post on the Discourse forums (Runtimes - OpenMP category) for more information or if you want to help with the implementation.

FeatureC/C++ StatusFortran StatusReviews
dyn_groupprivate clause{part}partial{part}In ProgressC/C++: Host device support missing
loop flatten transformation{none}unclaimed{none}unclaimed
loop grid/tile modifiers for sizes clause{none}unclaimed{none}unclaimed
attach map-type modifier{part}In Progress{none}unclaimedC/C++: @abhinavgaba; RT: @abhinavgaba (PR149036, PR158370)
need_device_ptr modifier for adjust_args clause{part}partial{none}unclaimedClang Parsing/Sema: PR168905 PR169558
fallback modifier for use_device_ptr clause{good}done{none}unclaimedClang: @abhinavgaba (PR170578, PR173931) RT: @abhinavgaba (PR169603)
dims modifier for num_teams, thread_limit, and num_threads clauses{part}partial{part}In ProgressC/C++: @kevinsala ([PR206412]); Fortran: @skc7, @kparzysz, @mjklemm

OpenMP Extensions

The following table provides a quick overview over various OpenMP extensions and their implementation status. These extensions are not currently defined by any standard, so links to associated LLVM documentation are provided. As these extensions mature, they will be considered for standardization. Please post on the Discourse forums (Runtimes - OpenMP category) to provide feedback.

CategoryFeatureStatusReviews
atomic extension‘atomic’ strictly nested within ‘teams’{part}prototypedD126323
device extension‘ompx_hold’ map type modifier{part}prototypedD106509, D106510
device extension‘ompx_bare’ clause on ‘target teams’ construct{part}prototypedPR66844, PR70612
device extensionMulti-dim ‘num_teams’ and ‘thread_limit’ clause on ‘target teams ompx_bare’ construct{part}partialPR99732, PR101407, PR102715