elvin-n commented on code in PR #13153:
URL: https://github.com/apache/tvm/pull/13153#discussion_r1001762411


##########
python/tvm/topi/adreno/utils.py:
##########
@@ -525,28 +525,26 @@ def bind_data_copy(stage, axis_to_vectorize=None):
         stage.bind(block, te.thread_axis("blockIdx.z"))
         stage.bind(thread, te.thread_axis("threadIdx.z"))
     else:
-        axes = stage.op.axis
-        fused = stage.fuse(*axes[:-1])
-        if shape[-1] <= 32:
+        if shape[-1] == 4:
+            axes = stage.op.axis
+            fused = stage.fuse(*axes[:-1])
             ftc = numpy.prod(shape[:-1])
             div = get_div(ftc, 64)
             block, thread = stage.split(fused, factor=div)
             stage.bind(block, te.thread_axis("blockIdx.x"))
             stage.bind(thread, te.thread_axis("threadIdx.x"))
-            if shape[-1] == 4:
-                stage.vectorize(axes[-1])
-        # 1024 is the maximum work group size for Adreno devices.
-        # See: CL_DEVICE_MAX_WORK_GROUP_SIZE
-        elif shape[-1] > 1024:
-            ftc = numpy.prod(shape[:-1])
-            div = get_div(ftc, 1024)
-            by, ty = stage.split(axes[-1], factor=div)
-            stage.bind(fused, te.thread_axis("blockIdx.x"))
-            stage.bind(by, te.thread_axis("blockIdx.y"))
-            stage.bind(ty, te.thread_axis("threadIdx.y"))
+            stage.vectorize(axes[-1])
         else:
-            stage.bind(fused, te.thread_axis("blockIdx.x"))
-            stage.bind(*axes[-1:], te.thread_axis("threadIdx.x"))
+            ftc = numpy.prod(shape)
+            vthread = get_div(ftc, 8)
+            fused = stage.fuse(*[stage.op.axis[i] for i in 
range(len(stage.op.axis))])

Review Comment:
   changed



##########
python/tvm/topi/adreno/utils.py:
##########
@@ -525,28 +525,26 @@ def bind_data_copy(stage, axis_to_vectorize=None):
         stage.bind(block, te.thread_axis("blockIdx.z"))
         stage.bind(thread, te.thread_axis("threadIdx.z"))
     else:
-        axes = stage.op.axis
-        fused = stage.fuse(*axes[:-1])
-        if shape[-1] <= 32:
+        if shape[-1] == 4:
+            axes = stage.op.axis
+            fused = stage.fuse(*axes[:-1])
             ftc = numpy.prod(shape[:-1])
             div = get_div(ftc, 64)
             block, thread = stage.split(fused, factor=div)
             stage.bind(block, te.thread_axis("blockIdx.x"))
             stage.bind(thread, te.thread_axis("threadIdx.x"))
-            if shape[-1] == 4:
-                stage.vectorize(axes[-1])
-        # 1024 is the maximum work group size for Adreno devices.
-        # See: CL_DEVICE_MAX_WORK_GROUP_SIZE
-        elif shape[-1] > 1024:
-            ftc = numpy.prod(shape[:-1])
-            div = get_div(ftc, 1024)
-            by, ty = stage.split(axes[-1], factor=div)
-            stage.bind(fused, te.thread_axis("blockIdx.x"))
-            stage.bind(by, te.thread_axis("blockIdx.y"))
-            stage.bind(ty, te.thread_axis("threadIdx.y"))
+            stage.vectorize(axes[-1])
         else:
-            stage.bind(fused, te.thread_axis("blockIdx.x"))
-            stage.bind(*axes[-1:], te.thread_axis("threadIdx.x"))
+            ftc = numpy.prod(shape)
+            vthread = get_div(ftc, 8)
+            fused = stage.fuse(*[stage.op.axis[i] for i in 
range(len(stage.op.axis))])
+            ftc = ftc / vthread
+            num_thread = get_div(ftc, 1024 // vthread)

Review Comment:
   added comment



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