Skip to content

[ROCM-26203] Modify existing tests to work with pytest#4980

Open
eddieliao wants to merge 1 commit into
developfrom
pytest_fixes
Open

[ROCM-26203] Modify existing tests to work with pytest#4980
eddieliao wants to merge 1 commit into
developfrom
pytest_fixes

Conversation

@eddieliao

@eddieliao eddieliao commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Motivation

Modifies some of our existing tests to work properly with pytest.

Technical Details

By default, pytest picks up any functions in the format of test_* or *_test and runs them as tests. This PR adds an underscore prefix to any functions that are meant to be helpers and not actual tests.

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

@eddieliao eddieliao requested a review from Copilot June 17, 2026 15:14
@eddieliao eddieliao self-assigned this Jun 17, 2026
@eddieliao eddieliao added python Pull requests that update python code Changelog: Not Applicable This PR is not to be included in the Changelog. labels Jun 17, 2026
@causten causten requested review from ahsan-ca and kentqian June 17, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Python tests under test/py/ to behave correctly under pytest’s test discovery rules by preventing helper functions from being collected as tests.

Changes:

  • Rename helper functions from test_* to _test_* to avoid pytest collection.
  • Replace the old test_conv_relu(format) pattern (which pytest interprets as needing a fixture) with two explicit tests for msgpack/json serialization.
  • Update copyright headers to 2026 in the modified files.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/py/test_save_load.py Renames the format-taking helper and adds explicit serialization tests (msgpack, json) to avoid pytest fixture/collection issues.
test/py/test_array.py Renames test_shape helper to _test_shape and updates its call sites to prevent unintended pytest collection.
Comments suppressed due to low confidence (1)

test/py/test_save_load.py:31

  • The helper parameter name format shadows Python’s built-in format() and makes the call sites harder to read. Consider renaming the parameter to something more specific (e.g., serialization_format) and forwarding that into migraphx.save/load.
def _test_conv_relu(format):
    p1 = migraphx.parse_onnx("conv_relu_maxpool_test.onnx")
    print(p1)

    s1 = p1.get_output_shapes()[-1]

Comment thread test/py/test_array.py
@eddieliao eddieliao marked this pull request as ready for review June 17, 2026 15:40
@eddieliao eddieliao requested a review from causten as a code owner June 17, 2026 15:40
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4980   +/-   ##
========================================
  Coverage    92.73%   92.73%           
========================================
  Files          592      594    +2     
  Lines        31289    31340   +51     
========================================
+ Hits         29015    29063   +48     
- Misses        2274     2277    +3     

see 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gh-app-migraphx-bot-pr-write

Copy link
Copy Markdown
Test Batch New Rate (58fc8c) Old Rate (241f7a)* Diff Status
torchvision-resnet50 64 3,144.33 3,158.05 -0.43%
torchvision-resnet50_fp16 64 6,580.53 6,678.10 -1.46%
torchvision-densenet121 32 2,693.74 2,705.33 -0.43%
torchvision-densenet121_fp16 32 4,493.13 4,480.31 0.29%
torchvision-inceptionv3 32 1,784.60 1,772.37 0.69%
torchvision-inceptionv3_fp16 32 2,826.71 2,613.31 8.17% 🔆
cadene-inceptionv4 16 816.60 444.89 83.55% 🔆
cadene-resnext64x4 16 774.46 412.50 87.75% 🔆
slim-mobilenet 64 8,388.98 8,419.17 -0.36%
slim-nasnetalarge 64 228.52 nan nan
slim-resnet50v2 64 3,313.74 1,641.82 101.83% 🔆
bert-mrpc-onnx 8 1,169.70 1,165.20 0.39%
bert-mrpc-tf 1 492.67 492.10 0.12%
pytorch-examples-wlang-gru 1 328.89 334.96 -1.81%
pytorch-examples-wlang-lstm 1 452.23 469.54 -3.69%
torchvision-resnet50_1 1 763.42 760.64 0.37%
cadene-dpn92_1 1 451.75 457.65 -1.29%
cadene-resnext101_1 1 363.46 363.68 -0.06%
onnx-taau-downsample 1 400.00 401.93 -0.48%
dlrm-criteoterabyte 1 32.35 12.36 161.66% 🔆
dlrm-criteoterabyte_fp16 1 51.78 29.66 74.60% 🔆
agentmodel 1 11,993.40 10,523.13 13.97% 🔆
unet_fp16 2 56.82 57.23 -0.70%
resnet50v1_fp16 1 959.87 959.87 0.00%
resnet50v1_int8 1 927.25 942.92 -1.66%
bert_base_cased_fp16 64 1,097.68 1,092.47 0.48%
bert_large_uncased_fp16 32 346.26 345.19 0.31%
bert_large_fp16 1 204.51 203.23 0.63%
distilgpt2_fp16 16 2,091.02 2,096.77 -0.27%
yolov5s 1 567.79 564.74 0.54%
tinyllama 1 45.94 46.00 -0.13%
vicuna-fastchat 1 44.08 44.04 0.11%
whisper-tiny-encoder 1 417.42 419.55 -0.51%
whisper-tiny-decoder 1 414.06 414.85 -0.19%
llama2_7b 1 12.19 20.42 -40.28% 🔴
qwen1.5-7b 1 23.44 21.75 7.76% 🔆
phi3-3.8b 1 23.35 26.81 -12.92% 🔴
llama3-8b 1 10.71 21.83 -50.96% 🔴
whisper-large-encoder 1 10.28 6.50 58.18% 🔆
whisper-large-decoder 1 24.45 106.80 -77.11% 🔴
mistral-7b 1 12.84 23.85 -46.15% 🔴
FLUX.1-schnell 1 747.52 763.88 -2.14%

