Skip to content

Try dumping, when a SPIR-T pass panics, its in-progress spirt::Module state. #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eddyb
Copy link
Collaborator

@eddyb eddyb commented Aug 11, 2025

While SPIR-T passes should, in principle, never panic, it can still happen (esp. with WIP code, where e.g. assert!s or todo!()s might be overrepresented etc.), and before this PR, the partially modified SPIR-T module would be completely lost in the --dump-spirt-passes output.

And because incomplete SPIR-T mutation could result in extremely malformed modules, this PR also wraps the SPIR-T pretty-printing in std::panic::catch_unwind, removing one pass' "after" state, at a time, from the pretty-printed versions, while it still panics, and showing an extra warning (with all the pass names that couldn't be printed) if that was necessary at all.

Also, there's a minor ergonomic fix in that after_pass doesn't need to also be passed the same string as before_pass (since SpirtDumpGuard is tracking it anyway).

@eddyb eddyb enabled auto-merge August 11, 2025 23:03
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.

1 participant