Skip to content

[DLight][CUDA] Fall back from unsupported GEMV spatial tiles - #20330

Open
Nanmur wants to merge 1 commit into
apache:mainfrom
Nanmur:codex/fix-dlight-gemv-symbolic-extent
Open

[DLight][CUDA] Fall back from unsupported GEMV spatial tiles#20330
Nanmur wants to merge 1 commit into
apache:mainfrom
Nanmur:codex/fix-dlight-gemv-symbolic-extent

Conversation

@Nanmur

@Nanmur Nanmur commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

The GPU GEMV schedule assumes that the outer spatial loop produced by its thread-tile split has extent one. It checks this by reading .extent.value, which crashes when the extent is a FloorDiv; for the convolution shapes in #20047, the extent is also genuinely larger than one, so forcing this GEMV schedule is not valid.

This change uses arith.Analyzer.can_prove_equal at the three unit-extent guards. When the selected GEMV configuration cannot prove that the outer extent is one, the rule returns None, allowing ApplyDefaultSchedule to continue to the GPU Fallback rule.

The regression test uses the lowered TIR for the reported 1x1x3x10 input and 1x1x1x2 kernel. It verifies that GEMV declines the unsupported configuration and Fallback produces a scheduled PrimFunc instead of raising AttributeError or AssertionError.

Fixes #20047

Tests:

  • python -m pytest tests/python/s_tir/dlight/test_gpu_gemv.py -q (15 passed)
  • Relax CUDA default-pipeline probe for the reported conv2d shape
  • python -m ruff check python/tvm/s_tir/dlight/gpu/gemv.py tests/python/s_tir/dlight/test_gpu_gemv.py
  • python -m ruff format --check python/tvm/s_tir/dlight/gpu/gemv.py tests/python/s_tir/dlight/test_gpu_gemv.py

The GEMV rule assumed that each outer spatial tile extent was an IntImm equal to one. Some valid convolution shapes produce a FloorDiv extent greater than one, causing an AttributeError or assertion failure.

Use the arithmetic analyzer to prove the unit-extent requirement and decline the GEMV rule when it is not satisfied, allowing the GPU fallback rule to schedule the PrimFunc. Add a regression test for the reported convolution shape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] relax.build crashes with an AttributeError during the dlight GPU scheduling pass

1 participant