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

Reduce julia inference time for ExceptionUnwrapping.jl #6

Merged
merged 1 commit into from
May 23, 2022

Conversation

NHDaly
Copy link
Member

@NHDaly NHDaly commented May 23, 2022

  1. Use @nospecialize to prevent julia from codegen'ing specializations
    for every possible combination of wrapped exception types, since the
    resultant code will be essentially the same, and we don't mind
    paying the runtime cost for the (rare!) exception handling
    codepaths.
  2. Use inferencebarriers to prevent julia from attempting to infer
    these functions until they're actually called (at the price of one
    extra dispatch during exception handling).
  3. Convert to explicitly untyped while loops instead of recursion, since
    julia would have attempted to statically resolve the recursion, and
    we saw it hit a stack overflow during inference in production.

1. Use `@nospecialize` to prevent julia from codegen'ing specializations
   for every possible combination of wrapped exception types, since the
    resultant code will be essentially the same, and we don't mind
    paying the runtime cost for the (rare!) exception handling
    codepaths.
2. Use inferencebarriers to prevent julia from attempting to infer
   these functions until they're actually called (at the price of one
   extra dispatch during exception handling).
3. Convert to explicitly untyped while loops instead of recursion, since
   julia would have attempted to statically resolve the recursion, and
   we saw it hit a stack overflow during inference in production.
@jakebolewski
Copy link

jakebolewski commented May 23, 2022

👍 , looks good to me.

@NHDaly NHDaly merged commit 6a8ba50 into master May 23, 2022
@NHDaly NHDaly deleted the nhd-jb-noinfer branch May 23, 2022 18:30
NHDaly added a commit that referenced this pull request Jun 6, 2023
Unclear why this was left out from
#6...

There's still probably more improvement to be made here, but I ran into
test failures on julia master, so we're leaving that as a separate
change in #14.
NHDaly added a commit that referenced this pull request Jun 6, 2023
Unclear why this was left out from
#6...

There's still probably more improvement to be made here, but I ran into
test failures on julia master, so we're leaving that as a separate
change in #14.
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

Successfully merging this pull request may close these issues.

2 participants