-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Inlining arithmetic can produce slowdowns #13350
Comments
To add a little context, G = ForwardDiff.GradientNumber{1,Float64,Tuple{Float64}}
gdx, gdy = rand(G), rand(G)
@code_llvm mygetindex_slow(A, gdx, gdy)
@code_llvm mygetindex_fast(A, gdx, gdy) In Tim's actual gist, ForwardDiff uses |
Actually, @jrevels, since this affects even the 1d case, we can make this even easier. It really is just the two arithmetic operations at the top. Would you be able to put together a demonstration in "raw" julia, without using ForwardDiff at all? Might help debug this. |
I wasn't able to reproduce this when the involved number types are Base number types; or do you mean an example with a simpler wrapper type than |
Yes, or just a version for ForwardDiff itself that strips the operations down to the essentials. If it can be reduced to ~20 loc or something, that might make it a lot easier for folks. (I frequently do that when I report bugs, but in this case you understand ForwardDiff far better than I.) |
Ah, but see #13355! |
I am now seeing much worse performance here, and it does not seem to be fixed by #13355. |
Reopening based on @JeffBezanson's comment from yesterday--this got autoclosed by #13355. |
These were broken by JuliaLang#11274 but no one noticed. Fixes JuliaLang#13350.
Is this a dup of #12219 ? |
The original issue was kind of the opposite of #12219: we had type information, but we weren't inlining aggressively enough to avoid calling |
The new regression that @JeffBezanson saw may be #14294. |
confirmed the new issue was #14294, not the original report here |
I've got an application where I'm seeing a big performance difference between
and
This is related to previous issues #6193 (comment) #5011 #7075 (comment) #10278. However, they're all closed, so I thought it would be better to start fresh.
This demo relies on ForwardDiff.jl, and uses the code in this gist.
Timing results:
Considerably more discussion can be found here.
Anything to do here? Or just tweak Interpolations.jl (which is where those functions get
@generated
) to insert the parentheses?The text was updated successfully, but these errors were encountered: