Skip to content

Marshall exception in simple_par_for - #5265

Open
pfultz2 wants to merge 2 commits into
developfrom
simple-par-for-exception
Open

pfultz2 wants to merge 2 commits into
developfrom
simple-par-for-exception

Conversation

@pfultz2

@pfultz2 pfultz2 commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Motivation

This will help improve error reporting. When an exception is thrown with multiple threads, std::terminate is called without the exception message. So this will marshall the exception through so we can get a better error message.

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.

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

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.

🟡 Changes recommended

The parallel test does not reliably exercise worker-thread propagation, and the header copyright range needs updating.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR propagates exceptions from simple_par_for worker threads and adds regression tests.

Changes:

  • Captures and rethrows worker-thread exceptions after joining.
  • Adds serial and parallel exception-handling tests.
File summaries
File Summary
test/simple_par_for.cpp Adds exception tests; the parallel test should explicitly force the worker-thread path.
src/include/migraphx/simple_par_for.hpp Implements exception propagation; update the copyright range to include 2026.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/simple_par_for.cpp
Comment on lines +43 to +46
migraphx::par_for(64, 1, [](std::size_t i) {
if(i % 2 == 0)
MIGRAPHX_THROW("par_for_error");
});
Comment on lines +30 to +31
#include <exception>
#include <mutex>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants