Skip to content

[Bug] dlight GPU GEMV scheduling crashes on Relax dataflow block due to imperfect loop nest after cache_read insertion #20118

Description

@XYZboom

Expected behavior

relax.build(mod, target="cuda") should compile successfully for any valid Relax IR module, including a GEMV pattern (multiply + sum with a dataflow block). The compiled module should execute and produce correct results.

Actual behavior

relax.build crashes with a ScheduleError during the CUDA dlight GPU scheduling pass:

ScheduleError: An error occurred in the schedule primitive 'fuse'.

The IR with diagnostic is:
...
Error message: The loops can't be fused because the inner loop tirx.For#1 is not the only child of outer loop tirx.For#0.

Environment

  • OS: Linux (x86_64, conda environment)
  • GPU: NVIDIA GeForce RTX 3080 Ti (12GB VRAM, CUDA 580.76.05)
  • TVM version: 0.25.0.post1
  • Target: cuda (GPU compilation)
  • Python: 3.12

Steps to reproduce

import tvm
from tvm import relax
from tvm.script import ir as I
from tvm.script import relax as R


@I.ir_module
class Module:
    @R.function
    def main(
        v_0: R.Tensor((2, 2), dtype="float32"),
        v_1: R.Tensor((2,), dtype="float32"),
    ) -> R.Tensor((2,), dtype="float32"):
        with R.dataflow():
            lv: R.Tensor((2, 2), dtype="float32") = R.multiply(v_0, v_1)
            gv: R.Tensor((2,), dtype="float32") = R.sum(lv, axis=[1], keepdims=False)
            R.output(gv)
        return gv


# Crashes here during CUDA build
ex = relax.build(Module, target="cuda")

Triage

  • backend:cuda
  • needs-triage

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address ittype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions