Hzfengsy commented on a change in pull request #9121:
URL: https://github.com/apache/tvm/pull/9121#discussion_r717139926
##########
File path: tests/python/unittest/test_tir_transform_loop_partition.py
##########
@@ -538,6 +538,27 @@ def test_simple_rfactor():
assert not tvm.ir.structural_equal(stmt1.body, stmt2.body)
+def test_explicit_partition_hint():
+ A = te.placeholder((16,), name="A")
+ B = te.placeholder((16,), name="B")
+ C = te.compute((32,), lambda i: te.if_then_else(i < 16, A[i], B[i]),
name="C")
+ s = te.create_schedule(C.op)
+ s.normalize()
+ s[C].pragma(s[C].op.axis[0], "loop_partition_hint")
+ bounds = tvm.te.schedule.InferBound(s)
+ stmt1 = tvm.te.schedule.ScheduleOps(s, bounds)
+
+ mod1 = tvm.IRModule.from_expr(tvm.tir.PrimFunc([], stmt1))
+ stmt1 = tvm.tir.transform.Simplify()(mod1)["main"].body
+
+ with tvm.transform.PassContext(config={"tir.LoopPartition":
{"partition_const_loop": True}}):
+ mod2 = tvm.tir.transform.LoopPartition()(mod1)
+ stmt2 = tvm.tir.transform.Simplify()(mod2)["main"].body
+
+ # make sure loop partition actually did something
+ assert not tvm.ir.structural_equal(stmt1.body, stmt2.body)
Review comment:
It's better to assert `structural_equal` to the expected result.
##########
File path: include/tvm/tir/stmt.h
##########
@@ -1339,6 +1339,12 @@ constexpr const char* hand_threaded = "hand_threaded";
* if (mask & 2) the write region should be detected.
*/
constexpr const char* script_parsing_detect_access =
"tir.script_parsing_detect_access";
+
+/*!
+ * \brief Mark that the loop should be partitioned.
+ */
+constexpr const char* pragma_loop_partition_hint =
"pragma_loop_partition_hint";
Review comment:
```suggestion
constexpr const char* pragma_loop_partition_hint =
"tir.pragma_loop_partition_hint";
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]