fix[next]: Catch exceptions thrown in async build pool#2675
Open
edopao wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes error surfacing for asynchronous compilation in gt4py.next compiled backends by tracking submitted compilation futures and re-raising their exceptions during gtx.wait_for_compilation(), preventing later runtime failures (e.g., KeyError on program call). It also extends integration test coverage to exercise both synchronous and asynchronous compilation modes under executor failure.
Changes:
- Track async compilation futures in a global registry and re-raise
Futureexceptions inwait_for_compilation(). - Register each submitted async compilation job in the new pending-futures registry.
- Extend
test_wait_for_compilationto cover success/failure and synchronous/asynchronous compilation modes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/gt4py/next/otf/compiled_program.py |
Adds global pending-futures tracking and surfaces async compilation exceptions via wait_for_compilation(). |
tests/next_tests/integration_tests/feature_tests/ffront_tests/test_compiled_program.py |
Expands integration test matrix to validate exception surfacing behavior across sync/async compilation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The executor call in compiled backends runs as a future when asynchronous compilation is enabled. The current code did not catch exceptions thrown by the future, so any lowering/compilation error resulted in a
KeyErrorat runtime when calling the corresponding program. This PR addresses this issue and adds test coverage.A side effect of this change is that unit tests that call
wait_for_compilation()in a multi-thread pytest session might catch exceptions thrown by other tests, because the build thread pool is a shared resource. This PR limits the pool size to 1, so that the compile failure can be caught in the unit test where it originates from.