[Mlir-commits] [mlir] b8ea299 - Update docs

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Dec 2 13:59:10 PST 2021


Author: Groverkss
Date: 2021-12-03T03:23:19+05:30
New Revision: b8ea2996282dfb92e083db3424325139bc30a546

URL: https://github.com/llvm/llvm-project/commit/b8ea2996282dfb92e083db3424325139bc30a546
DIFF: https://github.com/llvm/llvm-project/commit/b8ea2996282dfb92e083db3424325139bc30a546.diff

LOG: Update docs

Added: 
    

Modified: 
    mlir/lib/Analysis/AffineStructures.cpp
    mlir/unittests/Analysis/AffineStructuresTest.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/AffineStructures.cpp b/mlir/lib/Analysis/AffineStructures.cpp
index d73541321dbc..95abdb1cef81 100644
--- a/mlir/lib/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Analysis/AffineStructures.cpp
@@ -1947,7 +1947,7 @@ void FlatAffineConstraints::mergeLocalIds(FlatAffineConstraints &other) {
   FlatAffineConstraints &fac1 = *this;
   FlatAffineConstraints &fac2 = other;
 
-  // Get divisions representations from each FAC.
+  // Get division representations from each FAC.
   std::vector<SmallVector<int64_t, 8>> divs1, divs2;
   SmallVector<unsigned, 4> denoms1, denoms2;
   fac1.getLocalReprs(divs1, denoms1);
@@ -1970,17 +1970,17 @@ void FlatAffineConstraints::mergeLocalIds(FlatAffineConstraints &other) {
                     initLocals, 0);
   fac2.insertLocalId(0, initLocals);
 
-  // Merge division representation extracted from fac1 and fac2.
+  // Merge division representations extracted from fac1 and fac2.
   divs1.insert(divs1.end(), divs2.begin(), divs2.end());
   denoms1.insert(denoms1.end(), denoms2.begin(), denoms2.end());
 
-  // Find duplicate divisions and merge them.
+  // Find and merge duplicate divisions.
   // TODO: Add division normalization to support divisions that 
diff er by
   // a constant.
   // TODO: Add division ordering such that a division representation for local
   // identifier at position `i` only depends on local identifiers at position <
-  // `i`. This makes sure that all divisions depending on local variables that
-  // can be merged, are merged.
+  // `i`. This makes sure that all divisions depending on other local variables
+  // that can be merged, are merged.
   unsigned localOffset = getIdKindOffset(IdKind::Local);
   for (unsigned i = 0; i < divs1.size(); ++i) {
     // Check if division representations exists `i^th` local id.

diff  --git a/mlir/unittests/Analysis/AffineStructuresTest.cpp b/mlir/unittests/Analysis/AffineStructuresTest.cpp
index f19c18c35811..31174838a892 100644
--- a/mlir/unittests/Analysis/AffineStructuresTest.cpp
+++ b/mlir/unittests/Analysis/AffineStructuresTest.cpp
@@ -828,7 +828,7 @@ TEST(FlatAffineConstraintsTest, mergeDivisionsSimple) {
     // Local space should be same.
     EXPECT_EQ(fac1.getNumLocalIds(), fac2.getNumLocalIds());
 
-    // 1 division matched + 2 unmatched local variables.
+    // 1 division should be matched + 2 unmatched local ids.
     EXPECT_EQ(fac1.getNumLocalIds(), 3u);
     EXPECT_EQ(fac2.getNumLocalIds(), 3u);
   }
@@ -851,7 +851,7 @@ TEST(FlatAffineConstraintsTest, mergeDivisionsSimple) {
     // Local space should be same.
     EXPECT_EQ(fac1.getNumLocalIds(), fac2.getNumLocalIds());
 
-    // 2 divisions matched.
+    // 2 divisions should be matched.
     EXPECT_EQ(fac1.getNumLocalIds(), 2u);
     EXPECT_EQ(fac2.getNumLocalIds(), 2u);
   }
@@ -861,22 +861,22 @@ TEST(FlatAffineConstraintsTest, mergeDivisionsNestedDivsions) {
   {
     // (x) : (exists y = [x / 2], z = [x + y / 3]: y + z >= x).
     FlatAffineConstraints fac1(1);
-    fac1.addLocalFloorDiv({1, 0}, 2);    // y = [x / 2]
-    fac1.addLocalFloorDiv({1, 1, 0}, 3); // z = [x + y / 3]
-    fac1.addInequality({-1, 1, 1, 0});   // y + z >= x
+    fac1.addLocalFloorDiv({1, 0}, 2);    // y = [x / 2].
+    fac1.addLocalFloorDiv({1, 1, 0}, 3); // z = [x + y / 3].
+    fac1.addInequality({-1, 1, 1, 0});   // y + z >= x.
 
     // (x) : (exists y = [x / 2], z = [x + y / 3]: y + z <= x).
     FlatAffineConstraints fac2(1);
-    fac2.addLocalFloorDiv({1, 0}, 2);    // y = [x / 2]
-    fac2.addLocalFloorDiv({1, 1, 0}, 3); // z = [x + y / 3]
-    fac2.addInequality({1, -1, -1, 0});  // y + z <= x
+    fac2.addLocalFloorDiv({1, 0}, 2);    // y = [x / 2].
+    fac2.addLocalFloorDiv({1, 1, 0}, 3); // z = [x + y / 3].
+    fac2.addInequality({1, -1, -1, 0});  // y + z <= x.
 
     fac1.mergeLocalIds(fac2);
 
     // Local space should be same.
     EXPECT_EQ(fac1.getNumLocalIds(), fac2.getNumLocalIds());
 
-    // 2 divisions matched.
+    // 2 divisions should be matched.
     EXPECT_EQ(fac1.getNumLocalIds(), 2u);
     EXPECT_EQ(fac2.getNumLocalIds(), 2u);
   }
@@ -901,7 +901,7 @@ TEST(FlatAffineConstraintsTest, mergeDivisionsNestedDivsions) {
     // Local space should be same.
     EXPECT_EQ(fac1.getNumLocalIds(), fac2.getNumLocalIds());
 
-    // 3 divisions matched.
+    // 3 divisions should be matched.
     EXPECT_EQ(fac1.getNumLocalIds(), 3u);
     EXPECT_EQ(fac2.getNumLocalIds(), 3u);
   }
@@ -926,7 +926,7 @@ TEST(FlatAffineConstraintsTest, mergeDivisionsConstants) {
     // Local space should be same.
     EXPECT_EQ(fac1.getNumLocalIds(), fac2.getNumLocalIds());
 
-    // 2 divisions matched.
+    // 2 divisions should be matched.
     EXPECT_EQ(fac1.getNumLocalIds(), 2u);
     EXPECT_EQ(fac2.getNumLocalIds(), 2u);
   }


        


More information about the Mlir-commits mailing list