Skip to content

Commit 19f8f84

Browse files
author
Min Chen
committed
Apply review suggestions.
1 parent 4dec158 commit 19f8f84

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/arith/presburger_set.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@
4242
namespace tvm {
4343
namespace arith {
4444

45+
#ifdef TVM_MLIR_VERSION
4546
#if TVM_MLIR_VERSION >= 150
4647
using namespace tir;
4748

48-
void Update(const PrimExpr& constraint, PresburgerSetNode* intset) {
49+
static void Update(const PrimExpr& constraint, PresburgerSetNode* intset) {
4950
auto& space = intset->space;
5051
auto constraints_union = ExtractComponents(constraint);
5152
for (const PrimExpr& subconstraint : constraints_union) {
@@ -166,7 +167,7 @@ PrimExpr PresburgerSetNode::GenerateConstraint() const {
166167
return constraint;
167168
}
168169

169-
PresburgerSet Union(Array<PresburgerSet> sets) {
170+
PresburgerSet Union(const Array<PresburgerSet>& sets) {
170171
CHECK_GT(sets.size(), 0);
171172
if (sets.size() == 1) return sets[0];
172173
auto relations = sets[0]->disjuncts;
@@ -229,6 +230,7 @@ TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable)
229230
p->stream << "}";
230231
});
231232

233+
#endif // TVM_MLIR_VERSION >= 150
232234
#endif // TVM_MLIR_VERSION
233235

234236
PresburgerSet MakePresburgerSet(const PrimExpr& constraint) { return PresburgerSet(constraint); }

src/arith/presburger_set.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
#ifndef TVM_ARITH_PRESBURGER_SET_H_
2525
#define TVM_ARITH_PRESBURGER_SET_H_
2626

27+
#ifdef TVM_MLIR_VERSION
2728
#if TVM_MLIR_VERSION >= 150
2829
#include <mlir/Analysis/Presburger/IntegerRelation.h>
2930
#include <mlir/Analysis/Presburger/PresburgerRelation.h>
3031
#include <mlir/Analysis/Presburger/Simplex.h>
3132
#endif
33+
#endif
3234

3335
#include <tvm/arith/analyzer.h>
3436
#include <tvm/tir/op.h>
@@ -41,6 +43,7 @@
4143
namespace tvm {
4244
namespace arith {
4345

46+
#ifdef TVM_MLIR_VERSION
4447
#if TVM_MLIR_VERSION >= 150
4548
using namespace mlir;
4649
using namespace presburger;
@@ -150,7 +153,8 @@ class PresburgerSet : public IntSet {
150153
TVM_DEFINE_OBJECT_REF_COW_METHOD(PresburgerSetNode);
151154
TVM_DEFINE_OBJECT_REF_METHODS(PresburgerSet, IntSet, PresburgerSetNode);
152155
};
153-
#else
156+
#endif // TVM_MLIR_VERSION >= 150
157+
#else // TVM_MLIR_VERSION
154158
// Class definition when MLIR is not enabled, to prevent compile-time error.
155159
class PresburgerSetNode : public IntSetNode {
156160
public:
@@ -170,13 +174,13 @@ class PresburgerSet : public IntSet {
170174
*/
171175
TVM_DLL PresburgerSet(const PrimExpr& constraint) { LOG(FATAL) << "MLIR is not enabled!"; }
172176
};
173-
#endif
177+
#endif // TVM_MLIR_VERSION
174178
/*!
175179
* \brief Create a union set of all sets
176180
* \param sets The sets to be combined
177181
* \return the set after union
178182
*/
179-
PresburgerSet Union(const Array<PresburgerSet> sets);
183+
PresburgerSet Union(const Array<PresburgerSet>& sets);
180184

181185
/*!
182186
* \brief Create an intersected set of all sets

0 commit comments

Comments
 (0)