-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove frule for getindex(::Tuple, i) (#680)
* Remove frule for getindex(::Tuple, i) Having this chain rule is sub-optimal, because it prevents early-SROA in Diffractor-like systems that would like to perform some optimizations before applying AD (but can't do any optimization on functions that have custom rules). By letting it go down to the `getfield`, regular SROA can apply. Any AD system should handle `getfield` anyway, so I don't think there's a strong reason to have this. Similar reasoning applies to the reverse rules also, but they aren't currently actively causing me problems, so this PR only removes the frule, since I don't think many other packages are using them. We can revisit the rrules later. * Also remove the rules for first/tail For similar reasons as getindex, having a rule for first/tail is suboptimal because it supresses early SROA. Tail is particularly problematic, because it is used in the implementation of the ``` x, y... = abc ``` syntax, of which users expect early elimination. * add getfield rule and remove tests for deleted rules --------- Co-authored-by: Oscar Smith <oscardssmith@gmail.com>
- Loading branch information
1 parent
859f6ab
commit 05ebb38
Showing
2 changed files
with
6 additions
and
57 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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