Skip to content

[AIMIGRAPHX-1175] Add terminate handler for Windows#5084

Open
eddieliao wants to merge 3 commits into
developfrom
windows_terminate_handler
Open

[AIMIGRAPHX-1175] Add terminate handler for Windows#5084
eddieliao wants to merge 3 commits into
developfrom
windows_terminate_handler

Conversation

@eddieliao

@eddieliao eddieliao commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Motivation

The migraphx-driver on Windows currently lacks error reporting that Linux has. Example of expected output:

terminate called after throwing an instance of 'migraphx::version_2_16_0::exception'
  what():  /code/AMDMIGraphX/src/onnx/onnx_parser.cpp:1051: get_type: Prototensor data type 8 not supported

Technical Details

MSVC does not install a verbose terminate handler by default which gcc/clang does. This PR installs a terminate handler for Windows only that mirrors the behavior seen on Linux builds.

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.

Follow the LLVM AI Tool Use Policy for contributions using AI.

@eddieliao eddieliao self-assigned this Jul 21, 2026
Copilot AI review requested due to automatic review settings July 21, 2026 20:14
@eddieliao
eddieliao requested a review from causten as a code owner July 21, 2026 20:14
@eddieliao eddieliao added enhancement New feature or request simple small or simple changes Windows Related changes for Windows Environments UAI Changelog: Added New functionality. labels Jul 21, 2026
@eddieliao
eddieliao requested a review from a team as a code owner July 21, 2026 20:17

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

Adds a Windows-only terminate handler to migraphx-driver so uncaught exceptions print a verbose message similar to what users see on Linux, improving diagnostics on Windows builds.

Changes:

  • Introduces verbose_terminate.{hpp,cpp} implementing a verbose std::terminate handler.
  • Installs the handler at migraphx-driver startup on Windows (_WIN32).
  • Adds the new source file to the driver build.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

File Description
src/driver/verbose_terminate.hpp Declares the driver terminate-handler installation entry point.
src/driver/verbose_terminate.cpp Implements the verbose terminate handler and installer.
src/driver/main.cpp Installs the terminate handler on Windows at program start.
src/driver/CMakeLists.txt Adds the new translation unit to the driver target.

Comment thread src/driver/CMakeLists.txt
Comment thread src/driver/verbose_terminate.cpp Outdated
inline namespace MIGRAPHX_INLINE_NS {

namespace {
// Print the active exception's type and what() message, then abort (mirrors libstdc++).
Comment thread src/driver/verbose_terminate.cpp Outdated
Comment thread src/driver/main.cpp Outdated
@eddieliao
eddieliao requested review from CharlieL7 and pfultz2 July 21, 2026 22:04
@gh-app-migraphx-bot-pr-write

Copy link
Copy Markdown
Test Batch New Rate (443e29) Old Rate (6b283c)* Diff Status
torchvision-resnet50 64 3,281.60 3,286.50 -0.15%
torchvision-resnet50_fp16 64 7,619.81 7,625.35 -0.07%
torchvision-densenet121 32 2,505.52 2,504.05 0.06%
torchvision-densenet121_fp16 32 5,049.96 5,012.36 0.75%
torchvision-inceptionv3 32 2,055.18 2,064.70 -0.46%
torchvision-inceptionv3_fp16 32 4,061.19 4,431.92 -8.37% 🔴
cadene-inceptionv4 16 780.32 822.36 -5.11% 🔴
cadene-resnext64x4 16 776.51 785.61 -1.16%
slim-mobilenet 64 8,395.00 8,421.44 -0.31%
slim-nasnetalarge 64 219.11 230.76 -5.05% 🔴
slim-resnet50v2 64 3,192.59 3,209.40 -0.52%
bert-mrpc-onnx 8 1,171.36 1,166.49 0.42%
bert-mrpc-tf 1 474.24 488.00 -2.82%
pytorch-examples-wlang-gru 1 469.07 472.76 -0.78%
pytorch-examples-wlang-lstm 1 382.61 437.48 -12.54% 🔴
torchvision-resnet50_1 1 1,032.14 1,029.11 0.29%
cadene-dpn92_1 1 437.40 446.31 -2.00%
cadene-resnext101_1 1 366.45 365.47 0.27%
onnx-taau-downsample 1 93.08 850.19 -89.05% 🔴
dlrm-criteoterabyte 1 0.74 32.58 -97.72% 🔴
dlrm-criteoterabyte_fp16 1 49.62 52.90 -6.20% 🔴
agentmodel 1 11,727.41 8,883.83 32.01% 🔆
unet_fp16 2 6.73 59.21 -88.64% 🔴
resnet50v1_fp16 1 21.62 1,393.35 -98.45% 🔴
resnet50v1_int8 1 48.28 1,897.46 -97.46% 🔴
bert_base_cased_fp16 64 385.32 1,106.24 -65.17% 🔴
bert_large_uncased_fp16 32 335.07 346.58 -3.32%
bert_large_fp16 1 205.34 207.25 -0.92%
distilgpt2_fp16 16 1,966.35 2,105.76 -6.62% 🔴
yolov5s 1 554.33 564.86 -1.86%
tinyllama 1 16.48 45.89 -64.08% 🔴
vicuna-fastchat 1 44.08 44.03 0.12%
whisper-tiny-encoder 1 414.12 415.29 -0.28%
whisper-tiny-decoder 1 110.99 412.90 -73.12% 🔴
llama2_7b 1 11.15 21.00 -46.89% 🔴
qwen1.5-7b 1 16.28 23.61 -31.03% 🔴
phi3-3.8b 1 26.77 16.42 62.98% 🔆
llama3-8b 1 7.31 21.28 -65.67% 🔴
whisper-large-encoder 1 4.26 10.25 -58.43% 🔴
whisper-large-decoder 1 107.96 107.21 0.70%
mistral-7b 1 10.64 23.59 -54.90% 🔴
FLUX.1-schnell 1 778.20 252.31 208.43% 🔆

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 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 🔴 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 PASSED: MIGraphX meets tolerance
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: Added New functionality. enhancement New feature or request simple small or simple changes UAI Windows Related changes for Windows Environments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants