[Mlir-commits] [mlir] [mlir][sparse] support loop range query using SparseTensorLevel. (PR #75670)
Aart Bik
llvmlistbot at llvm.org
Fri Dec 15 15:51:42 PST 2023
================
@@ -49,6 +122,79 @@ sparse_tensor::makeSparseTensorLevel(OpBuilder &builder, Location loc, Value t,
llvm_unreachable("unrecognizable level format");
}
+//===----------------------------------------------------------------------===//
+// File local helper functions/macros.
+//===----------------------------------------------------------------------===//
+#define CMPI(p, lhs, rhs) \
+ (b.create<arith::CmpIOp>(l, arith::CmpIPredicate::p, (lhs), (rhs)))
+
+#define C_IDX(v) (constantIndex(b, l, (v)))
+#define YIELD(vs) (b.create<scf::YieldOp>(l, (vs)))
+#define ADDI(lhs, rhs) (b.create<arith::AddIOp>(l, (lhs), (rhs)))
+#define ANDI(lhs, rhs) (b.create<arith::AndIOp>(l, (lhs), (rhs)))
+#define SUBI(lhs, rhs) (b.create<arith::SubIOp>(l, (lhs), (rhs)))
+#define MULI(lhs, rhs) (b.create<arith::MulIOp>(l, (lhs), (rhs)))
+#define REMUI(lhs, rhs) (b.create<arith::RemUIOp>(l, (lhs), (rhs)))
+#define DIVUI(lhs, rhs) (b.create<arith::DivUIOp>(l, (lhs), (rhs)))
+#define SELECT(c, lhs, rhs) (b.create<arith::SelectOp>(l, (c), (lhs), (rhs)))
+
+static ValuePair constantRange(OpBuilder &b, Location l, Value lo, Value sz) {
+ return std::make_pair(lo, ADDI(lo, sz));
+}
+
+//===----------------------------------------------------------------------===//
+// SparseTensorLevel derived classes implemetation.
----------------
aartbik wrote:
typo: implementation
https://github.com/llvm/llvm-project/pull/75670
More information about the Mlir-commits
mailing list