You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "bujjibabukatta (via GitHub)" <gi...@apache.org> on 2026/06/30 20:29:39 UTC
[PR] [Fix][TOPI] Swap CUDA topk thread axis to bypass gridDim.y limits [tvm]
bujjibabukatta opened a new pull request, #19918:
URL: https://github.com/apache/tvm/pull/19918
Fixes issue #19549 by mapping the block index representing chunk size (which is bound by the dimension of the data) to lockIdx.y and mapping the block index for batches (which easily exceeds 65535) to lockIdx.x (limit ~2 billion).
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [Fix][TOPI] Swap CUDA topk thread axis to bypass gridDim.y limits [tvm]
Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen closed pull request #19918: [Fix][TOPI] Swap CUDA topk thread axis to bypass gridDim.y limits
URL: https://github.com/apache/tvm/pull/19918
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [Fix][TOPI] Swap CUDA topk thread axis to bypass gridDim.y limits [tvm]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #19918:
URL: https://github.com/apache/tvm/pull/19918#discussion_r3501660486
##########
python/tvm/topi/gpu/sort.py:
##########
@@ -31,8 +31,8 @@
def _get_threads(nthread_tx, nthread_bx, nthread_by):
tx = te.thread_axis("threadIdx.x")
- bx = te.thread_axis("blockIdx.x")
- by = te.thread_axis("blockIdx.y")
+ bx = te.thread_axis("blockIdx.y")
+ by = te.thread_axis("blockIdx.x")
Review Comment:

Mapping `bx` to `blockIdx.y` and `by` to `blockIdx.x` is highly counter-intuitive and can easily lead to confusion or bugs during future maintenance. Adding a clear inline comment explaining this swap and its purpose (bypassing `gridDim.y` limits for large batch sizes) will greatly improve code maintainability.
```suggestion
# Swap blockIdx.x and blockIdx.y to map the larger batch dimension (nthread_by)
# to blockIdx.x (limit ~2B) and the smaller chunk dimension (nthread_bx) to
# blockIdx.y (limit 65535) to avoid exceeding CUDA gridDim.y limits.
bx = te.thread_axis("blockIdx.y")
by = te.thread_axis("blockIdx.x")
```
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org