Skip to content

[Frontend][OpenMP] Apply ompx_attribute to all allowing leaf constructs #100370

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

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

kparzysz
Copy link
Contributor

By default, in a compound directive, a clause will apply to the unique leaf construct that allows it. Clauses that could apply to multiple leaf constructs follow different rules.

For ompx_attribute, apply it to all leaf constructs that allow it.

By default, in a compound directive, a clause will apply to the unique
leaf construct that allows it. Clauses that could apply to multiple leaf
constructs follow different rules.

For ompx_attribute, apply it to all leaf constructs that allow it.
@kparzysz kparzysz requested a review from jdoerfert July 24, 2024 13:11
@llvmbot llvmbot added flang:openmp clang:openmp OpenMP related changes to Clang labels Jul 24, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 24, 2024

@llvm/pr-subscribers-flang-openmp

Author: Krzysztof Parzyszek (kparzysz)

Changes

By default, in a compound directive, a clause will apply to the unique leaf construct that allows it. Clauses that could apply to multiple leaf constructs follow different rules.

For ompx_attribute, apply it to all leaf constructs that allow it.


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

1 Files Affected:

  • (modified) llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h (+10)
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index 3feb4bd11c998..349d862135d8c 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -236,6 +236,9 @@ struct ConstructDecompositionT {
                    const ClauseTy *);
   bool applyClause(const tomp::clause::NowaitT<TypeTy, IdTy, ExprTy> &clause,
                    const ClauseTy *);
+  bool
+  applyClause(const tomp::clause::OmpxAttributeT<TypeTy, IdTy, ExprTy> &clause,
+              const ClauseTy *);
 
   uint32_t version;
   llvm::omp::Directive construct;
@@ -1101,6 +1104,13 @@ bool ConstructDecompositionT<C, H>::applyClause(
   return applyToOutermost(node);
 }
 
+template <typename C, typename H>
+bool ConstructDecompositionT<C, H>::applyClause(
+    const tomp::clause::OmpxAttributeT<TypeTy, IdTy, ExprTy> &clause,
+    const ClauseTy *node) {
+  return applyToAll(node);
+}
+
 template <typename C, typename H> bool ConstructDecompositionT<C, H>::split() {
   bool success = true;
 

@kparzysz
Copy link
Contributor Author

@jdoerfert, you added code for this clause. Does this PR reflect the correct behavior when ompx_attribute is present on a compound construct?

Copy link
Member

@jdoerfert jdoerfert left a comment

Choose a reason for hiding this comment

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

Likely this is the best option. In practice, we used it so far only to attach it to the outermost directive (target) but it should never be a bad idea to attach it to all.

@kparzysz kparzysz merged commit 0891ccc into llvm:main Jul 24, 2024
10 checks passed
@kparzysz kparzysz deleted the attribute branch July 24, 2024 18:22
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…ts (#100370)

Summary:
By default, in a compound directive, a clause will apply to the unique
leaf construct that allows it. Clauses that could apply to multiple leaf
constructs follow different rules.

For ompx_attribute, apply it to all leaf constructs that allow it.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250683
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 flang:openmp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants