1. 07 Apr, 2022 2 commits
  2. 16 Dec, 2021 1 commit
    • Manos Koukoutos's avatar
      [wasm][turbofan] Inline before loop unrolling · b9855173
      Manos Koukoutos authored
      We switch the order of inlining and loop unrolling optimizations. This
      gives small improvements to wasm-gc benchmarks.
      Changes:
      - Change the loop analysis algorithm to accept loops directly connected
        to the graph's end. This is required because some nodes in an inlined
        function, such as tail calls, might be directly connected to the outer
        function's end without an intervening LoopExit node.
      - Based on the above, skip emitting loop exits for some Throw nodes in
        WasmGraphBuildingInterface.
      - Introduce WasmInliningPhase, add it before loop unrolling. Remove
        inlining from WasmOptimizationPhase.
      - Handle graph terminators in loop unrolling.
      - Add loops in the inlined function to the callers loop_infos.
      Drive-by:
      - Allow more wasm builtins in unrolled loops.
      - Reduce inlining parameters to reflect that functions are now slightly
        smaller during inlining, as no unrolling has taken place yet.
      
      Bug: v8:12166
      Change-Id: Iadd6b2f75170aa153ca1efb47fbb0d185c2b8371
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3329783Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#78394}
      b9855173
  3. 24 Nov, 2021 1 commit
    • Manos Koukoutos's avatar
      [wasm] Internal representation for function references · f60132e9
      Manos Koukoutos authored
      Design doc: bit.ly/3jEVgzz
      
      We separate the internal representation of function references in Wasm
      from their JSFunction-based (external) representation. This improves
      performance of call_ref by requiring less indirections to load the
      context and call target from a function reference. In the boundary
      between wasm and JS/the C API, we add transformations between the two
      representations.
      
      Detailed changes:
      - Introduce WasmInternalFunction, containing fields required by
        call_ref, as well as a reference to the corresponding
        WasmExternalFunction. Add a reference to the WasmInternalFunction in
        WasmFunctionData. The {WasmInternalFunction::FromExternal} helper
        extracts the internal out of an external function.
      - Change {WasmInstanceObject::external_functions()} to internal
        functions.
      - Change wasm function tables to contain internal functions.
      - Change the following code to use internal functions:
        - call_ref in liftoff and Turbofan
        - function type checks in liftoff and Turbofan
        - CallRefIC and GenericJSToWasmWrapper builtins
        - {InitExprInterface::RefFunc}
        - module-compiler.cc in {ProcessTypeFeedback}
        - In module-instantiate.cc, in function-rtt creation.
      - Add transformations between internal and external functions in:
        - WasmWrapperGraphBuilder::{ToJS, BuildUnpackObjectWrapper, FromJS,
          BuildJSToJSWrapper}.
        - debug-wasm-objects.cc in {FunctionProxy::Get},
          {WasmValueObject::New} and {AddWasmTableObjectInternalProperties}.
        - runtime-wasm.cc in ReplaceWrapper
        - the C and JS APIs
        - module-instantiate.cc, in import and export processing, as well as
          {InitializeIndirectFunctionTables}
        - WasmTableObject::{IsValidElement, SetFunctionTableEntry}
        - {WasmGlobalObject::SetFuncRef}
      - Simplify body descriptors of WasmExternalFunction variants.
      - Adjust tests.
      
      Bug: v8:11510
      
      Change-Id: I8377f46f55c3771391ae1c5c8201a83854ee7878
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3277878Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#78068}
      f60132e9
  4. 18 Oct, 2021 1 commit
    • Manos Koukoutos's avatar
      [wasm][turbofan] Improve inlining heuristics · bce44108
      Manos Koukoutos authored
      This CL improves wasm inlining heuristics in Turbofan, for an average
      8,5% performance improvement in selected benchmarks.
      
      Changes:
      - In WasmInliner::Reduce(), only collect inlining candidates into a
        priority queue, according to WasmInliner::LexicographicOrdering.
        Move actual inlining to Finalize().
      - Remove the InlineFirstFew heuristic. Add two limits to inlining:
        Maximum relative size increase (reversely proportional to the function
        size), and absolute size increase.
      - Pass information about call frequency from liftoff-collected feedback
        to the WasmInliner though the wasm module.
      - Run wasm inlining along other optimizations in the pipeline.
      - Split inlining and speculative inlining tests.
      
      Bug: v8:7748, v8:12166
      Change-Id: Iccee22093db765981889a24451fb458dfce1f1a6
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3222764Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#77428}
      bce44108
  5. 07 Oct, 2021 1 commit
  6. 14 Sep, 2021 2 commits
  7. 13 Sep, 2021 2 commits
  8. 07 Sep, 2021 1 commit
    • Manos Koukoutos's avatar
      [wasm][turbofan] Set up basic inlining infrastructure · ab4cf929
      Manos Koukoutos authored
      We introduce basic wasm inlining infrastructure behind a flag. The
      implementation is currently incomplete. Additionally, we always inline
      the function at index 0; proper inlining heuristics will be added later.
      
      Changes:
      - Rename WasmInliningPhase -> JSWasmInliningPhase
      - Introduce WasmInliningPhase and WasmInliner.
      - Pass additional parameters as needed to GenerateCodeForWasmFunction.
      - Remove EnsureEnd in WasmGraphAssembler. Create end node at the start
        of compilation.
      - Add a simple test.
      
      Bug: v8:12166
      Change-Id: Ifd7006ba378e9f74cd248b71e16869fbbb8a82be
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3141575
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#76689}
      ab4cf929