[Mlir-commits] [mlir] [mlir][sparse] change dim level type -> level type (PR #73058)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Nov 21 17:00:50 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff d213220a9ac031133fa360b94a343f3d09f01ea8 d4a063d66217eaff8efce866eda4f7c456ea4b01 -- mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorStorageLayout.h mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMap.cpp mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp mlir/lib/Dialect/SparseTensor/Transforms/CodegenEnv.h mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorDescriptor.cpp mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
index b11b108ace..5f9c271b39 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
@@ -247,9 +247,7 @@ constexpr bool isValidLT(DimLevelType lt) {
}
/// Check if the `DimLevelType` is the special undefined value.
-constexpr bool isUndefLT(DimLevelType lt) {
- return lt == DimLevelType::Undef;
-}
+constexpr bool isUndefLT(DimLevelType lt) { return lt == DimLevelType::Undef; }
/// Check if the `DimLevelType` is dense (regardless of properties).
constexpr bool isDenseLT(DimLevelType lt) {
@@ -288,8 +286,8 @@ constexpr bool isWithPosLT(DimLevelType lt) {
/// Check if the `DimLevelType` needs coordinates array.
constexpr bool isWithCrdLT(DimLevelType lt) {
- return isCompressedLT(lt) || isSingletonLT(lt) ||
- isLooseCompressedLT(lt) || is2OutOf4LT(lt);
+ return isCompressedLT(lt) || isSingletonLT(lt) || isLooseCompressedLT(lt) ||
+ is2OutOf4LT(lt);
}
/// Check if the `DimLevelType` is ordered (regardless of storage format).
@@ -316,7 +314,7 @@ constexpr std::optional<LevelFormat> getLevelFormat(DimLevelType lt) {
constexpr std::optional<DimLevelType>
buildLevelType(LevelFormat lf, bool ordered, bool unique) {
auto lt = static_cast<DimLevelType>(static_cast<uint8_t>(lf) |
- (ordered ? 0 : 2) | (unique ? 0 : 1));
+ (ordered ? 0 : 2) | (unique ? 0 : 1));
return isValidLT(lt) ? std::optional(lt) : std::nullopt;
}
diff --git a/mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h b/mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h
index a689788431..29cc65364b 100644
--- a/mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h
+++ b/mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h
@@ -121,9 +121,7 @@ public:
}
/// Safely checks if the level uses singleton storage.
- bool isSingletonLvl(uint64_t l) const {
- return isSingletonLT(getLvlType(l));
- }
+ bool isSingletonLvl(uint64_t l) const { return isSingletonLT(getLvlType(l)); }
/// Safely checks if the level uses 2 out of 4 storage.
bool is2OutOf4Lvl(uint64_t l) const { return is2OutOf4LT(getLvlType(l)); }
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
index 92f0209c91..90fd3e0d8d 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
@@ -408,8 +408,8 @@ static void genEndInsert(OpBuilder &builder, Location loc,
builder.setInsertionPointAfter(loop);
}
} else {
- assert(isDenseLT(lt) || isLooseCompressedLT(lt) ||
- isSingletonLT(lt) || is2OutOf4LT(lt));
+ assert(isDenseLT(lt) || isLooseCompressedLT(lt) || isSingletonLT(lt) ||
+ is2OutOf4LT(lt));
}
}
}
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
index 0c8bf004a4..c793f012bd 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
@@ -981,8 +981,8 @@ static bool startLoopSeq(CodegenEnv &env, OpBuilder &builder, ExprId exp,
}
needsUniv = true;
}
- if (isCompressedLT(lt) || isSingletonLT(lt) ||
- isLooseCompressedLT(lt) || is2OutOf4LT(lt) || isIdxReduc) {
+ if (isCompressedLT(lt) || isSingletonLT(lt) || isLooseCompressedLT(lt) ||
+ is2OutOf4LT(lt) || isIdxReduc) {
// Only when this is a index reduction loop, can the lt be undefined.
assert(!isUndefLT(lt) || isIdxReduc);
// sparse/singleton levels, or a dense/sparse index reduction loop.
diff --git a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
index e27909229c..2cfb423f0f 100644
--- a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
@@ -670,8 +670,8 @@ bool Merger::isSingleCondition(TensorId t, ExprId e) const {
bool Merger::hasAnySparse(const BitVector &bits) const {
for (TensorLoopId b : bits.set_bits()) {
const auto lt = getLvlType(b);
- if (isCompressedLT(lt) || isSingletonLT(lt) ||
- isLooseCompressedLT(lt) || is2OutOf4LT(lt))
+ if (isCompressedLT(lt) || isSingletonLT(lt) || isLooseCompressedLT(lt) ||
+ is2OutOf4LT(lt))
return true;
}
return hasSparseIdxReduction(bits);
``````````
</details>
https://github.com/llvm/llvm-project/pull/73058
More information about the Mlir-commits
mailing list