Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward mode handingly for Expr(:new, ) in forward_diff_no_inf! #148

Merged
merged 3 commits into from
May 17, 2023

Conversation

staticfloat
Copy link
Collaborator

Frames and I tracked down an issue where the type argument to an Expr(:new, ) (argument #1) was getting wrapped in a ZeroBundle. This commit adds a special-case for Expr(:new, ) into forward_diff_no_inf!() that mimics what we see elsewhere, making use of ∂☆new.

@staticfloat staticfloat marked this pull request as draft May 17, 2023 03:02
@staticfloat
Copy link
Collaborator Author

@oxinabox can you make test for this please?

src/codegen/forward_demand.jl Outdated Show resolved Hide resolved
@staticfloat staticfloat force-pushed the sf/fix_new_zero_bundle_error branch from a9df060 to 0a3e34a Compare May 17, 2023 03:23
@oxinabox oxinabox self-assigned this May 17, 2023
@oxinabox oxinabox changed the title Custom forward rule for Expr(:new, ) in forward_diff_no_inf! Forward mode handingly for Expr(:new, ) in forward_diff_no_inf! May 17, 2023
@oxinabox oxinabox marked this pull request as ready for review May 17, 2023 11:51
Comment on lines +54 to +57
identity_transform!(ir, ssa::Core.SSAValue, order) = ir[ssa]
function identity_transform!(ir, arg::Core.Argument, order)
return Core.Compiler.insert_node!(ir, Core.SSAValue(1), Core.Compiler.NewInstruction(Expr(:call, Diffractor.ZeroBundle{1}, arg), Any))
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Keno it seems that this is always required.

staticfloat and others added 2 commits May 17, 2023 20:51
Frames and I tracked down an issue where the type argument to an
`Expr(:new, )` (argument #1) was getting wrapped in a `ZeroBundle`.
This commit adds a special-case for `Expr(:new, )` into
`forward_diff_no_inf!()` that mimics what we see elsewhere, making use
of `∂☆new`.
@oxinabox oxinabox force-pushed the sf/fix_new_zero_bundle_error branch from 501300b to f52c853 Compare May 17, 2023 12:51
@staticfloat staticfloat merged commit 998267b into main May 17, 2023
@oscardssmith oscardssmith deleted the sf/fix_new_zero_bundle_error branch May 17, 2023 16:31
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.

3 participants