-
-
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
more inlining #3796
more inlining #3796
Conversation
This is awesome! It may hopefully address many of the challenges we have been facing (e.g. make |
How about going C99 style and making This is exciting stuff! |
I think the |
Is there any documentation on the |
I suggest using macro syntax instead of adding new keywords. This allows |
@JeffBezanson The How about: becomes |
Yes. But the value of wrapping it in the Adding |
I like the Perhaps
|
@JeffBezanson bump. should I add a Or how would you prefer to handle this? |
For now, let's remove the |
^^ pro move: break the change into smaller, less disruptive pieces. On Thursday, August 15, 2013, Jeff Bezanson wrote:
|
@vtjnash Would you mind rebasing this? I wanted to play with inling a bit, but didn't want to duplicate any work. |
@loladiro @JeffBezanson this has been rebased. please test and merge when you are happy |
Currently this patch undoes my optimization for many-argument operators like Ideally the multi-statement inlining and union-splitting would be separate patches, as well. |
Yeah, it was partially that, and partially that I was being too aggressive at creating local variables while inlining so that optimization could no longer be applied. I fixed that stuff, and reverted the inlining_pass function for simplicity (and because it seems the order of the expanding apply vs calling inlineable really matters). I also found that I was accidentally inlining some rather large functions, which is why the test were so slow. That's fixed now also. |
@JeffBezanson bump. i think i've removed all the controversial stuff. now it just does inlining based on call1 and inline_worthy, nothing more. OK to merge? or do you have other suggestions first? |
Why does github not like automatically merging this? Some rebasing required? |
Probably not. I think github is just refusing to do the file merge caused by b4fa861 |
I'm assuming that at this point this is 0.4 material. When it does come to the fore, here's one vote for considering restoring the
I suspect there's some justifiable reluctance to give users too much control over inlining: witness the number of recommendations floating around to avoid overusing All that said, in practice many of our current problems will be solved even by this version. I'd much rather see this merged than to have it held up by a lack of consensus about an |
+1 for @timholy's argument. I have often found it quite frustrated to see the performance penalty caused by failure of inlining. In performance-demanding settings (which is not uncommon in scientific computing), this virtually forces me to use macros or more verbose codes instead of more elegant abstractions (e.g. iterators). I support merging this soon and then debating how we may provide ways for developers to specify what to inline. |
if is_known_call(e, Core.Intrinsics.ccall, sv) | ||
i0 = 3 | ||
i0 = 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type and param type arguments don't run in enclosing_ast as
expected by inlineable, so we need to skip them also
On Wednesday, March 26, 2014, Jeff Bezanson notifications@github.com
wrote:
In base/inference.jl:
if is_known_call(e, Core.Intrinsics.ccall, sv)
i0 = 3
i0 = 5
Why 5?
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/3796/files#r10987984
.
multi-line inlining is now supported (currently triggered by various simple heuristics)
…able in a different module, since `Mod.X=V` isn't allowed
… local in the enclosing ast
…aluation of its arguments if the argument was pure
…ction argument list
…piling a function
…should be fdwatcher_init.
Did I just rebase this? Yes. What can that possibly mean? Who knows. |
Don't mind me, I'll just stand here in the corner whistling, peering over my shoulder occasionally. |
🍬 |
A big "thank you" for this wonderful PR. |
This pull requests adds inlining and improved call site type specialization. It separates function calls of type unions and provides support for multi-line inlining. (It also attempts to inline Union, but that part is causing the tests to fail)
While the standard inlining heuristic has not been updated, you can test the multiline inlining by forcing a function to be inlined by adding an
:inline
keyword: