[clang] [mlir][sparse] Update Enum name for CompressedWithHigh (PR #67845)

2023-09-29 Thread Aart Bik via cfe-commits

https://github.com/aartbik approved this pull request.


https://github.com/llvm/llvm-project/pull/67845
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [mlir][sparse] Update Enum name for CompressedWithHigh (PR #67845)

2023-09-29 Thread Peiming Liu via cfe-commits


@@ -26,20 +26,20 @@ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(SparseTensor, 
sparse_tensor);
 /// If updating, keep them in sync and update the static_assert in the impl
 /// file.
 enum MlirSparseTensorDimLevelType {
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4, // 0b1_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED = 8,// 0b00010_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU = 9, // 0b00010_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NO = 10,// 0b00010_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU_NO = 11, // 0b00010_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON = 16,// 0b00100_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU = 17, // 0b00100_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NO = 18, // 0b00100_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU_NO = 19,  // 0b00100_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI = 32,   // 0b01000_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU = 33,// 0b01000_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NO = 34,// 0b01000_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU_NO = 35, // 0b01000_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_TWO_OUT_OF_FOUR = 64,  // 0b1_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4,   // 0b1_00

PeimingLiu wrote:

Not directly related to this PR, but can we get rid of this enum completely? We 
can have a `class LevelType` that stores an integer (which encodes level 
format/property).

https://github.com/llvm/llvm-project/pull/67845
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [mlir][sparse] Update Enum name for CompressedWithHigh (PR #67845)

2023-09-29 Thread Yinying Li via cfe-commits

https://github.com/yinying-lisa-li updated 
https://github.com/llvm/llvm-project/pull/67845

>From ab46cf0f76aeaa78f2eb8865d647400f810e35ec Mon Sep 17 00:00:00 2001
From: Yinying Li 
Date: Fri, 29 Sep 2023 19:09:21 +
Subject: [PATCH] [mlir][sparse] Update Enum name for CompressedWithHigh

Change CompressedWithHigh to LooseCompressed.
---
 mlir/include/mlir-c/Dialect/SparseTensor.h|  28 ++---
 .../mlir/Dialect/SparseTensor/IR/Enums.h  | 106 +-
 .../Dialect/SparseTensor/IR/SparseTensor.h|   4 +-
 .../SparseTensor/IR/SparseTensorAttrDefs.td   |   2 +-
 .../Bindings/Python/DialectSparseTensor.cpp   |  14 +--
 .../SparseTensor/IR/Detail/LvlTypeParser.cpp  |   2 +-
 .../SparseTensor/IR/SparseTensorDialect.cpp   |  10 +-
 .../SparseTensor/Transforms/LoopEmitter.cpp   |  16 +--
 .../Transforms/SparseTensorCodegen.cpp|   8 +-
 .../Transforms/Sparsification.cpp |   6 +-
 .../lib/Dialect/SparseTensor/Utils/Merger.cpp |   4 +-
 .../SparseTensor/roundtrip_encoding.mlir  |   2 +-
 .../SparseTensor/CPU/sparse_pack_libgen.mlir  |   2 +-
 13 files changed, 102 insertions(+), 102 deletions(-)

diff --git a/mlir/include/mlir-c/Dialect/SparseTensor.h 
b/mlir/include/mlir-c/Dialect/SparseTensor.h
index fecbeaf6b0f9d6c..7e47e54e7361d54 100644
--- a/mlir/include/mlir-c/Dialect/SparseTensor.h
+++ b/mlir/include/mlir-c/Dialect/SparseTensor.h
@@ -26,20 +26,20 @@ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(SparseTensor, 
sparse_tensor);
 /// If updating, keep them in sync and update the static_assert in the impl
 /// file.
 enum MlirSparseTensorDimLevelType {
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4, // 0b1_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED = 8,// 0b00010_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU = 9, // 0b00010_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NO = 10,// 0b00010_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU_NO = 11, // 0b00010_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON = 16,// 0b00100_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU = 17, // 0b00100_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NO = 18, // 0b00100_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU_NO = 19,  // 0b00100_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI = 32,   // 0b01000_00
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU = 33,// 0b01000_01
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NO = 34,// 0b01000_10
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU_NO = 35, // 0b01000_11
-  MLIR_SPARSE_TENSOR_DIM_LEVEL_TWO_OUT_OF_FOUR = 64,  // 0b1_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4,   // 0b1_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED = 8,  // 0b00010_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU = 9,   // 0b00010_01
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NO = 10,  // 0b00010_10
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU_NO = 11,   // 0b00010_11
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON = 16,  // 0b00100_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU = 17,   // 0b00100_01
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NO = 18,   // 0b00100_10
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU_NO = 19,// 0b00100_11
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_LOOSE_COMPRESSED = 32,   // 0b01000_00
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_LOOSE_COMPRESSED_NU = 33,// 0b01000_01
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_LOOSE_COMPRESSED_NO = 34,// 0b01000_10
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_LOOSE_COMPRESSED_NU_NO = 35, // 0b01000_11
+  MLIR_SPARSE_TENSOR_DIM_LEVEL_TWO_OUT_OF_FOUR = 64,// 0b1_00
 };
 
 
//===--===//
diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h 
b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
index 7a1aed509c2a360..bc351ec52c0946b 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
@@ -170,33 +170,33 @@ enum class Action : uint32_t {
 // TODO: We should generalize TwoOutOfFour to N out of M and use property to
 // encode the value of N and M.
 // TODO: Update DimLevelType to use lower 8 bits for storage formats and the
-// higher 4 bits to store level properties. Consider CompressedWithHi and
+// higher 4 bits to store level properties. Consider LooseCompressed and
 // TwoOutOfFour as properties instead of formats.
 enum class DimLevelType : uint8_t {
-  Undef = 0, // 0b0_00
-  Dense = 4, // 0b1_00
-  Compressed = 8,// 0b00010_00
-  CompressedNu = 9,  // 0b00010_01
-  CompressedNo = 10, // 0b00010_10
-  CompressedNuNo = 11,   // 0b00010_11
-  Singleton = 16,// 0b00100_00
-  SingletonNu = 17,  // 0b00100_01
-  SingletonNo = 18,  // 0b00100_10
-  SingletonNuNo =