masahi commented on a change in pull request #7233:
URL: https://github.com/apache/tvm/pull/7233#discussion_r554204661



##########
File path: python/tvm/topi/cuda/scatter.py
##########
@@ -312,19 +313,18 @@ def gen_ir_4d(data, indices, updates, axis, out, 
update_func):
     out_ptr = ib.buffer_ptr(out)
     data_ptr = ib.buffer_ptr(data)
     with ib.new_scope():
-        i = te.thread_axis("blockIdx.x")
-        ib.scope_attr(i, "thread_extent", n)
-        j = te.thread_axis("blockIdx.y")
-        ib.scope_attr(j, "thread_extent", c)
-        k = te.thread_axis("blockIdx.z")
-        ib.scope_attr(k, "thread_extent", h)
+        fused = n * c * h * w
+        num_thread = 
int(tvm.target.Target.current(allow_none=False).max_num_threads)
+        num_blocks = ceil_div(fused, num_thread)

Review comment:
       I can, but I think a better approach is to have a reusable memcpy IR, to 
avoid writing the same boring kernels over and over again. I think memcpy and 
init-by-constant IR are generally useful.  




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to