apache / apache/tvm

[Bug] When compiling using TVM's Relax, the output remains the same regardless of the optimization level set.

Open
#18,048 2 comments 0 reactions 0 assignees View on GitHub
needs-triage type: bug
Dominant language
Python
Stars
13.7k
Forks
4k
Avg merge
2d 1h
Merged PRs (30d)
112

Description

When compiling an ONNX model using TVM's Relax, the generated .so files are identical when setting opt_level=0, opt_level=1, opt_level=3, and opt_level=4.
The compilation code I used is as follows:

`onnx_model = onnx.load(onnx_path)
onnx_name = os.path.splitext(os.path.basename(onnx_path))[0]
print(onnx_name)

from tvm.relax.frontend.onnx import from_onnx
mod = from_onnx(onnx_model)

with tvm.transform.PassContext(opt_level=0):
ex = relax.build(mod, target="llvm")

libpath = os.path.join(base_path, f"{onnx_name}_relax_O0.so")`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided ONNX-to-Relax compilation snippet and reproduce the builds at opt_level 0, 1, 3, and 4. Compare the generated .so files and trace how PassContext is applied during relax.build; the issue is complete when the cause of identical outputs is identified and the expected optimization-level behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.