Skip to content

Refactor NNX Variable to remove legacy JAX QDD dependencies. - #5541

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_956706439
Jul 31, 2026
Merged

Refactor NNX Variable to remove legacy JAX QDD dependencies.#5541
copybara-service[bot] merged 1 commit into
mainfrom
test_956706439

Conversation

@copybara-service

Copy link
Copy Markdown

Refactor NNX Variable to remove legacy JAX QDD dependencies.

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.

@copybara-service
copybara-service Bot force-pushed the test_956706439 branch 3 times, most recently from 7f20437 to 1ccef71 Compare July 31, 2026 22:11
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
copybara-service Bot merged commit c31deb2 into main Jul 31, 2026
1 of 3 checks passed
@copybara-service
copybara-service Bot deleted the test_956706439 branch July 31, 2026 22:12
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.

0 participants