Skip to content

[AIMIGRAPHX-950] Revert to cout for driver output#4804

Open
eddieliao wants to merge 1 commit intodevelopfrom
output_to_cout
Open

[AIMIGRAPHX-950] Revert to cout for driver output#4804
eddieliao wants to merge 1 commit intodevelopfrom
output_to_cout

Conversation

@eddieliao
Copy link
Copy Markdown
Contributor

@eddieliao eddieliao commented Apr 20, 2026

Motivation

Reverts usage of the logger for printouts in driver main. This is to ensure current CI runs still work properly. Warnings are still kept on logger and will be output to std::cerr.

Technical Details

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 pfultz2 April 20, 2026 21:32
@eddieliao eddieliao self-assigned this Apr 20, 2026
@eddieliao eddieliao requested a review from causten as a code owner April 20, 2026 21:32
Copilot AI review requested due to automatic review settings April 20, 2026 21:32
@eddieliao eddieliao added the Changelog: Not Applicable This PR is not to be included in the Changelog. label Apr 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Reverts driver “informational” output in src/driver/main.cpp from the MIGraphX logger back to plain stdout printing to preserve CI/script expectations, while keeping warnings on the logger (stderr).

Changes:

  • Switched multiple log::info() printouts (load/compile/verify/run/time/perf/roctx) to std::cout.
  • Updated driver invocation, MIGraphX env dump, and completion message in main() to print to std::cout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/driver/main.cpp
file_type = get_file_type(file);
}
log::info() << "Reading: " << file;
std::cout << "Reading: " << file << std::endl;
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

std::cout is used here, but this file does not include <iostream> (it currently relies on transitive includes). Please add an explicit #include <iostream> to make the dependency correct and resilient to header/include changes.

Copilot uses AI. Check for mistakes.
Comment thread src/driver/main.cpp
std::string driver_invocation =
std::string(argv[0]) + " " + migraphx::to_string_range(original_args, " ");
migraphx::log::info() << "Running [ " << get_version() << " ]: " << driver_invocation;
std::cout << "Running [ " << get_version() << " ]: " << driver_invocation << std::endl;
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

PR description says driver printouts in main are reverted to std::cout, but --ort-sha and --version paths still print via migraphx::log::info() (which may add formatting/prefixes and break scripts expecting plain stdout). Consider switching those to std::cout as well for consistency with the stated goal.

Copilot uses AI. Check for mistakes.
Comment thread src/driver/main.cpp
Comment on lines 1124 to +1127

std::string driver_invocation =
std::string(argv[0]) + " " + migraphx::to_string_range(original_args, " ");
migraphx::log::info() << "Running [ " << get_version() << " ]: " << driver_invocation;
std::cout << "Running [ " << get_version() << " ]: " << driver_invocation << std::endl;
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

The nearby comment indicates the first lines printed should follow the configured log level, but this message is now written to std::cout (independent of log severity). Please update/remove that comment (and/or the early log-level handling) so the code/comments remain accurate.

Copilot uses AI. Check for mistakes.
Comment thread src/driver/main.cpp
file_type = get_file_type(file);
}
log::info() << "Reading: " << file;
std::cout << "Reading: " << file << std::endl;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I dont think its necessary to output status updates to cout. Those can go to the logger. I am not sure what other people think about that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@causten Thoughts? IMO the important ones are the perf numbers (already on cout) and potentially the command/env vars used, but if you'd like all the status updates to cout this PR does just that.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I prefer logger, either is ok.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since this is a program that runs, not the actual migraphx library, lets get this back to the way all previous releases has printed it directly to stdout

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I prefer logger, either is ok.

I would prefer the logger as well because:

  • It shows a timestamp on each status update so you can see what has happened when
  • We can easily disable the extraneous output by disabling the logger or upping the log level to get more important information.

Intended output such as program output, times, perf reports, etc, should of course go to std out.

Comment thread src/driver/main.cpp
std::string driver_invocation =
std::string(argv[0]) + " " + migraphx::to_string_range(original_args, " ");
migraphx::log::info() << "Running [ " << get_version() << " ]: " << driver_invocation;
std::cout << "Running [ " << get_version() << " ]: " << driver_invocation << std::endl;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The logger does need to at least be used here otherwise it wont print the time stamp.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Would creating a separate cout sink work as a solution? The issue with the logger defaulting to the cerr sink is that the CI perf runs treat any output to cerr as a failure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alternatively we edit the CI script to disable the logger when running and only collect perf results.

Copy link
Copy Markdown
Collaborator

