[flang-commits] [flang] [llvm] [mlir] [flang][OpenMP] Enable tiling (PR #143715)
Jan Leyonberg via flang-commits
flang-commits at lists.llvm.org
Thu Aug 21 18:49:43 PDT 2025
================
@@ -1974,44 +1986,124 @@ bool OmpAttributeVisitor::Pre(const parser::DoConstruct &x) {
return true;
}
+static bool isSizesClause(const parser::OmpClause *clause) {
+ return std::holds_alternative<parser::OmpClause::Sizes>(clause->u);
+}
+
+std::int64_t OmpAttributeVisitor::SetAssociatedMaxClause(
+ llvm::SmallVector<std::int64_t> &levels,
+ llvm::SmallVector<const parser::OmpClause *> &clauses) {
+
+ // Find the tile level to know how much to reduce the level for collapse
+ std::int64_t tileLevel = 0;
+ for (auto [level, clause] : llvm::zip_equal(levels, clauses)) {
+ if (isSizesClause(clause)) {
+ tileLevel = level;
+ }
+ }
+
+ std::int64_t maxLevel = 1;
+ const parser::OmpClause *maxClause = nullptr;
+ for (auto [level, clause] : llvm::zip_equal(levels, clauses)) {
+ if (tileLevel > 0 && tileLevel < level) {
+ context_.Say(clause->source,
+ "The value of the parameter in the COLLAPSE clause must"
+ " not be larger than the number of the number of tiled loops"
+ " because collapse relies on independent loop iterations."_err_en_US);
----------------
jsjodin wrote:
Updating error message.
https://github.com/llvm/llvm-project/pull/143715
More information about the flang-commits
mailing list