Use convert_element_type instead of device_put_raw.#6400
Use convert_element_type instead of device_put_raw.#6400copybara-service[bot] merged 4 commits intojax-ml:masterfrom
Conversation
|
Hi - out of curiosity, what was the impetus for this change? I ask because this kind of change tends to have subtle unintented consequences, so I'd prefer to avoid it unless there is good reason. |
|
Also, this code was written this way for performance, so we'd want to check some benchmarks for any change! #3350 has some basic microbenchmarks for |
mattjj
left a comment
There was a problem hiding this comment.
Great find, Parker! (See jax-dev chat thread for more discussion.)
|
I ran the simple |
For reference: jax-ml/jax#6400. PiperOrigin-RevId: 369466397
For reference: jax-ml/jax#6400. PiperOrigin-RevId: 369466397
For reference: jax-ml/jax#6400. PiperOrigin-RevId: 369471455
also add a test for not performing H2D transfers while tracing jnp.array
With jax-ml/jax#6400, jnp.array delays resolving the axis name until after tracing is complete. PiperOrigin-RevId: 370356687
With jax-ml/jax#6400, jnp.array delays resolving the axis name until after tracing is complete. PiperOrigin-RevId: 370356687
With jax-ml/jax#6400, jnp.array delays resolving the axis name until after tracing is complete. PiperOrigin-RevId: 370356687
With jax-ml/jax#6400, jnp.array delays resolving the axis name until after tracing is complete. PiperOrigin-RevId: 370798828
For reference: jax-ml/jax#6400. PiperOrigin-RevId: 372376815
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
|
@googlebot I consent. |
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
This PR changes `jax.numpy.array()` to avoid creating any on-device arrays during tracing. As a consequence, calls to `jnp.array()` in a traced context, such as `jax.jit` will always be staged into the trace. This change may break code that depends on the current (undocumented and unintentional) behavior of `jnp.array()` to perform shape or index calculations that must be known statically (at trace time). The workaround for such cases is to use classic NumPy to perform shape/index calculations. PiperOrigin-RevId: 395998020
This PR changes `jax.numpy.array()` to avoid creating any on-device arrays during tracing. As a consequence, calls to `jnp.array()` in a traced context, such as `jax.jit` will always be staged into the trace. This change may break code that depends on the current (undocumented and unintentional) behavior of `jnp.array()` to perform shape or index calculations that must be known statically (at trace time). The workaround for such cases is to use classic NumPy to perform shape/index calculations. PiperOrigin-RevId: 395998020
This PR changes `jax.numpy.array()` to avoid creating any on-device arrays during tracing. As a consequence, calls to `jnp.array()` in a traced context, such as `jax.jit` will always be staged into the trace. This change may break code that depends on the current (undocumented and unintentional) behavior of `jnp.array()` to perform shape or index calculations that must be known statically (at trace time). The workaround for such cases is to use classic NumPy to perform shape/index calculations. PiperOrigin-RevId: 398008511
This PR changes `jax.numpy.array()` to avoid creating any on-device arrays during tracing. As a consequence, calls to `jnp.array()` in a traced context, such as `jax.jit` will always be staged into the trace. This change may break code that depends on the current (undocumented and unintentional) behavior of `jnp.array()` to perform shape or index calculations that must be known statically (at trace time). The workaround for such cases is to use classic NumPy to perform shape/index calculations. PiperOrigin-RevId: 398008511
For reference: jax-ml/jax#6400. PiperOrigin-RevId: 369471455
With jax-ml/jax#6400, jnp.array delays resolving the axis name until after tracing is complete. PiperOrigin-RevId: 370798828
No description provided.