[Mlir-commits] [mlir] [mlir][sparse] Add verification for explicit/implicit value (PR #90111)
Peiming Liu
llvmlistbot at llvm.org
Thu May 2 11:05:34 PDT 2024
================
@@ -502,9 +502,37 @@ def SparseTensorEncodingAttr : SparseTensor_Attr<"SparseTensorEncoding",
//
// Helper function to translate between level/dimension space.
//
+
SmallVector<int64_t> translateShape(::mlir::ArrayRef<int64_t> srcShape, ::mlir::sparse_tensor::CrdTransDirectionKind) const;
ValueRange translateCrds(::mlir::OpBuilder &builder, ::mlir::Location loc, ::mlir::ValueRange crds, ::mlir::sparse_tensor::CrdTransDirectionKind) const;
+ //
+ // COO struct and methods.
+ //
+
+ /// A simple structure that encodes a range of levels in the sparse tensors
+ /// that forms a COO segment.
+ struct COOSegment {
+ std::pair<Level, Level> lvlRange; // [low, high)
+ bool isSoA;
+
+ bool isAoS() const { return !isSoA; }
+ bool isSegmentStart(Level l) const { return l == lvlRange.first; }
+ bool inSegment(Level l) const {
+ return l >= lvlRange.first && l < lvlRange.second;
+ }
+ };
----------------
PeimingLiu wrote:
Let's not put it here, maybe move it to `SparseTenosr.h` (where `using Level = uint64_t` is defined).
https://github.com/llvm/llvm-project/pull/90111
More information about the Mlir-commits
mailing list