From 00e806ff3e50bde87e8706cff60eedf59d9c2e9e Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Tue, 14 Dec 2021 12:46:53 +0100 Subject: [PATCH] Reland "[wasm] Add --wasm-dynamic-tiering to --future" R=jkummerow@chromium.org Bug: v8:12281 Change-Id: If00f34053bb970a71a1826010050b79557dbb381 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3338259 Reviewed-by: Jakob Kummerow Commit-Queue: Andreas Haas Cr-Commit-Position: refs/heads/main@{#78371} --- src/flags/flag-definitions.h | 1 + test/cctest/wasm/test-run-wasm-module.cc | 2 ++ test/cctest/wasm/test-streaming-compilation.cc | 3 +++ test/cctest/wasm/test-wasm-metrics.cc | 1 + test/cctest/wasm/test-wasm-serialization.cc | 5 ++++- test/mjsunit/regress/wasm/regress-11024.js | 1 + test/mjsunit/regress/wasm/regress-7785.js | 2 +- test/mjsunit/regress/wasm/regress-808848.js | 2 +- test/mjsunit/regress/wasm/regress-808980.js | 1 + test/mjsunit/regress/wasm/regress-8896.js | 2 +- test/mjsunit/wasm/compiled-module-serialization.js | 1 + test/mjsunit/wasm/print-code.js | 1 + test/mjsunit/wasm/serialize-lazy-module.js | 2 +- test/mjsunit/wasm/test-partial-serialization.js | 1 + .../mjsunit/wasm/test-serialization-with-lazy-compilation.js | 2 +- 15 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/flags/flag-definitions.h b/src/flags/flag-definitions.h index 5d2453fe0c..031e3b292e 100644 --- a/src/flags/flag-definitions.h +++ b/src/flags/flag-definitions.h @@ -984,6 +984,7 @@ DEFINE_BOOL(wasm_tier_up, true, "have an effect)") DEFINE_BOOL(wasm_dynamic_tiering, false, "enable dynamic tier up to the optimizing compiler") +DEFINE_WEAK_IMPLICATION(future, wasm_dynamic_tiering) DEFINE_INT(wasm_tiering_budget, 1800000, "budget for dynamic tiering (rough approximation of bytes executed") DEFINE_INT( diff --git a/test/cctest/wasm/test-run-wasm-module.cc b/test/cctest/wasm/test-run-wasm-module.cc index 81efe93eb6..3aa0fb6383 100644 --- a/test/cctest/wasm/test-run-wasm-module.cc +++ b/test/cctest/wasm/test-run-wasm-module.cc @@ -201,6 +201,7 @@ TEST(Run_WasmModule_CompilationHintsNoTiering) { } TEST(Run_WasmModule_CompilationHintsTierUp) { + FlagScope no_wasm_dynamic_tiering(&FLAG_wasm_dynamic_tiering, false); if (!FLAG_wasm_tier_up || !FLAG_liftoff) return; { EXPERIMENTAL_FLAG_SCOPE(compilation_hints); @@ -265,6 +266,7 @@ TEST(Run_WasmModule_CompilationHintsTierUp) { } TEST(Run_WasmModule_CompilationHintsLazyBaselineEagerTopTier) { + FlagScope no_wasm_dynamic_tiering(&FLAG_wasm_dynamic_tiering, false); if (!FLAG_wasm_tier_up || !FLAG_liftoff) return; { EXPERIMENTAL_FLAG_SCOPE(compilation_hints); diff --git a/test/cctest/wasm/test-streaming-compilation.cc b/test/cctest/wasm/test-streaming-compilation.cc index 657d2057f0..a6fc58f5d1 100644 --- a/test/cctest/wasm/test-streaming-compilation.cc +++ b/test/cctest/wasm/test-streaming-compilation.cc @@ -1236,6 +1236,7 @@ STREAM_TEST(TestModuleWithErrorAfterDataSection) { // Test that cached bytes work. STREAM_TEST(TestDeserializationBypassesCompilation) { + FlagScope no_wasm_dynamic_tiering(&FLAG_wasm_dynamic_tiering, false); StreamTester tester(isolate); ZoneBuffer wire_bytes = GetValidModuleBytes(tester.zone()); ZoneBuffer module_bytes = @@ -1251,6 +1252,7 @@ STREAM_TEST(TestDeserializationBypassesCompilation) { // Test that bad cached bytes don't cause compilation of wire bytes to fail. STREAM_TEST(TestDeserializationFails) { + FlagScope no_wasm_dynamic_tiering(&FLAG_wasm_dynamic_tiering, false); StreamTester tester(isolate); ZoneBuffer wire_bytes = GetValidModuleBytes(tester.zone()); ZoneBuffer module_bytes = @@ -1294,6 +1296,7 @@ STREAM_TEST(TestFunctionSectionWithoutCodeSection) { } STREAM_TEST(TestSetModuleCompiledCallback) { + FlagScope no_wasm_dynamic_tiering(&FLAG_wasm_dynamic_tiering, false); StreamTester tester(isolate); bool callback_called = false; tester.stream()->SetModuleCompiledCallback( diff --git a/test/cctest/wasm/test-wasm-metrics.cc b/test/cctest/wasm/test-wasm-metrics.cc index 04d02342e8..abb3dc9520 100644 --- a/test/cctest/wasm/test-wasm-metrics.cc +++ b/test/cctest/wasm/test-wasm-metrics.cc @@ -269,6 +269,7 @@ class MetricsRecorder : public v8::metrics::Recorder { }; COMPILE_TEST(TestEventMetrics) { + FlagScope no_wasm_dynamic_tiering(&FLAG_wasm_dynamic_tiering, false); std::shared_ptr recorder = std::make_shared(); reinterpret_cast(isolate)->SetMetricsRecorder(recorder); diff --git a/test/cctest/wasm/test-wasm-serialization.cc b/test/cctest/wasm/test-wasm-serialization.cc index e61be71fdc..9678a41b3e 100644 --- a/test/cctest/wasm/test-wasm-serialization.cc +++ b/test/cctest/wasm/test-wasm-serialization.cc @@ -31,7 +31,9 @@ namespace test_wasm_serialization { // Approximate gtest TEST_F style, in case we adopt gtest. class WasmSerializationTest { public: - WasmSerializationTest() : zone_(&allocator_, ZONE_NAME) { + WasmSerializationTest() + : zone_(&allocator_, ZONE_NAME), + no_wasm_dynamic_tiering_(&FLAG_wasm_dynamic_tiering, false) { // Don't call here if we move to gtest. SetUp(); } @@ -184,6 +186,7 @@ class WasmSerializationTest { v8::OwnedBuffer data_; v8::MemorySpan wire_bytes_ = {nullptr, 0}; v8::MemorySpan serialized_bytes_ = {nullptr, 0}; + FlagScope no_wasm_dynamic_tiering_; }; const char* WasmSerializationTest::kFunctionName = "increment"; diff --git a/test/mjsunit/regress/wasm/regress-11024.js b/test/mjsunit/regress/wasm/regress-11024.js index 1b5168ba95..5d9936a6bd 100644 --- a/test/mjsunit/regress/wasm/regress-11024.js +++ b/test/mjsunit/regress/wasm/regress-11024.js @@ -5,6 +5,7 @@ // The test needs --no-liftoff because we can't serialize and deserialize // Liftoff code. // Flags: --expose-wasm --allow-natives-syntax --expose-gc --no-liftoff +// Flags: --no-wasm-dynamic-tiering d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); diff --git a/test/mjsunit/regress/wasm/regress-7785.js b/test/mjsunit/regress/wasm/regress-7785.js index 0faa88546e..ebf22ce860 100644 --- a/test/mjsunit/regress/wasm/regress-7785.js +++ b/test/mjsunit/regress/wasm/regress-7785.js @@ -4,7 +4,7 @@ // The test needs --wasm-tier-up because we can't serialize and deserialize // Liftoff code. -// Flags: --allow-natives-syntax --wasm-tier-up +// Flags: --allow-natives-syntax --wasm-tier-up --no-wasm-dynamic-tiering d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); diff --git a/test/mjsunit/regress/wasm/regress-808848.js b/test/mjsunit/regress/wasm/regress-808848.js index 0aee72ea8c..84bec82a98 100644 --- a/test/mjsunit/regress/wasm/regress-808848.js +++ b/test/mjsunit/regress/wasm/regress-808848.js @@ -4,7 +4,7 @@ // The test needs --wasm-tier-up because we can't serialize and deserialize // Liftoff code. -// Flags: --allow-natives-syntax --wasm-tier-up +// Flags: --allow-natives-syntax --wasm-tier-up --no-wasm-dynamic-tiering d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js'); diff --git a/test/mjsunit/regress/wasm/regress-808980.js b/test/mjsunit/regress/wasm/regress-808980.js index 4da9ebc963..3f5e22d696 100644 --- a/test/mjsunit/regress/wasm/regress-808980.js +++ b/test/mjsunit/regress/wasm/regress-808980.js @@ -5,6 +5,7 @@ // The test needs --wasm-tier-up because we can't serialize and deserialize // Liftoff code. // Flags: --allow-natives-syntax --throws --wasm-tier-up +// Flags: --no-wasm-dynamic-tiering d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js'); let kTableSize = 3; diff --git a/test/mjsunit/regress/wasm/regress-8896.js b/test/mjsunit/regress/wasm/regress-8896.js index 733b6aa00a..7485b05bb4 100644 --- a/test/mjsunit/regress/wasm/regress-8896.js +++ b/test/mjsunit/regress/wasm/regress-8896.js @@ -4,7 +4,7 @@ // Flags: --experimental-wasm-eh --allow-natives-syntax // Disable Liftoff so we can serialize the module. -// Flags: --no-liftoff +// Flags: --no-liftoff --no-wasm-dynamic-tiering d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); diff --git a/test/mjsunit/wasm/compiled-module-serialization.js b/test/mjsunit/wasm/compiled-module-serialization.js index 74c48525e0..50b32885b3 100644 --- a/test/mjsunit/wasm/compiled-module-serialization.js +++ b/test/mjsunit/wasm/compiled-module-serialization.js @@ -5,6 +5,7 @@ // The test needs --wasm-tier-up because we can't serialize and deserialize // Liftoff code. // Flags: --expose-wasm --allow-natives-syntax --expose-gc --wasm-tier-up +// Flags: --no-wasm-dynamic-tiering d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); diff --git a/test/mjsunit/wasm/print-code.js b/test/mjsunit/wasm/print-code.js index 633706bd77..2ce0b482e3 100644 --- a/test/mjsunit/wasm/print-code.js +++ b/test/mjsunit/wasm/print-code.js @@ -5,6 +5,7 @@ // The test needs --wasm-tier-up because we can't serialize and deserialize // Liftoff code. // Flags: --allow-natives-syntax --print-wasm-code --wasm-tier-up +// Flags: --no-wasm-dynamic-tiering // Just test that printing the code of the following wasm modules does not // crash. diff --git a/test/mjsunit/wasm/serialize-lazy-module.js b/test/mjsunit/wasm/serialize-lazy-module.js index 2e71cad973..a855485565 100644 --- a/test/mjsunit/wasm/serialize-lazy-module.js +++ b/test/mjsunit/wasm/serialize-lazy-module.js @@ -5,7 +5,7 @@ // The test needs --no-liftoff because we can't serialize and deserialize // Liftoff code. // Flags: --wasm-lazy-compilation --allow-natives-syntax --expose-gc -// Flags: --no-liftoff +// Flags: --no-liftoff --no-wasm-dynamic-tiering d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js'); diff --git a/test/mjsunit/wasm/test-partial-serialization.js b/test/mjsunit/wasm/test-partial-serialization.js index 150c5c8e69..bfab7a5645 100644 --- a/test/mjsunit/wasm/test-partial-serialization.js +++ b/test/mjsunit/wasm/test-partial-serialization.js @@ -3,6 +3,7 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --liftoff --no-wasm-tier-up --expose-gc +// Flags: --no-wasm-dynamic-tiering // Compile functions 0 and 2 with Turbofan, the rest with Liftoff: // Flags: --wasm-tier-mask-for-testing=5 diff --git a/test/mjsunit/wasm/test-serialization-with-lazy-compilation.js b/test/mjsunit/wasm/test-serialization-with-lazy-compilation.js index d706c34890..14fd595fb9 100644 --- a/test/mjsunit/wasm/test-serialization-with-lazy-compilation.js +++ b/test/mjsunit/wasm/test-serialization-with-lazy-compilation.js @@ -5,7 +5,7 @@ // The test needs --no-liftoff because we can't serialize and deserialize // Liftoff code. // Flags: --allow-natives-syntax --wasm-lazy-compilation --expose-gc -// Flags: --no-liftoff +// Flags: --no-liftoff --no-wasm-dynamic-tiering d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');