xwoven opened a new issue, #18895:
URL: https://github.com/apache/tvm/issues/18895
## OS verison
WSL2 Ubuntu on x86_64, kernel 6.6.87.2-microsoft-standard-WSL2
## device used for inference
CPU
## Framework
TVM 0.9.0 Python API
ONNX frontend + Relay build + graph_executor
## Model Used
Minimal equivalent-graph repro with two float16 inputs:
- Scalar-like input: shape [1, 1, 1]
- Tensor input: shape [1, 38, 1, 10, 57]
Reference graph:
Input v0_0 -> LeakyReLU
Input v0_0 -> Transpose
Input v0_0 + Input v3_0 -> Tan -> ReduceMean(axis=2)
Equivalent graph:
Input v0_0 -> LeakyReLU
Input v0_0 -> Transpose -> Concat/Split barriers
Input v0_0 + Input v1_0 -> Concat/Concat -> Split -> Tan ->
ReduceMean(axis=2)
The two graphs are expected to be semantically equivalent. Only the
ReduceMean branch shows wrong results.
## Issue description
Two ONNX graphs that should be semantically equivalent produce different
ReduceMean outputs after importing through TVM Relay and executing on CPU.
For this case:
- v5_0 vs v9_0 matches
- v6_0 vs v11_0 matches
- v1_0 vs v15_0 does not match
The mismatching output pair has the same shape and dtype:
- shape = (1, 38, 10, 57)
- dtype = float16
The maximum absolute difference is 1699.0, which indicates a wrong-result
bug in execution or optimization rather than a small numeric drift.
## Step-by-step reproduction
1. Activate the existing fuzzer environment with TVM 0.9.0.
2. Go to the case directory:
bug-Symptom.EQ_INCONSISTENCY-Stage.VERIFICATION-40
3. Run the repro script:
python repro_tvm_min-2.py
4. Observe that the equivalent ReduceMean outputs are inconsistent on CPU.
## Relevant log output
```text
/home/xwoven/miniconda3/envs/fuzzer/lib/python3.10/site-packages/tvm/driver/build_module.py:267:
UserWarning: target_host parameter is going to be deprecated. Please pass in
tvm.target.Target(target, host=target_host) instead.
warnings.warn(
inputs:
v0_0: shape=(1, 1, 1), dtype=float16
v3_0: shape=(1, 38, 1, 10, 57), dtype=float16
compare v5_0 vs v9_0
t1 shape=(1, 1, 1), dtype=float16
t2 shape=(1, 1, 1), dtype=float16
same_shape=True, allclose=True
max_abs_diff=0.0
compare v6_0 vs v11_0
t1 shape=(1, 1, 1), dtype=float16
t2 shape=(1, 1, 1), dtype=float16
same_shape=True, allclose=True
max_abs_diff=0.0
compare v1_0 vs v15_0
t1 shape=(1, 38, 10, 57), dtype=float16
t2 shape=(1, 38, 10, 57), dtype=float16
same_shape=True, allclose=False
max_abs_diff=1699.0
t1 first 16 values: [16.11 -0.9976 -7.926 -0.5874 -1.34 0.7715
-2.113 -1.812 -1.935
18.44 -1.081 0.605 0.8906 -0.2847 -1.57 0.8164]
t2 first 16 values: [17.2 -0.9976 -7.684 -0.593 -1.329 0.7656
-2.113 -1.812 -1.953
17.2 -1.081 0.605 0.8975 -0.2847 -1.57 0.8164]
[FAIL] Bug reproduced with current TVM environment.
```
[repro_tvm_min-2.py](https://github.com/user-attachments/files/25860220/repro_tvm_min-2.py)
[err.log](https://github.com/user-attachments/files/25860227/err.log)
<img width="748" height="601" alt="Image"
src="https://github.com/user-attachments/assets/04e4d6b7-8a48-489d-bdde-f602c19b1178"
/>
<img width="926" height="947" alt="Image"
src="https://github.com/user-attachments/assets/ffd9ec57-579c-4900-b3df-49f6e20ad45d"
/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]