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

optimizer: supports callsite annotations of inlining, fixes #18773 #41328

Merged
merged 11 commits into from
Sep 1, 2021

Commits on Aug 31, 2021

  1. optimizer: supports callsite annotations of inlining, fixes #18773

    Enable `@inline`/`@noinline` annotations on function callsites.
    From #40754.
    
    Now `@inline` and `@noinline` can be applied to a code block and then
    the compiler will try to (not) inline calls within the block:
    ```julia
    @inline f(...) # The compiler will try to inline `f`
    
    @inline f(...) + g(...) # The compiler will try to inline `f`, `g` and `+`
    
    @inline f(args...) = ... # Of course annotations on a definition is still allowed
    ```
    
    Here are couple of notes on how those callsite annotations will work:
    - callsite annotation always has the precedence over the annotation
      applied to the definition of the called function, whichever we use
      `@inline`/`@noinline`:
      ```julia
      @inline function explicit_inline(args...)
          # body
      end
    
      let
          @noinline explicit_inline(args...) # this call will not be inlined
      end
      ```
    - when callsite annotations are nested, the innermost annotations has
      the precedence
      ```julia
      @noinline let a0, b0 = ...
          a = @inline f(a0)  # the compiler will try to inline this call
          b = notinlined(b0) # the compiler will NOT try to inline this call
          return a, b
      end
      ```
    They're both tested and included in documentations.
    aviatesk committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    9c35a04 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1c7482f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    addd655 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1e1378f View commit details
    Browse the repository at this point in the history
  5. style nits

    aviatesk committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    99cbff6 View commit details
    Browse the repository at this point in the history
  6. Update base/compiler/ssair/inlining.jl

    Co-authored-by: Jameson Nash <[email protected]>
    aviatesk and vtjnash committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    382a80c View commit details
    Browse the repository at this point in the history
  7. Update src/method.c

    Co-authored-by: Jameson Nash <[email protected]>
    aviatesk and vtjnash committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    4ecf149 View commit details
    Browse the repository at this point in the history
  8. fixup

    - remove preprocessed flags from `jl_code_info_set_ir`
    - fix duplicated definition warning
    - add and fix comments
    aviatesk committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    490dda0 View commit details
    Browse the repository at this point in the history
  9. more clean up

    aviatesk committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    783d32d View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    322291b View commit details
    Browse the repository at this point in the history
  11. update NEWS.md

    aviatesk committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    3805d86 View commit details
    Browse the repository at this point in the history