Fix AOT compilation with donated Jittable arguments#334
Open
edawite wants to merge 1 commit into
Open
Conversation
Treat JAX ArgInfo placeholders as dynamic pytree children while staging ahead-of-time compiled functions. This keeps Distrax Jittable metadata stable between tracing and compiled invocation when donate_argnums is used, with a regression test covering the compiled-call path.
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.
Summary
Treat
jax.stages.ArgInfoplaceholders as dynamic JAX data when flattening DistraxJittableobjects.During ahead-of-time staging with
donate_argnums, JAX replaces donated array leaves withArgInfodescriptors. Distrax currently classifies those descriptors as static metadata, so the compiled input pytree records different auxiliary data from the runtime distribution and rejects the call.Keeping
ArgInfoin the dynamic children preserves a stable pytree definition between tracing and compiled invocation. The regression test covers the completetrace(...).lower().compile()path with a donatedJittableargument.Fixes #308.
Testing
python -m pytest distrax/_src/utils/jittable_test.py -qwith JAX 0.7.2: 7 passedCategoricalAOT donation reproduction with JAX 0.10.1python -m ruff check --no-cache distrax/_src/utils/jittable.py distrax/_src/utils/jittable_test.pygit diff --checkThe full Windows suite was attempted but stalled in parallel JAX workers without reporting a test failure; GitHub CI is the authoritative full-suite run.