swift
1f836b3c - [AutoDiff] Fix adjoint value propagation for basic block arguments. (#28253)

Commit
6 years ago
[AutoDiff] Fix adjoint value propagation for basic block arguments. (#28253) Previously, the adjoint value of a basic block argument was simply set as the adjoint value of its incoming values. This is problematic when the adjoint value is a temporary value: the adjoint value will be destroyed in the pullback basic block, leading to use-after-free issues in pullback successor blocks (TF-923). Now, the adjoint value of a basic block argument is materialized and copied, and the copy is set as the adjoint value of incoming values. The copy is also set as a temporary value in pullback successor blocks. Unify `blockTemporaries` and `blockTemporarySet` using `SmallSetVector`. Minor gardening included. Resolves TF-923. Concurrently discovered TF-962: multiple consuming uses for tuple-typed adjoint values. TF-962 persists with this patch.
Author
Committer
Parents
Loading