Files
TheRock/compiler/amd-llvm/flang/docs/OpenACC-extensions.md
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

85 lines
3.8 KiB
Markdown

<!--===- docs/OpenACC-extensions.md
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
See https://llvm.org/LICENSE.txt for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-->
# OpenACC Extensions in Flang
```{contents}
---
local:
---
```
Flang is more lenient than the OpenACC specification requires for purposes of
compatibility. This document describes extensions to the OpenACC specification.
There are a couple of known places where the Flang compiler intentionally deviates
from the standard by being more strict than the specification; these are currently
listed in [OpenACC.md](OpenACC.md).
## Extensions always active
These extensions require no flag.
* The end directive for combined constructs can omit the `loop` keyword.
* An `!$acc routine` with no parallelism clause is treated as if the `seq`
clause were present.
* `!$acc end loop` does not trigger a parsing error and is silently ignored.
* The restriction on required clauses for `!$acc data` is emitted as a
portability warning rather than an error, matching the behavior of other
compilers.
* The `if` clause accepts scalar integer expressions in addition to scalar
logical expressions.
* `!$acc routine` directives can be placed at the top level.
* `!$acc cache` directives accept scalar variables.
* `!$acc cache` directives are accepted outside of a loop construct.
* The `!$acc declare` directive accepts assumed-size array arguments for
`deviceptr` and `present` clauses.
* The OpenACC specification disallows a variable from appearing multiple times
in clauses of `!$acc declare` directives for a function, subroutine, program,
or module, but Flang permits it with a warning when the same clause is used.
* The REDUCTION clause accepts a MINUS "-" operator which is not permitted in
the OpenACC specification. A warning is issued for this use.
## Extensions enabled by default
### `-fopenacc-multiple-names-in-routine` — `!$acc routine(<name>[, <name>]*) <clause-list>`
The `ROUTINE` directive accepts a parenthesized list of more than one name
(e.g. `!$acc routine(foo, bar) seq`). The OpenACC specification permits only a
single name; this extension is equivalent to writing one `ROUTINE` directive
per name, each with identical clauses. A `BIND` clause may not be combined
with multiple names. A warning is emitted for each such directive
(`-Wopenacc-multiple-names-in-routine`; suppress with
`-Wno-openacc-multiple-names-in-routine`). This extension may be disabled with
`-fno-openacc-multiple-names-in-routine`.
## Extensions enabled by flag
### `-fno-openacc-default-none-scalars-strict` — pre-OpenACC-3.2 scalar behavior under `DEFAULT(NONE)`
OpenACC version 3.2 (section 1.16, change 733) clarified that the
`default(none)` clause applies to scalar variables. Prior to version 3.2,
`default(none)` did not impose a data-clause requirement on scalar variables.
By default, Flang enforces the OpenACC 3.2 behavior: scalar variables
referenced inside a `default(none)` compute region without an explicit data
clause produce an error.
When `-fno-openacc-default-none-scalars-strict` is specified, Flang reverts to
the pre-3.2 behavior: scalar variables referenced inside a `default(none)`
compute region without an explicit data clause do not produce an error.
Instead, Flang infers implicit data attributes for those scalars via the same
implicit-copy logic applied in regions without `default(none)`.
Array variables always require an explicit data clause under `default(none)`
regardless of this flag.
When a scalar is implicitly attributed under this extension no warning is
emitted by default; explicit opt-in to the non-standard behavior is treated as
acknowledgement. Use `-Wopenacc-default-none-scalars-strict` to enable
per-use warnings for audit purposes.