Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/tvm/tir/stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,12 @@ class WhileNode : public StmtNode {
}

bool SEqualReduce(const WhileNode* other, SEqualReducer equal) const {
return equal.DefEqual(condition, other->condition) && equal.DefEqual(body, other->body);
return equal(condition, other->condition) && equal(body, other->body);
}

void SHashReduce(SHashReducer hash_reduce) const {
hash_reduce.DefHash(condition);
hash_reduce.DefHash(body);
hash_reduce(condition);
hash_reduce(body);
}

static constexpr const char* _type_key = "tir.While";
Expand Down
10 changes: 10 additions & 0 deletions tests/python/unittest/test_tir_structural_equal_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ def test_buffer_load_store():
assert not consistent_equal(sy, sz)


def test_while():
x = tvm.tir.Var("x", "int32")
y = tvm.tir.Var("y", "int32")
wx = tvm.tir.While(x > 0, tvm.tir.Evaluate(x))
wy = tvm.tir.While(y > 0, tvm.tir.Evaluate(y))
assert not consistent_equal(wx, wy)
assert consistent_equal(wx, wy, map_free_vars=True)


if __name__ == "__main__":
test_exprs()
test_prim_func()
Expand All @@ -208,3 +217,4 @@ def test_buffer_load_store():
test_stmt()
test_buffer_storage_scope()
test_buffer_load_store()
test_while()