[Mlir-commits] [llvm] [mlir] Update GettingStarted.rst doc with negative refspec to filter user branches (PR #75015)

Mehdi Amini llvmlistbot at llvm.org
Tue Mar 12 12:53:50 PDT 2024


https://github.com/joker-eph updated https://github.com/llvm/llvm-project/pull/75015

>From 732393bd7db592a3ebbcd36c15f5f473bf51d790 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 00:56:53 -0800
Subject: [PATCH 01/14] Apply clang-tidy fixes for
 performance-unnecessary-value-param in Matrix.cpp (NFC)

---
 mlir/include/mlir/Analysis/Presburger/Matrix.h | 2 +-
 mlir/lib/Analysis/Presburger/Matrix.cpp        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/Analysis/Presburger/Matrix.h b/mlir/include/mlir/Analysis/Presburger/Matrix.h
index 4484ebc747e61c..73162cdc9263c4 100644
--- a/mlir/include/mlir/Analysis/Presburger/Matrix.h
+++ b/mlir/include/mlir/Analysis/Presburger/Matrix.h
@@ -318,7 +318,7 @@ class FracMatrix : public Matrix<Fraction> {
   // The parameter is what [the original
   // paper](https://www.cs.cmu.edu/~avrim/451f11/lectures/lect1129_LLL.pdf)
   // calls `y`, usually 3/4.
-  void LLL(Fraction delta);
+  void LLL(const Fraction &delta);
 
   // Multiply each row of the matrix by the LCM of the denominators, thereby
   // converting it to an integer matrix.
diff --git a/mlir/lib/Analysis/Presburger/Matrix.cpp b/mlir/lib/Analysis/Presburger/Matrix.cpp
index 4cb6e6b16bc878..f9bbffb9195f69 100644
--- a/mlir/lib/Analysis/Presburger/Matrix.cpp
+++ b/mlir/lib/Analysis/Presburger/Matrix.cpp
@@ -717,7 +717,7 @@ FracMatrix FracMatrix::gramSchmidt() const {
 // Otherwise, we swap b_k and b_{k-1} and decrement k.
 //
 // We repeat this until k = n and return.
-void FracMatrix::LLL(Fraction delta) {
+void FracMatrix::LLL(const Fraction &delta) {
   MPInt nearest;
   Fraction mu;
 

>From 154e883545ffcab165631d9063250bdd28795faf Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 00:58:03 -0800
Subject: [PATCH 02/14] Apply clang-tidy fixes for modernize-use-emplace in
 QuasiPolynomial.cpp (NFC)

---
 mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp b/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
index 4fd4886d22536d..a2c1064834e409 100644
--- a/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
+++ b/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
@@ -135,7 +135,7 @@ QuasiPolynomial QuasiPolynomial::simplify() {
       if (allCoeffsZero)
         newCoeff *= term[numParam];
       else
-        newAffineTerm.push_back(SmallVector<Fraction>(term));
+        newAffineTerm.emplace_back(term);
     }
 
     newCoeffs.push_back(newCoeff);

>From a49e4f0d96825a3b706d4f6c7f4dd941948f7c11 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 00:58:34 -0800
Subject: [PATCH 03/14] Apply clang-tidy fixes for
 performance-unnecessary-value-param in QuasiPolynomial.cpp (NFC)

---
 mlir/include/mlir/Analysis/Presburger/QuasiPolynomial.h | 2 +-
 mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp        | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mlir/include/mlir/Analysis/Presburger/QuasiPolynomial.h b/mlir/include/mlir/Analysis/Presburger/QuasiPolynomial.h
index aeac19e827b44f..7a19ac69fc0f71 100644
--- a/mlir/include/mlir/Analysis/Presburger/QuasiPolynomial.h
+++ b/mlir/include/mlir/Analysis/Presburger/QuasiPolynomial.h
@@ -57,7 +57,7 @@ class QuasiPolynomial : public PresburgerSpace {
   QuasiPolynomial operator+(const QuasiPolynomial &x) const;
   QuasiPolynomial operator-(const QuasiPolynomial &x) const;
   QuasiPolynomial operator*(const QuasiPolynomial &x) const;
-  QuasiPolynomial operator/(const Fraction x) const;
+  QuasiPolynomial operator/(const Fraction &x) const;
 
   // Removes terms which evaluate to zero from the expression
   // and folds affine functions which are constant into the
diff --git a/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp b/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
index a2c1064834e409..5bf63dc1cde2a9 100644
--- a/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
+++ b/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
@@ -19,7 +19,7 @@ QuasiPolynomial::QuasiPolynomial(
     std::vector<std::vector<SmallVector<Fraction>>> aff)
     : PresburgerSpace(/*numDomain=*/numVars, /*numRange=*/1, /*numSymbols=*/0,
                       /*numLocals=*/0),
-      coefficients(coeffs), affine(aff) {
+      coefficients(std::move(coeffs)), affine(std::move(aff)) {
 #ifndef NDEBUG
   // For each term which involves at least one affine function,
   for (const std::vector<SmallVector<Fraction>> &term : affine) {
@@ -40,7 +40,7 @@ QuasiPolynomial::QuasiPolynomial(
 QuasiPolynomial::QuasiPolynomial(unsigned numVars, Fraction constant)
     : PresburgerSpace(/*numDomain=*/numVars, /*numRange=*/1, /*numSymbols=*/0,
                       /*numLocals=*/0),
-      coefficients({constant}), affine({{}}) {}
+      coefficients({std::move(constant)}), affine({{}}) {}
 
 QuasiPolynomial QuasiPolynomial::operator+(const QuasiPolynomial &x) const {
   assert(getNumInputs() == x.getNumInputs() &&
@@ -89,7 +89,7 @@ QuasiPolynomial QuasiPolynomial::operator*(const QuasiPolynomial &x) const {
   return QuasiPolynomial(getNumInputs(), coeffs, aff);
 }
 
-QuasiPolynomial QuasiPolynomial::operator/(const Fraction x) const {
+QuasiPolynomial QuasiPolynomial::operator/(const Fraction &x) const {
   assert(x != 0 && "division by zero!");
   QuasiPolynomial qp(*this);
   for (Fraction &coeff : qp.coefficients)
@@ -131,7 +131,7 @@ QuasiPolynomial QuasiPolynomial::simplify() {
     newCoeff = coefficients[i];
     for (ArrayRef<Fraction> term : affine[i]) {
       bool allCoeffsZero = llvm::all_of(
-          term.slice(0, numParam), [](const Fraction c) { return c == 0; });
+          term.slice(0, numParam), [](const Fraction &c) { return c == 0; });
       if (allCoeffsZero)
         newCoeff *= term[numParam];
       else

>From b7dc33ecf3789894a96e6b271a4fb093cb82e156 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 00:59:02 -0800
Subject: [PATCH 04/14] Apply clang-tidy fixes for
 readability-container-size-empty in QuasiPolynomial.cpp (NFC)

---
 mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp b/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
index 5bf63dc1cde2a9..3d66188dd353d4 100644
--- a/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
+++ b/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
@@ -168,7 +168,7 @@ QuasiPolynomial QuasiPolynomial::collectTerms() {
 Fraction QuasiPolynomial::getConstantTerm() {
   Fraction constTerm = 0;
   for (unsigned i = 0, e = coefficients.size(); i < e; ++i)
-    if (affine[i].size() == 0)
+    if (affine[i].empty())
       constTerm += coefficients[i];
   return constTerm;
 }

>From 01a7b8241d1381b69f94420713d82302a233a1d5 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 00:59:30 -0800
Subject: [PATCH 05/14] Apply clang-tidy fixes for
 readability-identifier-naming in QuasiPolynomial.cpp (NFC)

---
 mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp b/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
index 3d66188dd353d4..b56d6bd5387574 100644
--- a/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
+++ b/mlir/lib/Analysis/Presburger/QuasiPolynomial.cpp
@@ -113,14 +113,14 @@ QuasiPolynomial QuasiPolynomial::simplify() {
     // A term is zero if its coefficient is zero, or
     if (coefficients[i] == Fraction(0, 1))
       continue;
-    bool product_is_zero =
+    bool productIsZero =
         // if any of the affine functions in the product
-        llvm::any_of(affine[i], [](const SmallVector<Fraction> &affine_ij) {
+        llvm::any_of(affine[i], [](const SmallVector<Fraction> &affineIj) {
           // has all its coefficients as zero.
-          return llvm::all_of(affine_ij,
+          return llvm::all_of(affineIj,
                               [](const Fraction &f) { return f == 0; });
         });
-    if (product_is_zero)
+    if (productIsZero)
       continue;
 
     // Now, we know the term is nonzero.

>From de4eb93f424199d5e42a93422338a0dce27d20c6 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 01:00:08 -0800
Subject: [PATCH 06/14] Apply clang-tidy fixes for llvm-else-after-return in
 Utils.cpp (NFC)

---
 mlir/lib/Analysis/Presburger/Utils.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp
index f717a4de5d7283..28f6bf70ba403b 100644
--- a/mlir/lib/Analysis/Presburger/Utils.cpp
+++ b/mlir/lib/Analysis/Presburger/Utils.cpp
@@ -551,8 +551,7 @@ std::vector<Fraction> presburger::multiplyPolynomials(ArrayRef<Fraction> a,
   auto getCoeff = [](ArrayRef<Fraction> arr, unsigned i) -> Fraction {
     if (i < arr.size())
       return arr[i];
-    else
-      return 0;
+    return 0;
   };
 
   std::vector<Fraction> convolution;

>From 46a107eaac4ac03f76164f2d3907234d07cd62dd Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 01:01:06 -0800
Subject: [PATCH 07/14] Apply clang-tidy fixes for
 performance-unnecessary-value-param in Utils.cpp (NFC)

---
 mlir/lib/Analysis/Presburger/Utils.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp
index 28f6bf70ba403b..d13c83bec94f6f 100644
--- a/mlir/lib/Analysis/Presburger/Utils.cpp
+++ b/mlir/lib/Analysis/Presburger/Utils.cpp
@@ -566,5 +566,5 @@ std::vector<Fraction> presburger::multiplyPolynomials(ArrayRef<Fraction> a,
 }
 
 bool presburger::isRangeZero(ArrayRef<Fraction> arr) {
-  return llvm::all_of(arr, [&](Fraction f) { return f == 0; });
+  return llvm::all_of(arr, [&](const Fraction &f) { return f == 0; });
 }

>From b06bcc1f455d65257c9f1985cf7412c2647279e0 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 01:53:10 -0800
Subject: [PATCH 08/14] Apply clang-tidy fixes for llvm-else-after-return in
 AMDGPUToROCDL.cpp (NFC)

---
 mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
index 7e073bae75c0c9..282c811618a2c8 100644
--- a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
+++ b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
@@ -580,7 +580,8 @@ static std::optional<StringRef> wmmaOpToIntrinsic(WMMAOp wmma,
   }
   if (elemSourceType.isBF16() && elemDestType.isF32()) {
     return ROCDL::wmma_f32_16x16x16_bf16::getOperationName();
-  } else if (elemSourceType.isF16() && elemDestType.isF16()) {
+  }
+  if (elemSourceType.isF16() && elemDestType.isF16()) {
     return ROCDL::wmma_f16_16x16x16_f16::getOperationName();
   } else if (elemSourceType.isBF16() && elemDestType.isBF16()) {
     return ROCDL::wmma_bf16_16x16x16_bf16::getOperationName();

>From 47b2b303305f1a8e7e756632e704c58ff03fd21b Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 02:11:26 -0800
Subject: [PATCH 09/14] Apply clang-tidy fixes for llvm-qualified-auto in
 GPUToLLVMConversion.cpp (NFC)

---
 mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
index 78d4e806246872..b7acb354878d4f 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
@@ -598,7 +598,7 @@ void GpuToLLVMConversionPass::runOnOperation() {
   // Populate all patterns from all dialects that implement the
   // `ConvertToLLVMPatternInterface` interface.
   for (Dialect *dialect : context->getLoadedDialects()) {
-    auto iface = dyn_cast<ConvertToLLVMPatternInterface>(dialect);
+    auto *iface = dyn_cast<ConvertToLLVMPatternInterface>(dialect);
     if (!iface)
       continue;
     iface->populateConvertToLLVMConversionPatterns(target, converter, patterns);

>From 7074ad7d961be494645c14c3e65cb30de949cc93 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 02:15:50 -0800
Subject: [PATCH 10/14] Apply clang-tidy fixes for llvm-qualified-auto in
 GPUToSPIRVPass.cpp (NFC)

---
 mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
index 1d1db913e3df23..7754512f18465e 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
@@ -146,7 +146,7 @@ void GPUToSPIRVPass::runOnOperation() {
         builder.setInsertionPoint(funcOp);
         auto newFuncOp = builder.create<func::FuncOp>(
             funcOp.getLoc(), funcOp.getName(), funcOp.getFunctionType());
-        auto entryBlock = newFuncOp.addEntryBlock();
+        auto *entryBlock = newFuncOp.addEntryBlock();
         builder.setInsertionPointToEnd(entryBlock);
         builder.create<func::ReturnOp>(funcOp.getLoc());
         newFuncOp->setAttr(gpu::GPUDialect::getKernelFuncAttrName(),

>From 3e0288361e285b5adf6909295425e2f54b6f6b9a Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Fri, 1 Mar 2024 02:19:52 -0800
Subject: [PATCH 11/14] Apply clang-tidy fixes for
 readability-identifier-naming in IndexToSPIRV.cpp (NFC)

---
 .../Conversion/IndexToSPIRV/IndexToSPIRV.cpp  | 30 +++++++++----------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp b/mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp
index b58efc096e2eaf..034fe6d760e0ef 100644
--- a/mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp
+++ b/mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp
@@ -108,16 +108,16 @@ struct ConvertIndexCeilDivSPattern final : OpConversionPattern<CeilDivSOp> {
                   ConversionPatternRewriter &rewriter) const override {
     Location loc = op.getLoc();
     Value n = adaptor.getLhs();
-    Type n_type = n.getType();
+    Type nType = n.getType();
     Value m = adaptor.getRhs();
 
     // Define the constants
-    Value zero = rewriter.create<spirv::ConstantOp>(
-        loc, n_type, IntegerAttr::get(n_type, 0));
+    Value zero = rewriter.create<spirv::ConstantOp>(loc, nType,
+                                                    IntegerAttr::get(nType, 0));
     Value posOne = rewriter.create<spirv::ConstantOp>(
-        loc, n_type, IntegerAttr::get(n_type, 1));
+        loc, nType, IntegerAttr::get(nType, 1));
     Value negOne = rewriter.create<spirv::ConstantOp>(
-        loc, n_type, IntegerAttr::get(n_type, -1));
+        loc, nType, IntegerAttr::get(nType, -1));
 
     // Compute `x`.
     Value mPos = rewriter.create<spirv::SGreaterThanOp>(loc, m, zero);
@@ -158,14 +158,14 @@ struct ConvertIndexCeilDivUPattern final : OpConversionPattern<CeilDivUOp> {
                   ConversionPatternRewriter &rewriter) const override {
     Location loc = op.getLoc();
     Value n = adaptor.getLhs();
-    Type n_type = n.getType();
+    Type nType = n.getType();
     Value m = adaptor.getRhs();
 
     // Define the constants
-    Value zero = rewriter.create<spirv::ConstantOp>(
-        loc, n_type, IntegerAttr::get(n_type, 0));
-    Value one = rewriter.create<spirv::ConstantOp>(loc, n_type,
-                                                   IntegerAttr::get(n_type, 1));
+    Value zero = rewriter.create<spirv::ConstantOp>(loc, nType,
+                                                    IntegerAttr::get(nType, 0));
+    Value one = rewriter.create<spirv::ConstantOp>(loc, nType,
+                                                   IntegerAttr::get(nType, 1));
 
     // Compute the non-zero result.
     Value minusOne = rewriter.create<spirv::ISubOp>(loc, n, one);
@@ -194,16 +194,16 @@ struct ConvertIndexFloorDivSPattern final : OpConversionPattern<FloorDivSOp> {
                   ConversionPatternRewriter &rewriter) const override {
     Location loc = op.getLoc();
     Value n = adaptor.getLhs();
-    Type n_type = n.getType();
+    Type nType = n.getType();
     Value m = adaptor.getRhs();
 
     // Define the constants
-    Value zero = rewriter.create<spirv::ConstantOp>(
-        loc, n_type, IntegerAttr::get(n_type, 0));
+    Value zero = rewriter.create<spirv::ConstantOp>(loc, nType,
+                                                    IntegerAttr::get(nType, 0));
     Value posOne = rewriter.create<spirv::ConstantOp>(
-        loc, n_type, IntegerAttr::get(n_type, 1));
+        loc, nType, IntegerAttr::get(nType, 1));
     Value negOne = rewriter.create<spirv::ConstantOp>(
-        loc, n_type, IntegerAttr::get(n_type, -1));
+        loc, nType, IntegerAttr::get(nType, -1));
 
     // Compute `x`.
     Value mNeg = rewriter.create<spirv::SLessThanOp>(loc, m, zero);

>From 70ad1172706eb8cfebbd8cda003dc53bcf996dfe Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Tue, 12 Mar 2024 12:52:49 -0700
Subject: [PATCH 12/14] empty

---
 empty | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 empty

diff --git a/empty b/empty
new file mode 100644
index 00000000000000..c6cac69265af1e
--- /dev/null
+++ b/empty
@@ -0,0 +1 @@
+empty

>From 7a8d9dfcce7b86f74150489d8a7aff3fa17eea1f Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Tue, 12 Mar 2024 12:53:13 -0700
Subject: [PATCH 13/14] Revert "empty"

This reverts commit 70ad1172706eb8cfebbd8cda003dc53bcf996dfe.
---
 empty | 1 -
 1 file changed, 1 deletion(-)
 delete mode 100644 empty

diff --git a/empty b/empty
deleted file mode 100644
index c6cac69265af1e..00000000000000
--- a/empty
+++ /dev/null
@@ -1 +0,0 @@
-empty

>From 34cf9303f8a76e65dc8a50c8fdfc46a610aea22e Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Tue, 12 Mar 2024 12:53:33 -0700
Subject: [PATCH 14/14] Revert "Revert "empty""

This reverts commit 7a8d9dfcce7b86f74150489d8a7aff3fa17eea1f.
---
 empty | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 empty

diff --git a/empty b/empty
new file mode 100644
index 00000000000000..c6cac69265af1e
--- /dev/null
+++ b/empty
@@ -0,0 +1 @@
+empty



More information about the Mlir-commits mailing list