[Mlir-commits] [mlir] Changed the phrase sparse-compiler to sparsifier in comments (PR #71578)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Nov 7 11:34:38 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-sparse

Author: Tim Harvey (TimAtGoogle)

<details>
<summary>Changes</summary>

When the Powers That Be decided that the name "sparse compiler" should be changed to "sparsifier", we negected to change some of the comments in the code; this pull request completes the name change.

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


15 Files Affected:

- (modified) mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp (+1-1) 
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/BufferizableOpInterfaceImpl.cpp (+1-1) 
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp (+3-3) 
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorDescriptor.cpp (+1-1) 
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp (+2-2) 
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp (+8-8) 
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp (+5-5) 
- (modified) mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp (+2-2) 
- (modified) mlir/test/Dialect/SparseTensor/one_shot_bufferize_invalid.mlir (+1-1) 
- (modified) mlir/test/Dialect/SparseTensor/rejected.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_quantized_matmul.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions_min.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_storage.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/python/tools/sparse_compiler.py (+2-2) 


``````````diff
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
index 32d38a21e4e00f4..d5b8c6c16c8589a 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
@@ -1816,7 +1816,7 @@ struct RemoveOutsDependency : public OpRewritePattern<GenericOp> {
         if (!operandType)
           continue;
 
-        // If outs is sparse, leave it to the sparse compiler.
+        // If outs is sparse, leave it to the sparsifier.
         if (sparse_tensor::getSparseTensorEncoding(operandVal.getType()))
           continue;
 
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/BufferizableOpInterfaceImpl.cpp
index d54cd9ad8cdbe7a..3f4ae1f67de1502 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -32,7 +32,7 @@ struct SparseBufferizableOpInterfaceExternalModel
   LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
                           const BufferizationOptions &options) const {
     return op->emitError(
-        "sparse_tensor ops must be bufferized with the sparse compiler");
+        "sparse_tensor ops must be bufferized with the sparsifier");
   }
 };
 
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
index 9c836c16dab2b7c..7f32dd1449076ff 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This is a prototype GPU codegenerator for the sparse compiler.
+// This is a prototype GPU codegenerator for the sparsifier.
 // The objective is to eventually use the right combination of
 // direct code generation and libary calls into vendor-specific
 // highly optimized sparse libraries (e.g. cuSparse for CUDA).
