[Bug] [Relax] ToMixedPrecision crashes with missing expr type on tuple-returning ops (batch_norm, dropout, topk, split)
Los mantenedores suelen responder en 3 días
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 58/100
Línea de trabajo
Start by reproducing the crash with the provided SplitMod and BatchNormMod examples, then trace relax.transform.ToMixedPrecision to the GetType call that receives an expression with a missing type. Check how tuple-returning operators are handled, including dropout and topk, and add regression coverage for the listed cases. Done when ToMixedPrecision("float16") succeeds on normalized, well-formed modules containing these operators.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Expected behavior
relax.transform.ToMixedPrecision("float16") should succeed on normalized, well_formed Relax IRModules containing standard tuple-returning operators such as R.nn.batch_norm, R.nn.dropout, R.topk(..., ret_type="both"), and R.split.
Actual behavior
Calling relax.transform.ToMixedPrecision("float16") on any Relax function containing a tuple-returning operator crashes immediately with an InternalError in tvm::relax::GetType(const Expr&) — even when relax.transform.Normalize() and relax.analysis.well_formed() are run immediately beforehand:
File "/project/include/tvm/relax/type.h", line 401, in tvm::Type tvm::relax::GetType(const Expr&)
tvm.error.InternalError: Check failed: (!expr->ty.IsMissing()) is false: The type is not populated, check if you have normalized the expr
Verified to crash identically on all of the following minimal 5-line modules:
R.nn.batch_norm(..., training=True)R.nn.batch_norm(..., training=False)R.nn.dropout(x, rate=0.5)R.topk(x, k=3, axis=1, ret_type="both")R.split(x, 2, axis=1)
Environment
- TVM version:
apache-tvm==0.27.0.post1 - OS: Linux (x86_64)
- Python: 3.12.x
- Target:
llvm(backend-independent — crashes insiderelax.transform.ToMixedPrecision)
Steps to reproduce
import tvm
from tvm import relax
from tvm.script import ir as I, relax as R
@I.ir_module
class SplitMod:
@R.function
def main(x: R.Tensor((4, 8), "float32")) -> R.Tensor((4, 4), "float32"):
with R.dataflow():
t = R.split(x, 2, axis=1)
y = t[0]
R.output(y)
return y
@I.ir_module
class BatchNormMod:
@R.function
def main(
x: R.Tensor((2, 4, 4, 4), "float32"),
g: R.Tensor((4,), "float32"),
b: R.Tensor((4,), "float32"),
m: R.Tensor((4,), "float32"),
v: R.Tensor((4,), "float32"),
) -> R.Tensor((2, 4, 4, 4), "float32"):
with R.dataflow():
bn = R.nn.batch_norm(x, g, b, m, v, axis=1, training=False)
y = bn[0]
R.output(y)
return y
for name, mod in [("split", SplitMod), ("batch_norm", BatchNormMod)]:
mod = relax.transform.Normalize()(mod)
relax.analysis.well_formed(mod)
print(f"Running ToMixedPrecision on {name}...")
relax.transform.ToMixedPrecision("float16")(mod)
Observed output on apache-tvm==0.27.0.post1:
Running ToMixedPrecision on split...
Traceback (most recent call last):
...
File "/project/include/tvm/relax/type.h", line 401, in tvm::Type tvm::relax::GetType(const Expr&)
tvm.error.InternalError: Check failed: (!expr->ty.IsMissing()) is false: The type is not populated, check if you have normalized the expr
BatchNormMod (both training=False and training=True), R.nn.dropout, and R.topk(..., ret_type="both") crash with the exact same stack trace.
Triage
- needs-triage
- relax
- 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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/tvm
-
[Bug] [Relax] `relax.op.unique(return_inverse=True)` returns an input-shaped inverse for N-D input when `axis` is NonePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 3 días
-
[Bug][TOPI] `topi.scanop` (`cumsum` / `cumprod`) performs out-of-bounds write/read on empty tensorsAbiertoneeds-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 3 días
-
[Bug] [Relax] take_backward does not normalize negative axis causing heap OOB write and wrong gradientsPosiblemente ocupada @pierceluu10 la tomó hace 4 días. Abiertoneeds-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 3 días
-
[Bug][Relax][ONNX] NonZero returns the wrong output shape for scalar inputsPosiblemente ocupada @tandede la tomó hace 9 días. Abiertoneeds-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 3 días
-
needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/tvm#21043 · 1 comentario ·
Los mantenedores suelen responder en 3 días
Todos los issues de apache/tvm
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
web-push-libs/pywebpush#216 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AgriciDaniel/claude-seo#572 ·
Los mantenedores suelen responder en 5 días
-
area:print-dispatch
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
Los mantenedores suelen responder en 1 día
-
area: docs domain: technical-writing good first issue type: documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Deepak3699/Ai_Mentor#919 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día