Regressions detected 🔴

* No develop baseline was found for this PR's branch point; compared against the latest available develop run instead.

@gh-app-migraphx-bot-pr-write

Copy link
Copy Markdown
Test Status Result
bert-mrpc-onnx PASSED: MIGraphX meets tolerance
bert-mrpc-tf ERROR - check error output
traceback
Traceback (most recent call last):
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 377, in
main()
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 313, in main
import tensorflow as tf
File "/usr/local/lib/python3.10/dist-packages/tensorflow/init.py", line 38, in
from tensorflow.python.tools import module_util as _module_util
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/init.py", line 36, in
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 26, in
self_check.preload_check()
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/platform/self_check.py", line 63, in preload_check
from tensorflow.python.platform import _pywrap_cpu_feature_guard
ImportError: libamdhip64.so.6: cannot open shared object file: No such file or directory
pytorch-examples-wlang-gru PASSED: MIGraphX meets tolerance
pytorch-examples-wlang-lstm PASSED: MIGraphX meets tolerance
dlrm-criteoterabyte PASSED: MIGraphX meets tolerance
agentmodel PASSED: MIGraphX meets tolerance
unet PASSED: MIGraphX meets tolerance
resnet50v1 PASSED: MIGraphX meets tolerance
bert_base_cased_fp16 PASSED: MIGraphX meets tolerance
bert_large_uncased_fp16 🔴 FAILED: MIGraphX is not within tolerance - check verbose output
bert_large PASSED: MIGraphX meets tolerance
yolov5s PASSED: MIGraphX meets tolerance
tinyllama PASSED: MIGraphX meets tolerance
vicuna-fastchat PASSED: MIGraphX meets tolerance
whisper-tiny-encoder PASSED: MIGraphX meets tolerance
whisper-tiny-decoder PASSED: MIGraphX meets tolerance
distilgpt2_fp16 🔴 FAILED: MIGraphX is not within tolerance - check verbose output
llama2_7b PASSED: MIGraphX meets tolerance
qwen1.5-7b PASSED: MIGraphX meets tolerance
phi3-3.8b PASSED: MIGraphX meets tolerance
llama3-8b PASSED: MIGraphX meets tolerance
whisper-large-encoder ERROR - check error output
traceback
2026-06-17 14:11:51.230232 [WARN] [/data/src/onnx/onnx_parser.cpp:282] Model has unbound symbolic dimension(s): batch_size, encoder_sequence_length, feature_size. These default to 1 and may cause unexpected behavior. Try setting --dim-param @<name> <value> or --input-dim @<input> <dims> if program compilation fails.
Traceback (most recent call last):
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 377, in
main()
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 224, in main
model = migraphx.parse_onnx(model_name, default_dim_value=batch)
RuntimeError: /data/src/include/migraphx/op/convolution.hpp:113: normalize_compute_shape: CONVOLUTION: mismatched channel numbers: input channels (1) != weights channels (80) * group (1)
whisper-large-decoder PASSED: MIGraphX meets tolerance
mistral-7b PASSED: MIGraphX meets tolerance
FLUX.1-schnell PASSED: MIGraphX meets tolerance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: Not Applicable This PR is not to be included in the Changelog. python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants