Commit 489f43b4 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

Reland "[wasm] --liftoff-only should disable --wasm-dynamic-tiering"

This is a reland of commit 54e360d1.
The two WasmGC cctests which require SSE4.1 support in Liftoff are now
skipped, so we can keep disallowing any bailout (even for missing CPU
features) in --liftoff-only.

Original change's description:
> [wasm] --liftoff-only should disable --wasm-dynamic-tiering
>
> A Liftoff only configuration should never tier up to TurboFan, hence add
> a proper implication to disable dynamic tiering if --liftoff-only is
> set.
> Also, add a DCHECK to ensure we never accidentally compile with TurboFan
> if --liftoff-only is set.
>
> R=jkummerow@chromium.org
>
> Bug: v8:12281
> Change-Id: Ia9b81add503cc939f59fde3f4d3bb67252facf2c
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3569741
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#79779}

Bug: v8:12281
Change-Id: I334bd81f75c3ef6d31b6117da5ef59a33fb46ae2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3572043Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79813}
parent 6806378c
......@@ -8445,6 +8445,10 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation(
wasm::CompilationEnv* env, const wasm::WireBytesStorage* wire_byte_storage,
const wasm::FunctionBody& func_body, int func_index, Counters* counters,
wasm::WasmFeatures* detected) {
// Check that we do not accidentally compile a Wasm function to TurboFan if
// --liftoff-only is set.
DCHECK(!FLAG_liftoff_only);
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
"wasm.CompileTopTier", "func_index", func_index, "body_size",
func_body.end - func_body.start);
......
......@@ -1008,6 +1008,7 @@ DEFINE_BOOL(liftoff_only, false,
"disallow TurboFan compilation for WebAssembly (for testing)")
DEFINE_IMPLICATION(liftoff_only, liftoff)
DEFINE_NEG_IMPLICATION(liftoff_only, wasm_tier_up)
DEFINE_NEG_IMPLICATION(liftoff_only, wasm_dynamic_tiering)
DEFINE_NEG_IMPLICATION(fuzzing, liftoff_only)
DEFINE_DEBUG_BOOL(
enable_testing_opcode_in_wasm, false,
......
......@@ -293,16 +293,16 @@ void CheckBailoutAllowed(LiftoffBailoutReason reason, const char* detail,
// Decode errors are ok.
if (reason == kDecodeError) return;
// Missing CPU features are also generally OK for now.
if (reason == kMissingCPUFeature) return;
// --liftoff-only ensures that tests actually exercise the Liftoff path
// without bailing out. Bailing out due to (simulated) lack of CPU support
// is okay though (see above).
// without bailing out. We also fail for missing CPU support, to avoid
// running any TurboFan code under --liftoff-only.
if (FLAG_liftoff_only) {
FATAL("--liftoff-only: treating bailout as fatal error. Cause: %s", detail);
}
// Missing CPU features are generally OK, except with --liftoff-only.
if (reason == kMissingCPUFeature) return;
// If --enable-testing-opcode-in-wasm is set, we are expected to bailout with
// "testing opcode".
if (FLAG_enable_testing_opcode_in_wasm &&
......
......@@ -172,6 +172,19 @@ class WasmGCTester {
CheckHasThrownImpl(function_index, sig, &packer, expected);
}
bool HasSimdSupport(TestExecutionTier tier) const {
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
// Liftoff does not have a fallback for executing SIMD instructions if
// SSE4_1 is not available.
if (tier == TestExecutionTier::kLiftoff &&
!CpuFeatures::IsSupported(SSE4_1)) {
return false;
}
#endif
USE(tier);
return true;
}
Handle<WasmInstanceObject> instance() { return instance_; }
Isolate* isolate() { return isolate_; }
WasmModuleBuilder* builder() { return &builder_; }
......@@ -920,6 +933,7 @@ TEST(WasmLetInstruction) {
WASM_COMPILED_EXEC_TEST(WasmBasicArray) {
WasmGCTester tester(execution_tier);
if (!tester.HasSimdSupport(execution_tier)) return;
const byte type_index = tester.DefineArray(wasm::kWasmI32, true);
const byte fp_type_index = tester.DefineArray(wasm::kWasmF64, true);
......@@ -1310,6 +1324,7 @@ WASM_COMPILED_EXEC_TEST(WasmArrayCopy) {
WASM_COMPILED_EXEC_TEST(NewDefault) {
WasmGCTester tester(execution_tier);
if (!tester.HasSimdSupport(execution_tier)) return;
tester.builder()->StartRecursiveTypeGroup();
const byte struct_type = tester.DefineStruct(
......
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