Skip to content

Adopt upstream OpenMP flag improvements (approved in llvm#178914)#1332

Open
nicebert wants to merge 4 commits intoamd-stagingfrom
amd/dev/nicebert/adopt-upstream-openmp
Open

Adopt upstream OpenMP flag improvements (approved in llvm#178914)#1332
nicebert wants to merge 4 commits intoamd-stagingfrom
amd/dev/nicebert/adopt-upstream-openmp

Conversation

@nicebert
Copy link

@nicebert nicebert commented Feb 3, 2026

This PR adopts OpenMP flag improvements that have been approved for upstream LLVM (PR llvm#178914) but haven't merged yet.

Changes:

  • Merges nicebert/openmp-complete-series (approved upstream)
  • Replaces ROCm-local implementations with upstream versions
  • Uses improved getLastArg() pattern for proper duplicate handling

Upstream Reference: llvm#178914

Add -fno-openmp-assume-no-thread-state and
-fno-openmp-assume-no-nested-parallelism flags to allow explicit
disabling of these assumptions.

Currently these flags only exist as MarshallingInfoNegativeFlag
which doesn't generate separate OPT_* constants needed for driver
code. Making them standalone flags enables proper last-wins behavior
and allows them to be used in implication logic.
Add a new flag to indicate that the OpenMP runtime can ignore
environment variables during code generation for GPU offload.

This allows the compiler to generate more efficient GPU code by
assuming environment variables won't affect runtime behavior, enabling
optimizations like skipping runtime checks and eliminating conditional
branches. The flag includes both positive and negative variants and
will be used by the -fopenmp-target-fast meta-flag.
Add meta-flag that implies multiple GPU optimization flags:
- -fopenmp-target-ignore-env-vars
- -fopenmp-assume-no-thread-state
- -fopenmp-assume-no-nested-parallelism

The flag is automatically enabled by -Ofast and can be explicitly
disabled with -fno-openmp-target-fast. Individual implied flags can
be selectively overridden while keeping others enabled.
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@z1-cciauto
Copy link
Collaborator

@nicebert nicebert force-pushed the amd/dev/nicebert/adopt-upstream-openmp branch from 376bc55 to e78d11c Compare February 3, 2026 15:27
@z1-cciauto
Copy link
Collaborator

@nicebert nicebert force-pushed the amd/dev/nicebert/adopt-upstream-openmp branch from e78d11c to 7a5975c Compare February 3, 2026 18:20
@z1-cciauto
Copy link
Collaborator

…adopt-upstream-openmp

# Conflicts:
#	clang/include/clang/Options/Options.td
#	clang/lib/Driver/ToolChains/Clang.cpp
#	clang/test/Driver/openmp-target-fast-flag.c
@nicebert nicebert force-pushed the amd/dev/nicebert/adopt-upstream-openmp branch from 7a5975c to 75c250a Compare February 3, 2026 18:48
@z1-cciauto
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants