Refactor NNX Variable to remove legacy JAX QDD dependencies. - #5541
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_956706439
branch
3 times, most recently
from
July 31, 2026 22:11
7f20437 to
1ccef71
Compare
With the removal of Quasi-Dynamic Data (QDD) from JAX (`jax.experimental.hijax`), `Variable` with `hijax=True` is transitioned from a QDD-based mutable high-level type to a standard non-QDD high-level type (`HiType`). Key modifications include: * Removing `VariableQDD`, `VariableEffect`, and all QDD parameter flags across variable primitives and classes. * Updating `AbstractVariable` to inherit directly from `hjx.HiType` with non-QDD lowering handlers (`lo_ty`, `lower_val`, `raise_val`). * Enabling an Eager-Local mutation model where `hijax=True, ref=False` variables support local in-place updates outside JAX transformations, while raising `ImmutableVariableError` when mutation is attempted inside functional tracing scopes (`jit`, `grad`, `scan`). * Implementing unflattening in `AbstractVariable.__str__` and `__repr__` to render informative string summaries during tracing. * Guarding `jax.new_ref` against abstract shape structures (`ShapeDtypeStruct`) during post-evaluation graph unflattening. * Migrating side-effect unit tests across `mutable_array_test`, `integration_test`, and `transforms_test` to use `ref=True`. PiperOrigin-RevId: 957354105
copybara-service
Bot
force-pushed
the
test_956706439
branch
from
July 31, 2026 22:12
1ccef71 to
c31deb2
Compare
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.
Refactor NNX Variable to remove legacy JAX QDD dependencies.
With the removal of Quasi-Dynamic Data (QDD) from JAX (
jax.experimental.hijax),Variablewithhijax=Trueis transitioned from a QDD-based mutable high-level type to a standard non-QDD high-level type (HiType).Key modifications include:
VariableQDD,VariableEffect, and all QDD parameter flags across variable primitives and classes.AbstractVariableto inherit directly fromhjx.HiTypewith non-QDD lowering handlers (lo_ty,lower_val,raise_val).hijax=True, ref=Falsevariables support local in-place updates outside JAX transformations, while raisingImmutableVariableErrorwhen mutation is attempted inside functional tracing scopes (jit,grad,scan).AbstractVariable.__str__and__repr__to render informative string summaries during tracing.jax.new_refagainst abstract shape structures (ShapeDtypeStruct) during post-evaluation graph unflattening.mutable_array_test,integration_test, andtransforms_testto useref=True.