Commit c9d003f8 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

Consistent names for --interrupt-budget flags

1. feedback_vector_allocation -> feedback_allocation like elsewhere.
2. A consistent --interrupt-budget prefix.
3. Remove the on-by-default --feedback-allocation-on-bytecode-size.

Bug: v8:7700
Change-Id: I1d0af11e89398973a65bf9cb7c7722740d9452ea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3463718
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79097}
parent 5e060e41
...@@ -545,7 +545,12 @@ void CollectAndMaybeResetCounts(Isolate* isolate, ...@@ -545,7 +545,12 @@ void CollectAndMaybeResetCounts(Isolate* isolate,
count = count =
static_cast<uint32_t>(func.feedback_vector().invocation_count()); static_cast<uint32_t>(func.feedback_vector().invocation_count());
} else if (func.raw_feedback_cell().interrupt_budget() < } else if (func.raw_feedback_cell().interrupt_budget() <
FLAG_budget_for_feedback_vector_allocation) { FLAG_interrupt_budget_for_feedback_allocation) {
// TODO(jgruber): The condition above is no longer precise since we
// may use either the fixed interrupt_budget or
// FLAG_interrupt_budget_factor_for_feedback_allocation. If the
// latter, we may incorrectly set a count of 1.
//
// We haven't allocated feedback vector, but executed the function // We haven't allocated feedback vector, but executed the function
// atleast once. We don't have precise invocation count here. // atleast once. We don't have precise invocation count here.
count = 1; count = 1;
......
...@@ -596,29 +596,29 @@ DEFINE_BOOL_READONLY(enable_sealed_frozen_elements_kind, true, ...@@ -596,29 +596,29 @@ DEFINE_BOOL_READONLY(enable_sealed_frozen_elements_kind, true,
DEFINE_BOOL(unbox_double_arrays, true, "automatically unbox arrays of doubles") DEFINE_BOOL(unbox_double_arrays, true, "automatically unbox arrays of doubles")
DEFINE_BOOL_READONLY(string_slices, true, "use string slices") DEFINE_BOOL_READONLY(string_slices, true, "use string slices")
// Tiering: Sparkplug / feedback vector allocation.
DEFINE_INT(interrupt_budget_for_feedback_allocation, 940,
"The fixed interrupt budget (in bytecode size) for allocating "
"feedback vectors")
DEFINE_INT(interrupt_budget_factor_for_feedback_allocation, 8,
"The interrupt budget factor (applied to bytecode size) for "
"allocating feedback vectors, used when bytecode size is known")
// Tiering: Turbofan.
DEFINE_INT(interrupt_budget, 132 * KB,
"interrupt budget which should be used for the profiler counter")
DEFINE_INT(ticks_before_optimization, 3, DEFINE_INT(ticks_before_optimization, 3,
"the number of times we have to go through the interrupt budget " "the number of times we have to go through the interrupt budget "
"before considering this function for optimization") "before considering this function for optimization")
DEFINE_INT(bytecode_size_allowance_per_tick, 1100, DEFINE_INT(bytecode_size_allowance_per_tick, 1100,
"increases the number of ticks required for optimization by " "increases the number of ticks required for optimization by "
"bytecode.length/X") "bytecode.length/X")
DEFINE_INT(interrupt_budget, 132 * KB,
"interrupt budget which should be used for the profiler counter")
DEFINE_INT( DEFINE_INT(
max_bytecode_size_for_early_opt, 81, max_bytecode_size_for_early_opt, 81,
"Maximum bytecode length for a function to be optimized on the first tick") "Maximum bytecode length for a function to be optimized on the first tick")
// Flags for inline caching and feedback vectors. // Flags for inline caching and feedback vectors.
DEFINE_BOOL(use_ic, true, "use inline caching") DEFINE_BOOL(use_ic, true, "use inline caching")
DEFINE_INT(budget_for_feedback_vector_allocation, 940,
"The budget in amount of bytecode executed by a function before we "
"decide to allocate feedback vectors")
DEFINE_INT(scale_factor_for_feedback_allocation, 8,
"scale bytecode size for feedback vector allocation.")
DEFINE_BOOL(feedback_allocation_on_bytecode_size, true,
"Instead of a fixed budget for lazy feedback vector allocation, "
"scale it based in the bytecode size.")
DEFINE_IMPLICATION(sparkplug, feedback_allocation_on_bytecode_size)
DEFINE_BOOL(lazy_feedback_allocation, true, "Allocate feedback vectors lazily") DEFINE_BOOL(lazy_feedback_allocation, true, "Allocate feedback vectors lazily")
// Flags for Ignition. // Flags for Ignition.
......
...@@ -49,7 +49,7 @@ void FeedbackCell::reset_feedback_vector( ...@@ -49,7 +49,7 @@ void FeedbackCell::reset_feedback_vector(
void FeedbackCell::SetInitialInterruptBudget() { void FeedbackCell::SetInitialInterruptBudget() {
if (FLAG_lazy_feedback_allocation) { if (FLAG_lazy_feedback_allocation) {
set_interrupt_budget(FLAG_budget_for_feedback_vector_allocation); set_interrupt_budget(FLAG_interrupt_budget_for_feedback_allocation);
} else { } else {
set_interrupt_budget(FLAG_interrupt_budget); set_interrupt_budget(FLAG_interrupt_budget);
} }
......
...@@ -69,17 +69,14 @@ bool JSFunction::IsMarkedForConcurrentOptimization() { ...@@ -69,17 +69,14 @@ bool JSFunction::IsMarkedForConcurrentOptimization() {
} }
void JSFunction::SetInterruptBudget() { void JSFunction::SetInterruptBudget() {
if (!has_feedback_vector()) { if (has_feedback_vector()) {
FeedbackVector::SetInterruptBudget(raw_feedback_cell());
} else {
DCHECK(shared().is_compiled()); DCHECK(shared().is_compiled());
int budget = FLAG_budget_for_feedback_vector_allocation; raw_feedback_cell().set_interrupt_budget(
if (FLAG_feedback_allocation_on_bytecode_size) { shared().GetBytecodeArray(GetIsolate()).length() *
budget = shared().GetBytecodeArray(GetIsolate()).length() * FLAG_interrupt_budget_factor_for_feedback_allocation);
FLAG_scale_factor_for_feedback_allocation;
}
raw_feedback_cell().set_interrupt_budget(budget);
return;
} }
FeedbackVector::SetInterruptBudget(raw_feedback_cell());
} }
void JSFunction::MarkForOptimization(ConcurrencyMode mode) { void JSFunction::MarkForOptimization(ConcurrencyMode mode) {
......
...@@ -240,18 +240,16 @@ void JSFunction::EnsureClosureFeedbackCellArray( ...@@ -240,18 +240,16 @@ void JSFunction::EnsureClosureFeedbackCellArray(
Handle<SharedFunctionInfo> shared(function->shared(), isolate); Handle<SharedFunctionInfo> shared(function->shared(), isolate);
DCHECK(function->shared().HasBytecodeArray()); DCHECK(function->shared().HasBytecodeArray());
bool has_closure_feedback_cell_array = const bool has_closure_feedback_cell_array =
(function->has_closure_feedback_cell_array() || (function->has_closure_feedback_cell_array() ||
function->has_feedback_vector()); function->has_feedback_vector());
// Initialize the interrupt budget to the feedback vector allocation budget // Initialize the interrupt budget to the feedback vector allocation budget
// when initializing the feedback cell for the first time or after a bytecode // when initializing the feedback cell for the first time or after a bytecode
// flush. We retain the closure feedback cell array on bytecode flush, so // flush. We retain the closure feedback cell array on bytecode flush, so
// reset_budget_for_feedback_allocation is used to reset the budget in these // reset_budget_for_feedback_allocation is used to reset the budget in these
// cases. When using a fixed allocation budget, we reset it on a bytecode // cases.
// flush so no additional initialization is required here. if (reset_budget_for_feedback_allocation ||
if (V8_UNLIKELY(FLAG_feedback_allocation_on_bytecode_size) && !has_closure_feedback_cell_array) {
(reset_budget_for_feedback_allocation ||
!has_closure_feedback_cell_array)) {
function->SetInterruptBudget(); function->SetInterruptBudget();
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// Flags: --sparkplug --no-always-sparkplug --sparkplug-filter="test*" // Flags: --sparkplug --no-always-sparkplug --sparkplug-filter="test*"
// Flags: --allow-natives-syntax --expose-gc --no-always-opt // Flags: --allow-natives-syntax --expose-gc --no-always-opt
// Flags: --baseline-batch-compilation --baseline-batch-compilation-threshold=200 // Flags: --baseline-batch-compilation --baseline-batch-compilation-threshold=200
// Flags: --scale-factor-for-feedback-allocation=4 // Flags: --interrupt-budget-factor-for-feedback-allocation=4
// Flags: --no-concurrent-sparkplug // Flags: --no-concurrent-sparkplug
// Flags to drive Fuzzers into the right direction // Flags to drive Fuzzers into the right direction
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --opt --interrupt-budget=100 --budget-for-feedback-vector-allocation=10 --allow-natives-syntax // Flags: --opt --interrupt-budget=100 --interrupt-budget-for-feedback-allocation=10 --allow-natives-syntax
function f() { function f() {
let s = 0; let s = 0;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --interrupt-budget=200 --stack-size=200 // Flags: --interrupt-budget=200 --stack-size=200
// Flags: --budget-for-feedback-vector-allocation=100 --expose-gc // Flags: --interrupt-budget-for-feedback-allocation=100 --expose-gc
// Flags: --stress-flush-code --flush-bytecode // Flags: --stress-flush-code --flush-bytecode
var i = 0; var i = 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --budget-for-feedback-vector-allocation=0 --interrupt-budget=1000 // Flags: --interrupt-budget-for-feedback-allocation=0 --interrupt-budget=1000
(function() { (function() {
Empty = function() {}; Empty = function() {};
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --invoke-weak-callbacks --budget-for-feedback-vector-allocation=0 // Flags: --invoke-weak-callbacks --interrupt-budget-for-feedback-allocation=0
__v_0 = 0; __v_0 = 0;
function __f_0() { function __f_0() {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
[0.1, "--no-enable-popcnt"], [0.1, "--no-enable-popcnt"],
[0.25, "--no-lazy-feedback-allocation"], [0.25, "--no-lazy-feedback-allocation"],
[0.1, "--no-lazy-feedback-allocation --interrupt-budget=100"], [0.1, "--no-lazy-feedback-allocation --interrupt-budget=100"],
[0.05, "--budget-for-feedback-vector-allocation=0"], [0.05, "--interrupt-budget-for-feedback-allocation=0"],
[0.1, "--no-wasm-generic-wrapper"], [0.1, "--no-wasm-generic-wrapper"],
[0.1, "--turbo-force-mid-tier-regalloc"], [0.1, "--turbo-force-mid-tier-regalloc"],
[0.0001, "--simulate-errors"], [0.0001, "--simulate-errors"],
......
[ [
{"app_args": "--assert-types", "app_name": "d8", "probability": 0.25}, {"app_args": "--assert-types", "app_name": "d8", "probability": 0.25},
{"app_args": "--budget_for_feedback_vector_allocation=0", "app_name": "d8", "probability": 0.05}, {"app_args": "--interrupt-budget-for-feedback-vector-allocation=0", "app_name": "d8", "probability": 0.05},
{"app_args": "--compact-map-space", "app_name": "d8", "probability": 0.25}, {"app_args": "--compact-map-space", "app_name": "d8", "probability": 0.25},
{"app_args": "--force-slow-path", "app_name": "d8", "probability": 0.05}, {"app_args": "--force-slow-path", "app_name": "d8", "probability": 0.05},
{"app_args": "--future", "app_name": "d8", "probability": 0.25}, {"app_args": "--future", "app_name": "d8", "probability": 0.25},
...@@ -35,4 +35,4 @@ ...@@ -35,4 +35,4 @@
{"app_args": "--turbo-instruction-scheduling", "app_name": "d8", "probability": 0.1}, {"app_args": "--turbo-instruction-scheduling", "app_name": "d8", "probability": 0.1},
{"app_args": "--turbo-stress-instruction-scheduling", "app_name": "d8", "probability": 0.1}, {"app_args": "--turbo-stress-instruction-scheduling", "app_name": "d8", "probability": 0.1},
{"app_args": "--wasm-code-gc --stress-wasm-code-gc", "app_name": "d8", "probability": 0.1} {"app_args": "--wasm-code-gc --stress-wasm-code-gc", "app_name": "d8", "probability": 0.1}
] ]
\ No newline at end of file
...@@ -13,7 +13,7 @@ from . import base ...@@ -13,7 +13,7 @@ from . import base
EXTRA_FLAGS = [ EXTRA_FLAGS = [
(0.1, '--always-opt'), (0.1, '--always-opt'),
(0.1, '--assert-types'), (0.1, '--assert-types'),
(0.1, '--budget-for-feedback-vector-allocation=0'), (0.1, '--interrupt-budget-for-feedback-allocation=0'),
(0.1, '--cache=code'), (0.1, '--cache=code'),
(0.25, '--compact-map-space'), (0.25, '--compact-map-space'),
(0.1, '--force-slow-path'), (0.1, '--force-slow-path'),
...@@ -278,7 +278,8 @@ class InterruptBudgetFuzzer(Fuzzer): ...@@ -278,7 +278,8 @@ class InterruptBudgetFuzzer(Fuzzer):
# For most code paths, only one of the flags below has a meaning # For most code paths, only one of the flags below has a meaning
# based on the flag above. # based on the flag above.
flag2 = '--interrupt-budget=%d' % rng.randint(0, 135168) flag2 = '--interrupt-budget=%d' % rng.randint(0, 135168)
flag3 = '--budget-for-feedback-vector-allocation=%d' % rng.randint(0, 940) flag3 = '--interrupt-budget-for-feedback-allocation=%d' % rng.randint(
0, 940)
yield [flag1, flag2, flag3] yield [flag1, flag2, flag3]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment