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



##########
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 didn't think of this as an option when I did the scatter kernel, 
this was my first GPU kernel. Can we make this change on the other dimensions 
as well?

##########
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 didn't think of this as an option when I did the scatter kernel, 
this was my first GPU kernel and I think I copied this from something else. Can 
we make this change on the other dimensions as well?




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