Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Frontend][OpenMP] Remove reduction from allowed clauses for target #90754

Merged
merged 4 commits into from
May 30, 2024

Conversation

kparzysz
Copy link
Contributor

@kparzysz kparzysz commented May 1, 2024

The "reduction" clause is not allowed on the "target" construct.

@llvmbot llvmbot added flang:openmp clang:openmp OpenMP related changes to Clang labels May 1, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 1, 2024

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-flang-openmp

Author: Krzysztof Parzyszek (kparzysz)

Changes

The "reduction" clause is not allowed on the "target" construct.


Full diff: https://github.com/llvm/llvm-project/pull/90754.diff

1 Files Affected:

  • (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (-1)
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index e91169e8da1aa5..609df6a4c54aa5 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -682,7 +682,6 @@ def OMP_Target : Directive<"target"> {
     VersionedClause<OMPC_FirstPrivate>,
     VersionedClause<OMPC_IsDevicePtr>,
     VersionedClause<OMPC_HasDeviceAddr, 51>,
-    VersionedClause<OMPC_Reduction>,
     VersionedClause<OMPC_InReduction, 50>,
     VersionedClause<OMPC_Allocate>,
     VersionedClause<OMPC_UsesAllocators, 50>,

@kparzysz
Copy link
Contributor Author

kparzysz commented May 1, 2024

There will be build failures because I haven't changed any tests.

In commit 3f96fe6, Alexey added support for reduction on target, seemingly in response to a change in OpenMP 5.0. The issue is that the 5.0 spec added support for in_reduction, not reduction to target. The reduction clause is not allowed to this day.

Is this some kind of an extension we decided to implement?

@alexey-bataev
Copy link
Member

There will be build failures because I haven't changed any tests.

In commit 3f96fe6, Alexey added support for reduction on target, seemingly in response to a change in OpenMP 5.0. The issue is that the 5.0 spec added support for in_reduction, not reduction to target. The reduction clause is not allowed to this day.

Is this some kind of an extension we decided to implement?

I don't remember already, probably some kind of extension to support combined directives codegen (most probably).

@kparzysz kparzysz requested a review from tblah May 1, 2024 20:20
@mjklemm
Copy link
Contributor

mjklemm commented May 2, 2024

The current for OpenMP 6.0 also does not allow to have reduction at target and from a semantics perspective it does not really make sense. The first nested construct where this makes sense is teams that has multiple entities to aggregate over.

Unless there's a very good need to keep it, I'd vote for removing it to and not extend OpenMP that way.

@kparzysz
Copy link
Contributor Author

kparzysz commented May 2, 2024

Is everybody ok with removing it, and removing the parts of the clang tests that use it?

If not, what else should we do? Having it allowed in the .td file will affect flang too. We could implement isAllowedClauseForDirectiveEx in clang that would keep reduction on target, and defer everything else to the existing isAllowedClauseForDirective.

@kiranchandramohan
Copy link
Contributor

I will vote for removing it if it is not permitted in the standard. But it might be worth asking via an RFC in clang or openmp discourse.

Copy link
Contributor

@mjklemm mjklemm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please update the tests.

@kparzysz
Copy link
Contributor Author

kparzysz commented May 9, 2024

@kparzysz kparzysz force-pushed the users/kparzysz/target-no-reduction branch from 37d3bf0 to 94d7922 Compare May 22, 2024 18:22
@llvmbot llvmbot added the clang Clang issues not falling into any other category label May 22, 2024
@kparzysz kparzysz merged commit eb88e7c into llvm:main May 30, 2024
3 checks passed
@kparzysz kparzysz deleted the users/kparzysz/target-no-reduction branch May 30, 2024 12:57
HendrikHuebner pushed a commit to HendrikHuebner/llvm-project that referenced this pull request Jun 2, 2024
…t` (llvm#90754)

The "reduction" clause is not allowed on the "target" construct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:openmp OpenMP related changes to Clang clang Clang issues not falling into any other category flang:openmp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants