Skip to content

[consts] Fix handling of closed-over constants in MPMD - #1404

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_929077635
Open

[consts] Fix handling of closed-over constants in MPMD#1404
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_929077635

Conversation

@copybara-service

Copy link
Copy Markdown

[consts] Fix handling of closed-over constants in MPMD

These changes are needed when we will set JAX_USE_SIMPLIFIED_JAXPR_CONSTANTS=1,
to enable the new JAX handling of closed-over constants. Until then,
num_const_args is 0 throughout.

See https://docs.jax.dev/en/latest/internals/constants.html for some implementation details.

One challenge with handling closed-over constants is that jax_fn_info
(a sequence of ArgInfo) refers strictly to the actual function arguments,
while the argument lists include the hoisted constant arguments as
a prefix (num_const_args of them).
In this CL we adjust the code to handle the case when num_const_args
is not 0.

These changes are needed when we will set JAX_USE_SIMPLIFIED_JAXPR_CONSTANTS=1,
to enable the new JAX handling of closed-over constants. Until then,
`num_const_args` is 0 throughout.

See https://docs.jax.dev/en/latest/internals/constants.html for some implementation details.

One challenge with handling closed-over constants is that jax_fn_info
(a sequence of ArgInfo) refers strictly to the actual function arguments,
while the argument lists include the hoisted constant arguments as
a prefix (`num_const_args` of them).
In this CL we adjust the code to handle the case when `num_const_args`
is not 0.

PiperOrigin-RevId: 929077635
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