Commit ed3f8bf
authored
Fix build errors of GridSample and test failures in test_attention_fusion.py (#27642)
# Description
This PR addresses a build error and subsequent test failures related to
recent changes in GridSample and the transformer optimizer. Related PRs:
#27201, #27556.
## Changes
### 1. Fix GridSample Build Error
- Removed an unused local variable `mode_str` in
`onnxruntime/core/providers/cuda/tensor/grid_sample.cc` that was causing
a warning (treated as error) about shadowing a member variable.
- Ref:
[`grid_sample.cc`](https://github.com/microsoft/onnxruntime/blob/c979a2407f/onnxruntime/core/providers/cuda/tensor/grid_sample.cc#L54)
### 2. Update GridSample Tests
- Updated
`onnxruntime/test/providers/cpu/tensor/grid_sample_test_custom.inc` to
use default execution providers in `RunTests` instead of a hardcoded
opset version, ensuring compatibility across different environments.
### 3. Revert Transformer Fusion Fallback
- Reverted a recent change in
`onnxruntime/python/tools/transformers/fusion_skiplayernorm.py` that
enabled a fallback for `SkipLayerNormalization` fusion when symbolic
shape inference fails.
- This revert was necessary to avoid regressions in GPT-2 tests where
model definitions contain typos that intentionally (or coincidentally)
break shape inference.
- Ref:
[`fusion_skiplayernorm.py`](https://github.com/microsoft/onnxruntime/blob/c979a2407f/onnxruntime/python/tools/transformers/fusion_skiplayernorm.py#L113)
### 4. Restore Transformer Test Parity
- Updated
`onnxruntime/test/python/transformers/test_attention_fusion.py`
specifically `test_qwen3_normalization_fusion` to match the expected
node counts after reverting the fusion fallback.
- Ref:
[`test_attention_fusion.py`](https://github.com/microsoft/onnxruntime/blob/c979a2407f/onnxruntime/test/python/transformers/test_attention_fusion.py#L398)
## Verification
- `build_cuda.sh` completed successfully.
- `onnxruntime/test/python/transformers/test_attention_fusion.py` passes
with "OK".
- `lintrunner -a` reports no issues.1 parent e5f5a6a commit ed3f8bf
4 files changed
Lines changed: 10 additions & 13 deletions
File tree
- onnxruntime
- core/providers/cuda/tensor
- python/tools/transformers
- test
- providers/cpu/tensor
- python/transformers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 113 | + | |
| 114 | + | |
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | | - | |
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
399 | | - | |
| 398 | + | |
| 399 | + | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
403 | | - | |
| 402 | + | |
| 403 | + | |
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
408 | | - | |
| 407 | + | |
| 408 | + | |
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| |||
0 commit comments