You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/11/11 09:40:25 UTC

[GitHub] [tvm] Mousius commented on a change in pull request #9485: [BugFix] Fix divide by zero error in TIR pass lower_warp_memory

Mousius commented on a change in pull request #9485:
URL: https://github.com/apache/tvm/pull/9485#discussion_r747345307



##########
File path: tests/python/unittest/test_tir_transform_lower_warp_memory.py
##########
@@ -310,11 +311,29 @@ def test_lower_warp_memory_same_thread():
     assert "tvm_warp_shuffle" not in fdevice.astext()
 
 
+@tvm.testing.requires_cuda
+def test_lower_warp_memory_divide_by_factor():
+    ib = tvm.tir.ir_builder.IRBuilder()
+    bx = te.thread_axis("blockIdx.x")
+    tx = te.thread_axis("threadIdx.x")
+
+    with ib.new_scope():
+        ib.scope_attr(bx, "thread_extent", 32)
+        ib.scope_attr(tx, "thread_extent", 32)
+        t = ib.allocate("float32", 16, name="t", scope="warp")
+        n = ib.allocate("float32", 16, name="n", scope="local")
+        n[0] = t[0]
+
+    stmt = ib.get()
+    func = tvm.tir.PrimFunc([], stmt)
+    func = func.with_attr("from_legacy_te_schedule", True)
+    cuda_target = tvm.target.Target("cuda")
+    mod = tvm.lower(func, name="f")
+    mod = tvm.tir.transform.Apply(lambda f: f.with_attr("target", cuda_target))(mod)
+    with pytest.raises(tvm.error.TVMError) as cm:

Review comment:
       Minor nit: you could do use the `match` parameter instead of an assert on the `str` here.




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org