Fix stale tangent reuse in repeated JVPs#3738
Open
chrismicah wants to merge 1 commit into
Open
Conversation
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
mx.jvpshape-corruption repro from [BUG] JVP non-deterministic crashes when called in a loop. #3629.Why
Issue #3629 still reproduces on current
mainafter the earlier partial JVP fixes in #3633 and #3636. On602b5359, the original ray-trace-shaped repro crashed in 9/10 trials with errors such as:The failure is nondeterministic because an older tangent can remain in the JVP transform map when an output id is encountered again. Assigning the output tangent instead of preserving the first inserted value keeps the map aligned with the current primitive output.
Prior related work
Those fixes cover related symptoms, but the original #3629 repro still fails on current
main; this PR fixes a distinct current-main regression in the JVP transform map.Test plan
CMAKE_BUILD_PARALLEL_LEVEL=8 python setup.py build_ext --inplace PYTHONPATH=python python -m pytest python/tests/test_autograd.py -q -k 'repeated_jvp_with_reused_array_ids or jvp_through_bitwise_ops' --tb=short PYTHONPATH=python python -m pytest python/tests/test_autograd.py -q --tb=short python -m black --check python/tests/test_autograd.py git diff --checkAll passed locally.
Fixes #3629