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

Even very basic broadcasting breaks inferability #147

Open
oxinabox opened this issue May 12, 2023 · 0 comments
Open

Even very basic broadcasting breaks inferability #147

oxinabox opened this issue May 12, 2023 · 0 comments

Comments

@oxinabox
Copy link
Member

oxinabox commented May 12, 2023

Even very simple broadcasting can't infer in Diffractor forward mode

Consider:

using Diffractor
using Diffractor: TaylorBundle, ZeroBundle, CompositeBundle
forward = Diffractor.∂☆{1}()
f(x) = 2 .* x
cb = CompositeBundle{1, Tuple{Float64, Float64}}((TaylorBundle{1}(1.0, (1.0,)), TaylorBundle{1}(1.0, (2.0,))))
@code_warntype forward(ZeroBundle{1}(f), cb)

The output is

julia> @code_warntype forward(ZeroBundle{1}(f), cb)
MethodInstance for (::Diffractor.∂☆{1})(::ZeroBundle{1, typeof(f)}, ::CompositeBundle{1, Tuple{Float64, Float64}, Tuple{Diffractor.TangentBundle{1, Float64, Diffractor.TaylorTangent{Tuple{Float64}}}, Diffractor.TangentBundle{1, Float64, Diffractor.TaylorTangent{Tuple{Float64}}}}})
  from (::Diffractor.∂☆{N})(args::Diffractor.AbstractTangentBundle{N}...) where N @ Diffractor ~/.julia/packages/Diffractor/a9mlv/src/stage1/forward.jl:148
Static Parameters
  N = 1
Arguments
  #self#::Core.Const(Diffractor.∂☆{1}())
  args::Tuple{ZeroBundle{1, typeof(f)}, CompositeBundle{1, Tuple{Float64, Float64}, Tuple{Diffractor.TangentBundle{1, Float64, Diffractor.TaylorTangent{Tuple{Float64}}}, Diffractor.TangentBundle{1, Float64, Diffractor.TaylorTangent{Tuple{Float64}}}}}}
Body::Any
1%1 = Core.apply_type(Diffractor.∂☆internal, $(Expr(:static_parameter, 1)))::Core.Const(Diffractor.∂☆internal{1})
│   %2 = (%1)()::Core.Const(Diffractor.∂☆internal{1}())
│   %3 = Core._apply_iterate(Base.iterate, %2, args)::Any
└──      return %3
@oxinabox oxinabox changed the title Even very basic Even very basic broadcasting breaks inferability May 12, 2023
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

No branches or pull requests

1 participant