@@ -1227,7 +1227,7 @@ rewriteSDDMM(PatternRewriter &rewriter, linalg::GenericOp op, bool enableRT,
 //===----------------------------------------------------------------------===//
 
 /// Proof-of-concept rewriter. This rule generates a GPU implementation
-/// for each outermost forall loop generated by the sparse compiler.
+/// for each outermost forall loop generated by the sparsifier.
 /// TODO: right now works with parallelization-strategy=dense-outer-loop
 ///       but give this its own flags in the future
 struct ForallRewriter : public OpRewritePattern<scf::ParallelOp> {
@@ -1239,7 +1239,7 @@ struct ForallRewriter : public OpRewritePattern<scf::ParallelOp> {
   LogicalResult matchAndRewrite(scf::ParallelOp forallOp,
                                 PatternRewriter &rewriter) const override {
     // Reject inadmissible loop form.
-    // Essentially only accept a loop, generated by the sparse compiler,
+    // Essentially only accept a loop, generated by the sparsifier,
     // of the form
     //   forall (i = 0; i < N; i++)
     // so that cyclic scheduling over the threads is easy.
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorDescriptor.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorDescriptor.cpp
index 455538954ab8f42..879a753bef1c9fe 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorDescriptor.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorDescriptor.cpp
@@ -65,7 +65,7 @@ SparseTensorTypeToBufferConverter::SparseTensorTypeToBufferConverter() {
     if (!getSparseTensorEncoding(tp))
       // Not a sparse tensor.
       return std::nullopt;
-    // Sparse compiler knows how to cancel out these casts.
+    // Sparsifier knows how to cancel out these casts.
     return genTuple(builder, loc, tp, inputs);
   });
 }
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
index c541a5d27e93860..811bdc57ce14fb6 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
@@ -393,8 +393,8 @@ struct FuseTensorCast : public OpRewritePattern<tensor::CastOp> {
 };
 
 /// Rewrites a sequence of operations for sparse tensor selections in to
-/// semi-ring operations such that they can be compiled correctly by the sparse
-/// compiler. E.g., transforming the following sequence
+/// semi-ring operations such that they can be compiled correctly by the
+/// sparsifier. E.g., transforming the following sequence
 ///
 /// %sel = arith.select %cond, %sp1, %sp2
 ///
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
index 93ee0647b7b5a6b..561c4e251146023 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// A pass that converts loops generated by the sparse compiler into a form that
+// A pass that converts loops generated by the sparsifier into a form that
 // can exploit SIMD instructions of the target architecture. Note that this pass
-// ensures the sparse compiler can generate efficient SIMD (including ArmSVE
+// ensures the sparsifier can generate efficient SIMD (including ArmSVE
 // support) with proper separation of concerns as far as sparsification and
 // vectorization is concerned. However, this pass is not the final abstraction
 // level we want, and not the general vectorizer we want either. It forms a good
@@ -105,7 +105,7 @@ static Value genVectorInvariantValue(PatternRewriter &rewriter, VL vl,
 
 /// Generates a vectorized load lhs = a[ind[lo:hi]] or lhs = a[lo:hi],
 /// where 'lo' denotes the current index and 'hi = lo + vl - 1'. Note
-/// that the sparse compiler can only generate indirect loads in
+/// that the sparsifier can only generate indirect loads in
 /// the last index, i.e. back().
 static Value genVectorLoad(PatternRewriter &rewriter, Location loc, VL vl,
                            Value mem, ArrayRef<Value> idxs, Value vmask) {
@@ -124,7 +124,7 @@ static Value genVectorLoad(PatternRewriter &rewriter, Location loc, VL vl,
 
 /// Generates a vectorized store a[ind[lo:hi]] = rhs or a[lo:hi] = rhs
 /// where 'lo' denotes the current index and 'hi = lo + vl - 1'. Note
-/// that the sparse compiler can only generate indirect stores in
+/// that the sparsifier can only generate indirect stores in
 /// the last index, i.e. back().
 static void genVectorStore(PatternRewriter &rewriter, Location loc, Value mem,
                            ArrayRef<Value> idxs, Value vmask, Value rhs) {
@@ -219,8 +219,8 @@ static Value genVectorReducInit(PatternRewriter &rewriter, Location loc,
 /// The first call (!codegen) does the analysis. Then, on success, the second
 /// call (codegen) yields the proper vector form in the output parameter
 /// vector 'idxs'. This mechanism ensures that analysis and rewriting code
-/// stay in sync. Note that the analyis part is simple because the sparse
-/// compiler only generates relatively simple subscript expressions.
+/// stay in sync. Note that the analyis part is simple because the sparsifier
+/// only generates relatively simple subscript expressions.
 ///
 /// See https://llvm.org/docs/GetElementPtr.html for some background on
 /// the complications described below.
@@ -359,7 +359,7 @@ static bool vectorizeSubscripts(PatternRewriter &rewriter, scf::ForOp forOp,
 /// The first call (!codegen) does the analysis. Then, on success, the second
 /// call (codegen) yields the proper vector form in the output parameter 'vexp'.
 /// This mechanism ensures that analysis and rewriting code stay in sync. Note
-/// that the analyis part is simple because the sparse compiler only generates
+/// that the analyis part is simple because the sparsifier only generates
 /// relatively simple expressions inside the for-loops.
 static bool vectorizeExpr(PatternRewriter &rewriter, scf::ForOp forOp, VL vl,
                           Value exp, bool codegen, Value vmask, Value &vexp) {
@@ -616,7 +616,7 @@ struct ForOpRewriter : public OpRewritePattern<scf::ForOp> {
   LogicalResult matchAndRewrite(scf::ForOp op,
                                 PatternRewriter &rewriter) const override {
     // Check for single block, unit-stride for-loop that is generated by
-    // sparse compiler, which means no data dependence analysis is required,
+    // sparsifier, which means no data dependence analysis is required,
     // and its loop-body is very restricted in form.
     if (!op.getRegion().hasOneBlock() || !isConstantIntValue(op.getStep(), 1) ||
         !op->hasAttr(LoopEmitter::getLoopEmitterLoopAttrName()))
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
index ede4d38bb281277..85d6a6ddabf9eb6 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
@@ -124,7 +124,7 @@ struct AffineDimCollector : public AffineExprVisitor<AffineDimCollector> {
 } // namespace
 
 //===----------------------------------------------------------------------===//
-// Sparse compiler analysis methods.
+// Sparsifier analysis methods.
 //===----------------------------------------------------------------------===//
 
 // TODO: the "idx"-vs-"ldx" naming convention is not self-explanatory,
@@ -840,7 +840,7 @@ static bool computeIterationGraph(CodegenEnv &env, SortMask mask,
 }
 
 //===----------------------------------------------------------------------===//
-// Sparse compiler synthesis methods (statements and expressions).
+// Sparsifier synthesis methods (statements and expressions).
 //===----------------------------------------------------------------------===//
 
 /// Local bufferization of all dense and sparse data structures.
@@ -1139,7 +1139,7 @@ inline static Value genInvariantValue(CodegenEnv &env, ExprId exp) {
   return env.exp(exp).val;
 }
 
-/// Semi-ring branches are simply inlined by the sparse compiler. Prior
+/// Semi-ring branches are simply inlined by the sparsifier. Prior
 /// analysis has verified that all computations are "local" to the inlined
 /// branch or otherwise invariantly defined outside the loop nest, with the
 /// exception of index computations, which need to be relinked to actual
@@ -1562,7 +1562,7 @@ static void endIf(CodegenEnv &env, OpBuilder &builder, scf::IfOp ifOp,
 }
 
 //===----------------------------------------------------------------------===//
-// Sparse compiler synthesis methods (loop sequence).
+// Sparsifier synthesis methods (loop sequence).
 //===----------------------------------------------------------------------===//
 
 /// Starts a loop sequence at given level. Returns true if
@@ -1926,7 +1926,7 @@ static void genResult(CodegenEnv &env, RewriterBase &rewriter) {
 }
 
 //===----------------------------------------------------------------------===//
-// Sparse compiler rewriting methods.
+// Sparsifier rewriting methods.
 //===----------------------------------------------------------------------===//
 
 namespace {
diff --git a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
index bfa2f67eab37a76..18ebd608608bdcb 100644
--- a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
@@ -1219,7 +1219,7 @@ Type Merger::inferType(ExprId e, Value src) const {
   return dtp;
 }
 
-/// Ensures that sparse compiler can generate code for expression.
+/// Ensures that the sparsifier can generate code for expression.
 static bool isAdmissibleBranchExp(Operation *op, Block *block, Value v) {
   // Arguments are always admissible.
   if (isa<BlockArgument>(v))
@@ -1239,7 +1239,7 @@ static bool isAdmissibleBranchExp(Operation *op, Block *block, Value v) {
   return true;
 }
 
-/// Ensures that sparse compiler can generate code for branch.
+/// Ensures that the sparsifier can generate code for branch.
 static bool isAdmissibleBranch(Operation *op, Region &region) {
   if (region.empty())
     return true;
diff --git a/mlir/test/Dialect/SparseTensor/one_shot_bufferize_invalid.mlir b/mlir/test/Dialect/SparseTensor/one_shot_bufferize_invalid.mlir
index 1540d1876d7f061..bf2097b8012e254 100644
--- a/mlir/test/Dialect/SparseTensor/one_shot_bufferize_invalid.mlir
+++ b/mlir/test/Dialect/SparseTensor/one_shot_bufferize_invalid.mlir
@@ -5,7 +5,7 @@
 }>
 
 func.func @sparse_tensor_op(%arg0: tensor<64xf32, #SparseVector>) -> tensor<64xf32, #SparseVector> {
-  // expected-error @below{{sparse_tensor ops must be bufferized with the sparse compiler}}
+  // expected-error @below{{sparse_tensor ops must be bufferized with the sparsifier}}
   // expected-error @below{{failed to bufferize op}}
   %0 = sparse_tensor.convert %arg0 : tensor<64xf32, #SparseVector> to tensor<64xf32, #SparseVector>
   return %0 : tensor<64xf32, #SparseVector>
diff --git a/mlir/test/Dialect/SparseTensor/rejected.mlir b/mlir/test/Dialect/SparseTensor/rejected.mlir
index 285766fec04e703..c68c576766b8566 100644
--- a/mlir/test/Dialect/SparseTensor/rejected.mlir
+++ b/mlir/test/Dialect/SparseTensor/rejected.mlir
@@ -1,7 +1,7 @@
 // RUN: mlir-opt %s -sparsification | FileCheck %s
 
 
-// The file contains examples that will be rejected by sparse compiler
+// The file contains examples that will be rejected by sparsifier
 // (we expect the linalg.generic unchanged).
 #SparseVector = #sparse_tensor.encoding<{map = (d0) -> (d0 : compressed)}>
 
@@ -29,7 +29,7 @@ func.func @sparse_reduction_subi(%argx: tensor<i32>,
      ins(%arga: tensor<?xi32, #SparseVector>)
       outs(%argx: tensor<i32>) {
       ^bb(%a: i32, %x: i32):
-        // NOTE: `subi %a, %x` is the reason why the program is rejected by the sparse compiler.
+        // NOTE: `subi %a, %x` is the reason why the program is rejected by the sparsifier.
         // It is because we do not allow `-outTensor` in reduction loops as it creates cyclic
         // dependences.
         %t = arith.subi %a, %x: i32 
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_quantized_matmul.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_quantized_matmul.mlir
index 36e0ba888bd81ad..8efd5230b604185 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_quantized_matmul.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_quantized_matmul.mlir
@@ -33,7 +33,7 @@
 #DCSR = #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 : compressed, d1 : compressed) }>
 
 // An example of a quantized sparse matmul. With the zero offset for the
-// sparse input, the sparse compiler generates very efficient code for the
+// sparse input, the sparsifier generates very efficient code for the
 //      x(i,j) += (ext(a(i,k)) - 2) * ext(b(k,j))
 // operation.
 module {
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions_min.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions_min.mlir
index 3fe597100f37aea..06bff6d29972f25 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions_min.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions_min.mlir
@@ -63,7 +63,7 @@ module {
 
   // Regular MIN reduction: stored i32 elements AND implicit zeros.
   // Note that dealing with the implicit zeros is taken care of
-  // by the sparse compiler to preserve semantics of the "original".
+  // by the sparsifier to preserve semantics of the "original".
   func.func @min2(%arga: tensor<32xi32, #SV>, %argx: tensor<i32>) -> tensor<i32> {
     %c = tensor.extract %argx[] : tensor<i32>
     %0 = linalg.generic #trait_reduction
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_storage.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_storage.mlir
index aeb6c8cabb7d08e..807e9be9836caef 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_storage.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_storage.mlir
@@ -68,7 +68,7 @@
 module {
   //
   // Main driver that initializes a sparse tensor and inspects the sparse
-  // storage schemes in detail. Note that users of the MLIR sparse compiler
+  // storage schemes in detail. Note that users of the MLIR sparsifier
   // are typically not concerned with such details, but the test ensures
   // everything is working "under the hood".
   //
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir
index e5f5d22b6983253..8f956fb0532e7c3 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir
@@ -74,7 +74,7 @@ module {
   }
 
   // Invert the structure of a sparse vector, where missing values are
-  // filled with 1. For a dense output, the sparse compiler initializes
+  // filled with 1. For a dense output, the sparsifier initializes
   // the buffer to all zero at all other places.
   func.func @vector_complement_dense(%arga: tensor<?xf64, #SparseVector>) -> tensor<?xi32> {
     %c = arith.constant 0 : index
diff --git a/mlir/test/Integration/Dialect/SparseTensor/python/tools/sparse_compiler.py b/mlir/test/Integration/Dialect/SparseTensor/python/tools/sparse_compiler.py
index 3d1af3017abe35b..bd8ebc0caa75133 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/python/tools/sparse_compiler.py
+++ b/mlir/test/Integration/Dialect/SparseTensor/python/tools/sparse_compiler.py
@@ -2,7 +2,7 @@
 #  See https://llvm.org/LICENSE.txt for license information.
 #  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-#  This file contains the sparse compiler class.
+#  This file contains the SparseCompiler class.
 
 from mlir import execution_engine
 from mlir import ir
@@ -24,7 +24,7 @@ def __call__(self, module: ir.Module):
         self.compile(module)
 
     def compile(self, module: ir.Module):
-        """Compiles the module by invoking the sparse compiler pipeline."""
+        """Compiles the module by invoking the sparsifier pipeline."""
         passmanager.PassManager.parse(self.pipeline).run(module.operation)
 
     def jit(self, module: ir.Module) -> execution_engine.ExecutionEngine:

``````````

</details>


https://github.com/llvm/llvm-project/pull/71578


More information about the Mlir-commits mailing list