@pfultz2 pfultz2 Apr 21, 2026

Choose a reason for hiding this comment

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

We could set the log level to warning in the CI so it will only log important messages: MIGRAPHX_LOG_LEVEL=2.

Comment thread src/driver/main.cpp
std::chrono::duration_cast<std::chrono::duration<double>>(end_time - start_time);
migraphx::log::info() << "[ " << get_version() << " ] Complete(" << duration.count()
<< "s): " << driver_invocation;
std::cout << "[ " << get_version() << " ] Complete(" << duration.count()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The logger also needs to be used here so it will print the timestamp.

@causten
Copy link
Copy Markdown
Collaborator

causten commented Apr 22, 2026

Test Batch New Rate (41ebba) Old Rate (0681c6) Diff Status
torchvision-resnet50 64 3,150.46 3,166.53 -0.51%
torchvision-resnet50_fp16 64 6,517.98 6,820.89 -4.44%
torchvision-densenet121 32 2,628.32 2,422.10 8.51% 🔆
torchvision-densenet121_fp16 32 4,392.89 4,086.15 7.51% 🔆
torchvision-inceptionv3 32 1,803.01 1,658.01 8.75% 🔆
torchvision-inceptionv3_fp16 32 2,781.57 2,677.22 3.90%
cadene-inceptionv4 16 827.56 789.08 4.88%
cadene-resnext64x4 16 781.69 790.86 -1.16%
slim-mobilenet 64 8,363.64 8,521.12 -1.85%
slim-nasnetalarge 64 175.72 218.37 -19.53% 🔴
slim-resnet50v2 64 2,568.52 3,288.39 -21.89% 🔴
bert-mrpc-onnx 8 684.64 1,108.72 -38.25% 🔴
bert-mrpc-tf 1 465.76 456.31 2.07%
pytorch-examples-wlang-gru 1 358.55 338.72 5.85% 🔆
pytorch-examples-wlang-lstm 1 465.28 452.66 2.79%
torchvision-resnet50_1 1 371.72 748.69 -50.35% 🔴
cadene-dpn92_1 1 421.01 403.71 4.28%
cadene-resnext101_1 1 367.57 323.10 13.76% 🔆
onnx-taau-downsample 1 399.34 391.86 1.91%
dlrm-criteoterabyte 1 32.89 31.56 4.22%
dlrm-criteoterabyte_fp16 1 49.45 50.03 -1.15%
agentmodel 1 2,957.74 10,347.89 -71.42% 🔴
unet_fp16 2 52.57 55.66 -5.55% 🔴
resnet50v1_fp16 1 827.78 994.78 -16.79% 🔴
resnet50v1_int8 1 908.08 943.47 -3.75%
bert_base_cased_fp16 64 753.79 1,086.36 -30.61% 🔴
bert_large_uncased_fp16 32 186.99 338.39 -44.74% 🔴
bert_large_fp16 1 160.91 198.67 -19.01% 🔴
distilgpt2_fp16 16 1,034.73 2,066.44 -49.93% 🔴
yolov5s 1 74.46 549.43 -86.45% 🔴
tinyllama 1 10.65 43.80 -75.68% 🔴
vicuna-fastchat 1 29.82 42.63 -30.04% 🔴
whisper-tiny-encoder 1 413.82 406.13 1.89%
whisper-tiny-decoder 1 405.45 395.21 2.59%
llama2_7b 1 20.25 19.10 6.05% 🔆
qwen1.5-7b 1 17.01 23.42 -27.38% 🔴
phi3-3.8b 1 26.66 26.63 0.14%
llama3-8b 1 21.79 21.68 0.53%
whisper-large-encoder 1 7.71 10.12 -23.82% 🔴
whisper-large-decoder 1 101.18 101.03 0.15%
mistral-7b 1 19.54 23.64 -17.35% 🔴
FLUX.1-schnell 1 754.13 737.25 2.29%

Regressions detected 🔴

@causten
Copy link
Copy Markdown
Collaborator

causten commented Apr 22, 2026

Test Status Result
bert-mrpc-onnx PASSED: MIGraphX meets tolerance
bert-mrpc-tf PASSED: MIGraphX meets tolerance
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 PASSED: MIGraphX meets tolerance
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
Traceback (most recent call last):
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 360, in
main()
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 211, in main
model = migraphx.parse_onnx(model_name, default_dim_value=batch)
RuntimeError: /src/AMDMIGraphX/src/include/migraphx/op/convolution.hpp:103: normalize_compute_shape: CONVOLUTION: mismatched channel numbers
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. ok-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants