junrushao1994 commented on code in PR #11031:
URL: https://github.com/apache/tvm/pull/11031#discussion_r851695280


##########
tests/python/unittest/test_tir_schedule_rfactor.py:
##########
@@ -606,6 +604,68 @@ def multiple_reduction_blocks_rfactor(a: T.handle, f: 
T.handle) -> None:
                     F[fi, fj] = (F[fi, fj] + A[fi, fj, fk]) + E[fi, fj]
 
 
[email protected]_func
+def rfactor_spatial_only(
+    A: T.Buffer[(1, 512, 7, 7), "float32"],
+    B: T.Buffer[(1, 512, 1, 1), "float32"],
+) -> None:
+    acc = T.alloc_buffer([1, 512, 1, 1], dtype="float32")
+    for i0, i1, i2, i3, i4, _i5 in T.grid(1, 512, 1, 1, 49, 1):
+        with T.block("acc"):
+            ax0 = T.axis.spatial(1, 0)
+            ax1 = T.axis.spatial(512, i1)
+            ax2 = T.axis.spatial(1, 0)
+            ax3 = T.axis.spatial(1, 0)
+            rv0 = T.axis.reduce(7, i4 // 7)
+            rv1 = T.axis.reduce(7, i4 % 7)
+            T.reads(A[ax0, ax1, ax2 * 7 + rv0, ax3 * 7 + rv1])
+            T.writes(acc[ax0, ax1, ax2, ax3])
+            with T.init():
+                acc[ax0, ax1, ax2, ax3] = T.float32(0)
+            acc[ax0, ax1, ax2, ax3] = (
+                acc[ax0, ax1, ax2, ax3] + A[ax0, ax1, ax2 * 7 + rv0, ax3 * 7 + 
rv1]
+            )
+    for i0, i1, i2, i3 in T.grid(1, 512, 1, 1):
+        with T.block("B"):
+            ax0, ax1, ax2, ax3 = T.axis.remap("SSSS", [i0, i1, i2, i3])
+            T.reads(acc[ax0, ax1, ax2, ax3])
+            T.writes(B[ax0, ax1, ax2, ax3])
+            B[ax0, ax1, ax2, ax3] = acc[ax0, ax1, ax2, ax3]

Review Comment:
   Oh I just copied from @zxybazh's example. Removed!



-- 
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]

Reply via email to