[DLight][CUDA] Fix undefined TX in GEMV broadcast epilogue#19970
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the GPU GEMV schedule in python/tvm/s_tir/dlight/gpu/gemv.py by changing the split factor for the epilogue block from TX to TR. It also adds a new unit test test_gemv_broadcast_epilogue in tests/python/s_tir/dlight/test_gpu_gemv.py to validate this scheduling behavior. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
tlopex
left a comment
There was a problem hiding this comment.
Thanks for fixing this! The same undefined TX reference still exists in the LowBatchGEMV broadcast-epilogue path:
tvm/python/tvm/s_tir/dlight/gpu/low_batch_gemv.py
Lines 491 to 496 in 9837463
TX is not defined anywhere in that file either, so this branch will fail with the same runtime error when reached. Since the resulting loop is bound to TAG_S, the corresponding existing tile factor appears to be TS:
_, ts = sch.split(sch.fuse(*s), factors=[None, TS])
sch.bind(ts, TAG_S)
The existing LowBatchGEMV tests do not trigger this broadcast-epilogue branch. Could we fix this occurrence as well and add a regression test for it?
9837463 to
8e01616
Compare
The GEMV and LowBatchGEMV inner-reduction schedules handle broadcast epilogues by splitting fused epilogue loops and binding the inner loop to a CUDA thread axis. These paths referenced TX, but TX is not defined in either schedule scope or passed into the inner scheduling helpers. Use the existing tile factors for the corresponding bound axes: TR for GEMV's threadIdx.x path and TS for LowBatchGEMV's TAG_S path. Add regression tests covering both broadcast epilogue branches.
8e01616 to
e3738a7
Compare
|
Thanks for catching this. I updated the PR to fix the LowBatchGEMV broadcast-epilogue path as well, replacing the undefined TX with TS for the loop bound to TAG_S, and added a regression test that covers this branch. |
|
@yongwww The current The LowBatchGEMV follow-up and regression test requested by @tlopex are included in |
This PR fixes an undefined
TXreference in the DLight GPU GEMV inner-reduction schedule.The broadcast epilogue path splits fused epilogue loops and binds the inner loop to
threadIdx.x, but it referencedTX, which is not defined in the surrounding scope or passed into the helper. This PR uses the existingTRtile factor, which is already used for thethreadIdx.xdirection in this schedule.A regression test is added to cover the GEMV broadcast epilogue path.
Fixes #19969
Tests:
python -m pytest tests/python/s_tir/dlight/test_gpu_gemv.py -qpython -m pytest tests/python/s_tir/dlight/test_gpu_low_batch_gemv.py -qpython -m pytest tests/python/s_tir/dlight/test_gpu_reduction.py -qNote: The branch is based on
apache/tvm:main. Local main-branch test execution on this Windows machine could not be completed because the available compiled TVM library is from a v0.25 build and does not match the latest Python sources; the same tests passed in the matching local v0.25 environment before rebasing the patch to main.