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

Enable inlining of first-class function when it is statically known to be a dispatcher #9077

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

sklam
Copy link
Member

@sklam sklam commented Jul 15, 2023

  • change lower_cast of Dispatcher to FunctionType to support inlining.
  • FunctionType now has a .jit_addr to store the numba-internal function address that follows the numba callconv.
    • as a side-effect, FunctionType that has non-NULL .jit_addr can raise exception.

TODO:

@@ -205,7 +205,7 @@ def create_cfunc_wrapper(self, library, fndesc, env, call_helper):

status, out = self.call_conv.call_function(
builder, wrapper_callee, fndesc.restype, fndesc.argtypes,
wrapfn.args, attrs=('noinline',))
wrapfn.args)
Copy link
Member Author

Choose a reason for hiding this comment

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

After discussion with @stuartarchibald, this will need to be undone or it will leads to many optimization issues.

The alternative is to make first-class function use the Numba function without the wrapper when possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think so. making it always inline could lead to many issues. One potential drawback could increase the compilation time, if the body of FunctionType is huge. Or maybe it's a bug in inline-related passes...

Copy link

This pull request is marked as stale as it has had no activity in the past 3 months. Please respond to this comment if you're still interested in working on this. Many thanks!

@github-actions github-actions bot added the stale Marker label for stale issues. label Dec 26, 2023
@github-actions github-actions bot added the abandoned - stale PRs automatically closed due to stale status label Jan 2, 2024
@github-actions github-actions bot closed this Jan 2, 2024
@sklam sklam reopened this May 20, 2024
@github-actions github-actions bot removed abandoned - stale PRs automatically closed due to stale status stale Marker label for stale issues. labels May 21, 2024
@sklam sklam marked this pull request as ready for review May 22, 2024 23:35
@stuartarchibald stuartarchibald self-requested a review June 4, 2024 15:14
@stuartarchibald stuartarchibald added this to the 0.61.0-rc1 milestone Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants