[Mlir-commits] [mlir] 962484a - [mlir][sparse] Correcting some terminology / naming-scheme errors.

wren romano llvmlistbot at llvm.org
Thu Mar 30 18:26:42 PDT 2023


Author: wren romano
Date: 2023-03-30T18:26:34-07:00
New Revision: 962484aeca0cc6779899c95d59597f7240ea94ea

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

LOG: [mlir][sparse] Correcting some terminology / naming-scheme errors.

The name "coords" should be used for the complete tuple of Dimension-/Level-many "crd" values associated with a single element.  Whereas the name "coordinates" should only be used for collections of "crd" values which span several elements (e.g., the tensor's coordinates buffer for a single level).

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D147291

Added: 
    

Modified: 
    mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
index e2a2fcc986b8..e9939b153325 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
@@ -420,7 +420,7 @@ static void genInsertBody(OpBuilder &builder, ModuleOp module,
   // Extract fields and coordinates from args.
   SmallVector<Value> fields = llvm::to_vector(args.drop_back(lvlRank + 1));
   MutSparseTensorDescriptor desc(rtp, fields);
-  const SmallVector<Value> coordinates =
+  const SmallVector<Value> coords =
       llvm::to_vector(args.take_back(lvlRank + 1).drop_back());
   Value value = args.back();
   Value parentPos = constantZero(builder, loc, builder.getIndexType());
@@ -436,14 +436,14 @@ static void genInsertBody(OpBuilder &builder, ModuleOp module,
       //   positions[l] = coordinates.size() - 1
       //   <insert @ positions[l] at next level l + 1>
       parentPos =
-          genCompressed(builder, loc, desc, coordinates, value, parentPos, l);
+          genCompressed(builder, loc, desc, coords, value, parentPos, l);
     } else if (isSingletonDLT(dlt)) {
       // Create:
       //   coordinates[l].push_back(coords[l])
       //   positions[l] = positions[l-1]
       //   <insert @ positions[l] at next level l + 1>
       createPushback(builder, loc, desc, SparseTensorFieldKind::CrdMemRef, l,
-                     coordinates[l]);
+                     coords[l]);
     } else {
       assert(isDenseDLT(dlt));
       // Construct the new position as:
@@ -451,7 +451,7 @@ static void genInsertBody(OpBuilder &builder, ModuleOp module,
       //   <insert @ positions[l] at next level l + 1>
       Value size = sizeFromTensorAtLvl(builder, loc, desc, l);
       Value mult = builder.create<arith::MulIOp>(loc, size, parentPos);
-      parentPos = builder.create<arith::AddIOp>(loc, mult, coordinates[l]);
+      parentPos = builder.create<arith::AddIOp>(loc, mult, coords[l]);
     }
   }
   // Reached the actual value append/insert.
@@ -846,7 +846,7 @@ class SparseExpandConverter : public OpConversionPattern<ExpandOp> {
     // All initialization should be done on entry of the loop nest.
     rewriter.setInsertionPointAfter(op.getTensor().getDefiningOp());
     // Determine the size for access expansion (always the innermost stored
-    // dimension size, translated back to original dimension). Note that we
+    // level size, translated back to original dimension). Note that we
     // recursively rewrite the new DimOp on the **original** tensor.
     // FIXME: `toOrigDim` is deprecated.
     const Dimension innerDim = toOrigDim(srcType, srcType.getLvlRank() - 1);


        


More information about the Mlir-commits mailing list