[Bug] `DataflowUseInplaceCalls` produces CUDA TIR that fails scheduling

Abierto
#20,975 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Start with the DataflowUseInplaceCalls pass and the TIR scheduling path that emits the compact-dataflow ScheduleError; the issue does not name source files or tests. Reproduce using the supplied Relax module, comparing compilation before and after the pass with the stated CUDA target and pipelines. Done when the transformed module compiles while the existing reproduction still covers the failure.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

needs-triage type: bug

Expected behavior

Applying relax.transform.DataflowUseInplaceCalls to the valid Relax function below should preserve a compilable program. The untransformed module compiles for CUDA with the same target and pipeline.

Actual behavior

The untransformed module compiles. After DataflowUseInplaceCalls, compilation raises ScheduleError:

The queried subtree root tirx.For#0 in SRef tree does not have compact dataflow,
because its child block tirx.SBlock#1 on SRef tree is neither a local complete
block nor a local reduction block.
...
No overlap between the buffers the block reads and writes

The same failure reproduced in two fresh processes. Batch 15 also produced the same diagnostic from several distinct parent programs; the standalone example below is one confirmed representative.

Environment

  • TVM 0.26.dev0+source.8f328e8
  • Linux 6.8.0-52-generic, x86_64
  • CUDA target; Python environment /opt/conda/envs/tvm-env

Steps to reproduce

import os
import sys

os.environ.setdefault("CUDA_PATH", sys.prefix)
os.environ.setdefault("CUDA_HOME", sys.prefix)
os.environ["PATH"] = sys.prefix + "/bin:" + os.environ.get("PATH", "")

import tvm
from tvm import relax
from tvm.script import ir as I, relax as R, tirx as T


@I.ir_module
class Module:
    @R.function
    def main(x: R.Tensor((1, 4, 1), dtype="float32")) -> R.Tensor((4, 2), dtype="float32"):
        with R.dataflow():
            lv: R.Tensor((4, 1), dtype="float32") = R.squeeze(x, axis=[0])
            lv1: R.Tensor((4, 1), dtype="float32") = R.squeeze(x, axis=[0])
            lv2: R.Tensor((4, 1), dtype="float32") = R.multiply(lv, lv1)
            lv3: R.Tensor((4, 2), dtype="float32") = R.concat((lv2, lv1), axis=1)
            lv1_1: R.Tensor((4, 2), dtype="float32") = R.clip(lv3, T.float64(-0.25), T.float64(0.25))
            lv2_1: R.Tensor((4, 2), dtype="float32") = R.clip(lv3, T.float64(-0.25), T.float64(2.0))
            lv3_1: R.Tensor((4, 2), dtype="float32") = R.multiply(lv2_1, R.const(0.5, "float32"))
            lv4: R.Tensor((4, 2), dtype="float32") = R.subtract(lv1_1, lv3_1)
            lv5: R.Tensor((4, 2), dtype="float32") = R.exp(lv4)
            lv6: R.Tensor((4, 2), dtype="float32") = R.clip(lv3, T.float64(-0.25), T.float64(0.25))
            lv7: R.Tensor((4, 2), dtype="float32") = R.clip(lv5, T.float64(-0.25), T.float64(2.0))
            lv8: R.Tensor((4, 2), dtype="float32") = R.multiply(lv7, R.const(0.5, "float32"))
            lv9: R.Tensor((4, 2), dtype="float32") = R.subtract(lv6, lv8)
            gv: R.Tensor((4, 2), dtype="float32") = R.exp(lv9)
            R.output(gv)
        return gv


before = Module
after = relax.transform.DataflowUseInplaceCalls()(before)
for label, mod in [("OFF", before), ("ON", after)]:
    try:
        with tvm.target.Target("cuda"), tvm.transform.PassContext(
            opt_level=0, disabled_pass=["DataflowInsertInPlaceCalls"]
        ):
            tvm.compile(mod, target="cuda", relax_pipeline="default", tir_pipeline="default")
        print(label, "compiled")
    except Exception as exc:
        print(label, type(exc).__name__, str(exc)[-1000:])

Observed: OFF compiled, followed by ON ScheduleError with the compact-dataflow diagnostic above.

Triage

  • needs-triage
Lenguaje dominante
Python
Estrellas
13.9k
Forks
4.1k
Merge medio
4 d 22 h
PR fusionados (30 d)
22

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/tvm

Todos los issues de apache/tvm

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.