Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Issue 2337123003: [turbofan] Collect invocation counts and compute relative call frequencies. (Closed)

Created:
4 years, 3 months ago by Benedikt Meurer
Modified:
4 years, 3 months ago
CC:
v8-reviews_googlegroups.com, v8-x87-ports_googlegroups.com, v8-ppc-ports_googlegroups.com, v8-mips-ports_googlegroups.com, rmcilroy, Hannes Payer (out of office), ulan
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[turbofan] Collect invocation counts and compute relative call frequencies. Add a notion of "invocation count" to the baseline compilers, which increment a special slot in the TypeFeedbackVector for each invocation of a given function (the optimized code doesn't currently collect this information). Use this invocation count to relativize the call counts on the call sites within the function, so that the inlining heuristic has a view of relative importance of a call site rather than some absolute numbers with unclear meaning for the current function. Also apply the call site frequency as a factor to all frequencies in the inlinee by passing this to the graph builders so that the importance of a call site in an inlinee is relative to the topmost optimized function. Note that all functions that neither have literals nor need type feedback slots will share a single invocation count cell in the canonical empty type feedback vector, so their invocation count is meaningless, but that doesn't matter since we only use the invocation count to relativize call counts within the function, which we only have if we have at least one type feedback vector (the CallIC slot). See the design document for additional details on this change: https://docs.google.com/document/d/1VoYBhpDhJC4VlqMXCKvae-8IGuheBGxy32EOgC2LnT8 BUG=v8:5267, v8:5372 R=mvstanton@chromium.org,rmcilroy@chromium.org,mstarzinger@chromium.org Committed: https://crrev.com/c7d7ca361dd1ba399becd54ce0d9c6e53f76c870 Cr-Commit-Position: refs/heads/master@{#39410}

Patch Set 1 #

Total comments: 7

Patch Set 2 : Address feedback. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1907 lines, -1701 lines) Patch
M src/builtins/arm/builtins-arm.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M src/builtins/arm64/builtins-arm64.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M src/builtins/ia32/builtins-ia32.cc View 1 chunk +7 lines, -0 lines 0 comments Download
M src/builtins/mips/builtins-mips.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M src/builtins/mips64/builtins-mips64.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M src/builtins/x64/builtins-x64.cc View 1 chunk +9 lines, -0 lines 0 comments Download
M src/compiler/ast-graph-builder.h View 2 chunks +2 lines, -0 lines 0 comments Download
M src/compiler/ast-graph-builder.cc View 1 2 chunks +4 lines, -3 lines 0 comments Download
M src/compiler/bytecode-graph-builder.h View 2 chunks +2 lines, -1 line 0 comments Download
M src/compiler/bytecode-graph-builder.cc View 1 2 chunks +4 lines, -2 lines 0 comments Download
M src/compiler/js-inlining.cc View 2 chunks +8 lines, -2 lines 0 comments Download
M src/compiler/pipeline.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M src/full-codegen/arm/full-codegen-arm.cc View 1 1 chunk +14 lines, -0 lines 0 comments Download
M src/full-codegen/arm64/full-codegen-arm64.cc View 1 1 chunk +14 lines, -0 lines 0 comments Download
M src/full-codegen/ia32/full-codegen-ia32.cc View 1 1 chunk +11 lines, -0 lines 0 comments Download
M src/full-codegen/mips/full-codegen-mips.cc View 1 1 chunk +14 lines, -0 lines 0 comments Download
M src/full-codegen/mips64/full-codegen-mips64.cc View 1 1 chunk +14 lines, -0 lines 0 comments Download
M src/full-codegen/x64/full-codegen-x64.cc View 1 1 chunk +12 lines, -0 lines 0 comments Download
M src/heap/heap.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/heap/heap.cc View 1 chunk +18 lines, -1 line 0 comments Download
M src/profiler/heap-snapshot-generator.cc View 1 chunk +1 line, -0 lines 0 comments Download
M src/type-feedback-vector.h View 1 4 chunks +10 lines, -3 lines 0 comments Download
M src/type-feedback-vector.cc View 1 2 chunks +9 lines, -1 line 0 comments Download
M src/type-feedback-vector-inl.h View 1 chunk +6 lines, -8 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden View 2 chunks +8 lines, -8 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden View 6 chunks +24 lines, -24 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden View 3 chunks +3 lines, -3 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/BasicLoops.golden View 16 chunks +53 lines, -53 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden View 2 chunks +8 lines, -8 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/CallGlobal.golden View 2 chunks +4 lines, -4 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden View 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/interpreter/bytecode_expectations/CallNew.golden View 4 chunks +6 lines, -6 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden View 5 chunks +7 lines, -7 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden View 5 chunks +5 lines, -5 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden View 5 chunks +9 lines, -9 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/Conditional.golden View 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/interpreter/bytecode_expectations/ContextVariables.golden View 2 chunks +2 lines, -2 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/CountOperators.golden View 11 chunks +20 lines, -20 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/CreateArguments.golden View 2 chunks +2 lines, -2 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden View 2 chunks +4 lines, -4 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden View 2 chunks +3 lines, -3 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/DoExpression.golden View 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/interpreter/bytecode_expectations/ForIn.golden View 4 chunks +12 lines, -12 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/ForOf.golden View 12 chunks +56 lines, -56 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden View 2 chunks +2 lines, -2 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/Generators.golden View 5 chunks +13 lines, -13 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden View 2 chunks +6 lines, -6 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden View 4 chunks +12 lines, -12 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden View 2 chunks +2 lines, -2 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/IfConditions.golden View 5 chunks +13 lines, -13 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden View 1 chunk +4 lines, -4 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden View 4 chunks +133 lines, -133 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden View 4 chunks +4 lines, -4 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden View 5 chunks +6 lines, -6 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden View 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden View 11 chunks +11 lines, -11 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/PropertyCall.golden View 4 chunks +138 lines, -138 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden View 7 chunks +266 lines, -266 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/PropertyStores.golden View 11 chunks +528 lines, -528 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden View 1 chunk +2 lines, -2 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden View 3 chunks +5 lines, -5 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden View 6 chunks +264 lines, -264 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/Switch.golden View 8 chunks +17 lines, -17 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden View 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/interpreter/bytecode_expectations/Typeof.golden View 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden View 7 chunks +9 lines, -9 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/WideRegisters.golden View 4 chunks +8 lines, -8 lines 0 comments Download
M test/cctest/interpreter/test-interpreter.cc View 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/test-compiler.cc View 1 chunk +23 lines, -0 lines 0 comments Download
M test/cctest/test-feedback-vector.cc View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 17 (7 generated)
Benedikt Meurer
4 years, 3 months ago (2016-09-14 06:42:14 UTC) #1
Benedikt Meurer
Hey guys, This is the change described in go/v8-turbofan-inlining-heuristics, which allows us to do inlining ...
4 years, 3 months ago (2016-09-14 06:43:41 UTC) #4
Benedikt Meurer
Note that this change will allow escape analysis to boost RayTrace performance by 15-20% once ...
4 years, 3 months ago (2016-09-14 06:59:17 UTC) #5
Michael Starzinger
LGTM from my end. Please wait on a review from Michael Stanton about the changes ...
4 years, 3 months ago (2016-09-14 07:53:45 UTC) #8
mvstanton
Looks good. I have a couple of comments, can be addressed now or in a ...
4 years, 3 months ago (2016-09-14 09:26:09 UTC) #9
rmcilroy
Bytecode related parts LGTM, thanks.
4 years, 3 months ago (2016-09-14 09:30:07 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2337123003/20001
4 years, 3 months ago (2016-09-14 09:52:53 UTC) #13
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 3 months ago (2016-09-14 10:20:13 UTC) #14
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/c7d7ca361dd1ba399becd54ce0d9c6e53f76c870 Cr-Commit-Position: refs/heads/master@{#39410}
4 years, 3 months ago (2016-09-14 10:20:59 UTC) #16
Benedikt Meurer
4 years, 3 months ago (2016-09-14 10:55:45 UTC) #17
Message was sent while issue was closed.
https://codereview.chromium.org/2337123003/diff/1/src/compiler/ast-graph-buil...
File src/compiler/ast-graph-builder.cc (right):

https://codereview.chromium.org/2337123003/diff/1/src/compiler/ast-graph-buil...
src/compiler/ast-graph-builder.cc:3111: invocation_frequency_;
On 2016/09/14 09:26:09, mvstanton wrote:
> How about giving the CallICNexus responsibility for this computation...it can
> see the invocation_count() after all.

Done.

https://codereview.chromium.org/2337123003/diff/1/src/compiler/bytecode-graph...
File src/compiler/bytecode-graph-builder.cc (right):

https://codereview.chromium.org/2337123003/diff/1/src/compiler/bytecode-graph...
src/compiler/bytecode-graph-builder.cc:1361: return
static_cast<float>(call_count / invocation_count) *
On 2016/09/14 09:26:09, mvstanton wrote:
> Here too.

Done.

https://codereview.chromium.org/2337123003/diff/1/src/full-codegen/arm/full-c...
File src/full-codegen/arm/full-codegen-arm.cc (right):

https://codereview.chromium.org/2337123003/diff/1/src/full-codegen/arm/full-c...
src/full-codegen/arm/full-codegen-arm.cc:132: __ ldr(r2, FieldMemOperand(r1,
JSFunction::kLiteralsOffset));
On 2016/09/14 07:53:45, Michael Starzinger wrote:
> suggestion: We could even add a code comment (the ones visible in the
> disassembly via --code-comments) for this block.

Done.

Powered by Google App Engine
This is Rietveld 408576698