-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[OpenMP] Apply COLLAPSE to innermost leaf that allows it #167565
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
Conversation
As per the wording from 5.2, the COLLAPSE clause applies once to the entire construct. The 6.0 spec has a somewhat similar wording with the same intent. In practice, apply the clause to the innermost leaf constituent that allows it, without requiring it to be the exact innermost leaf.
|
@llvm/pr-subscribers-flang-openmp Author: Krzysztof Parzyszek (kparzysz) ChangesAs per the wording from 5.2, the COLLAPSE clause applies once to the entire construct. The 6.0 spec has a somewhat similar wording with the same intent. In practice, apply the clause to the innermost leaf constituent that allows it, without requiring it to be the exact innermost leaf. Full diff: https://github.com/llvm/llvm-project/pull/167565.diff 1 Files Affected:
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index 3918cecfc1e65..c8eebbf42a68e 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -501,18 +501,7 @@ template <typename C, typename H>
bool ConstructDecompositionT<C, H>::applyClause(
const tomp::clause::CollapseT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *node) {
- // Apply "collapse" to the innermost directive. If it's not one that
- // allows it flag an error.
- if (!leafs.empty()) {
- auto &last = leafs.back();
-
- if (llvm::omp::isAllowedClauseForDirective(last.id, node->id, version)) {
- last.clauses.push_back(node);
- return true;
- }
- }
-
- return false;
+ return applyToInnermost(node);
}
// DEFAULT
|
tblah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no way to test this?
|
This is really a no-op change. I took all the compound names from https://www.openmp.org/wp-content/uploads/OpenMP-API-Compound-Directives-6-0.pdf, deleted all directives that don't contain any of the leaf directives that allow collapse (i.e. distribute, do, for, loop, simd, taskloop). In the remaining set, every directive ended with a leaf that was one of those six. In other words, the "innermost leaf that allows collapse" is always the actual innermost leaf. The reason I made this change is that the failure to apply collapse had its own error code. The error code was that the actual innermost leaf does not allow the clause, which is not really what the spec says about collapse. I changed it to something I already had an error code for and one that makes more sense. |
tblah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for explaining
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/25406 Here is the relevant piece of the build log for the reference |
As per the wording from 5.2, the COLLAPSE clause applies once to the entire construct. The 6.0 spec has a somewhat similar wording with the same intent. In practice, apply the clause to the innermost leaf constituent that allows it, without requiring it to be the exact innermost leaf.
As per the wording from 5.2, the COLLAPSE clause applies once to the entire construct. The 6.0 spec has a somewhat similar wording with the same intent. In practice, apply the clause to the innermost leaf constituent that allows it, without requiring it to be the exact innermost leaf.