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

Inference regression in 1.6 #38837

Closed
marius311 opened this issue Dec 11, 2020 · 2 comments
Closed

Inference regression in 1.6 #38837

marius311 opened this issue Dec 11, 2020 · 2 comments
Assignees
Labels
regression Regression in behavior compared to a previous version
Milestone

Comments

@marius311
Copy link
Contributor

I ran into this starting to upgrade my code to 1.6. A MWE with 1.6.0-DEV.1722 (599d329)

julia> @code_warntype (xs -> map((F,x)->F(x), (Float32,Float64), xs))((1,2))
Variables
  #self#::Core.Const(var"#23#25"())
  xs::Tuple{Int64, Int64}
  #24::var"#24#26"

Body::Tuple{Any, Any}
1 ─      (#24 = %new(Main.:(var"#24#26")))%2 = #24::Core.Const(var"#24#26"())%3 = Core.tuple(Main.Float32, Main.Float64)::Core.Const((Float32, Float64))
│   %4 = Main.map(%2, %3, xs)::Tuple{Any, Any}
└──      return %4

whereas on 1.5.3:

julia> @code_warntype (xs -> map((F,x)->F(x), (Float32,Float64), xs))((1,2))
Variables
  #self#::Core.Compiler.Const(var"#21#23"(), false)
  xs::Tuple{Int64,Int64}
  #22::var"#22#24"

Body::Tuple{Float32,Float64}
1 ─      (#22 = %new(Main.:(var"#22#24")))%2 = #22::Core.Compiler.Const(var"#22#24"(), false)%3 = Core.tuple(Main.Float32, Main.Float64)::Core.Compiler.Const((Float32, Float64), false)
│   %4 = Main.map(%2, %3, xs)::Tuple{Float32,Float64}
└──      return %4

However, on 1.6, its fine if you wrap it in another function call (presumably due to constant prop?)

julia> @code_warntype (() -> (xs -> map((F,x)->F(x), (Float32,Float64), xs))((1,2)))()
Variables
  #self#::Core.Const(var"#37#40"())
  #38::var"#38#41"

Body::Tuple{Float32, Float64}
1 ─      (#38 = %new(Main.:(var"#38#41")))%2 = #38::Core.Const(var"#38#41"())%3 = Core.tuple(1, 2)::Core.Const((1, 2))
│   %4 = (%2)(%3)::Core.Const((1.0f0, 2.0))
└──      return %4

So perhaps not really an issue? Not sure, but thought I'd report it here.

@marius311
Copy link
Contributor Author

Seems like #38240 could be related, featuring mapreduce and also a regression since 1.5.

@JeffBezanson JeffBezanson added the regression Regression in behavior compared to a previous version label Dec 11, 2020
@JeffBezanson JeffBezanson added this to the 1.6 blockers milestone Dec 11, 2020
@JeffBezanson
Copy link
Member

Some of the map methods for tuples are declared inline, and some are not. Adding inline declarations fixes this, but then I'm not sure why it worked on 1.5. Maybe changed inlining heuristics?

@JeffBezanson JeffBezanson self-assigned this Dec 15, 2020
@Keno Keno closed this as completed in c28611f Dec 15, 2020
KristofferC pushed a commit that referenced this issue Dec 17, 2020
staticfloat pushed a commit that referenced this issue Jan 15, 2021
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this issue May 4, 2021
staticfloat pushed a commit that referenced this issue Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

2 participants