[Bug] [Relax] ToMixedPrecision crashes with missing expr type on tuple-returning ops (batch_norm, dropout, topk, split)
メンテナーはふだん 3 日以内に返信
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 13.9k
- フォーク
- 4.1k
- 平均マージ
- 4日 22時間
- マージ済み PR(30日)
- 22
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/tvm のほかの issue
-
[Bug] [Relax] `relax.op.unique(return_inverse=True)` returns an input-shaped inverse for N-D input when `axis` is None対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
[Bug][TOPI] `topi.scanop` (`cumsum` / `cumprod`) performs out-of-bounds write/read on empty tensorsオープンneeds-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 3 日以内に返信
-
[Bug] [Relax] take_backward does not normalize negative axis causing heap OOB write and wrong gradients対応中かも @pierceluu10 が 4 日前に担当しました。 オープンneeds-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
[Bug][Relax][ONNX] NonZero returns the wrong output shape for scalar inputs対応中かも @tandede が 9 日前に担当しました。 オープンneeds-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 3 日以内に返信
-
needs-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 3 日以内に返信
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
web-push-libs/pywebpush#216 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AgriciDaniel/claude-seo#572 ·
メンテナーはふだん 5 日以内に返信
-
area:print-dispatch
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
area: docs domain: technical-writing good first issue type: documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
Deepak3699/Ai_Mentor#919 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信