Skip to content

Commit cccbd5f

Browse files
ngzhianCommit Bot
authored andcommitted
Reland "[wasm-simd][liftoff] Check CpuFeatures for SIMD support"
This relands commit 7c32fa0. Some test cases need to be updated, since we will bail out to TurboFan where previously Liftoff was happy to run, when SIMD is not supported. Original change's description: > [wasm-simd][liftoff] Check CpuFeatures for SIMD support > > If Wasm simd128 is not supported on this particular hardware, we bail > out to TurboFan. > > Bug: v8:9909 > Change-Id: Ie46e154426783ba099b7c0facc906670cda1bdd0 > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2029427 > Reviewed-by: Clemens Backes <[email protected]> > Commit-Queue: Zhi An Ng <[email protected]> > Cr-Commit-Position: refs/heads/master@{#66055} Bug: v8:9909 Bug: v8:10169 Change-Id: I850e1fe6bfbd12fb2eec052aa8367624c09f7a08 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2030354 Commit-Queue: Zhi An Ng <[email protected]> Reviewed-by: Clemens Backes <[email protected]> Cr-Commit-Position: refs/heads/master@{#66090}
1 parent bdac09e commit cccbd5f

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/wasm/baseline/liftoff-compiler.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ class LiftoffCompiler {
357357
bool CheckSupportedType(FullDecoder* decoder,
358358
Vector<const ValueType> supported_types,
359359
ValueType type, const char* context) {
360+
// Special case for kWasm128 which requires specific hardware support.
361+
if (type == kWasmS128 && (!CpuFeatures::SupportsWasmSimd128())) {
362+
unsupported(decoder, kSimd, "simd");
363+
return false;
364+
}
360365
// Check supported types.
361366
for (ValueType supported : supported_types) {
362367
if (type == supported) return true;
@@ -2198,6 +2203,9 @@ class LiftoffCompiler {
21982203

21992204
void SimdOp(FullDecoder* decoder, WasmOpcode opcode, Vector<Value> args,
22002205
Value* result) {
2206+
if (!CpuFeatures::SupportsWasmSimd128()) {
2207+
return unsupported(decoder, kSimd, "simd");
2208+
}
22012209
switch (opcode) {
22022210
case wasm::kExprF32x4Splat:
22032211
EmitUnOp<kWasmF32, kWasmS128>(

test/cctest/wasm/test-run-wasm-simd-liftoff.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ WASM_SIMD_LIFTOFF_TEST(S128Local) {
3232
byte temp1 = r.AllocateLocal(kWasmS128);
3333
BUILD(r, WASM_SET_LOCAL(temp1, WASM_GET_LOCAL(temp1)), WASM_ONE);
3434
CHECK_EQ(1, r.Call());
35-
r.CheckUsedExecutionTier(ExecutionTier::kLiftoff);
3635
}
3736

3837
WASM_SIMD_LIFTOFF_TEST(S128Global) {
@@ -47,7 +46,6 @@ WASM_SIMD_LIFTOFF_TEST(S128Global) {
4746
WriteLittleEndianValue<int32_t>(&g0[i], expected);
4847
}
4948
r.Call();
50-
r.CheckUsedExecutionTier(ExecutionTier::kLiftoff);
5149
for (int i = 0; i < 4; i++) {
5250
int32_t actual = ReadLittleEndianValue<int32_t>(&g1[i]);
5351
CHECK_EQ(actual, expected);
@@ -70,7 +68,6 @@ WASM_SIMD_LIFTOFF_TEST(S128Param) {
7068
WASM_CALL_FUNCTION(simd_func.function_index(), WASM_GET_LOCAL(temp1)));
7169

7270
CHECK_EQ(1, r.Call());
73-
r.CheckUsedExecutionTier(ExecutionTier::kLiftoff);
7471
}
7572

7673
WASM_SIMD_LIFTOFF_TEST(S128Return) {
@@ -85,7 +82,6 @@ WASM_SIMD_LIFTOFF_TEST(S128Return) {
8582
WASM_ONE);
8683

8784
CHECK_EQ(1, r.Call());
88-
r.CheckUsedExecutionTier(ExecutionTier::kLiftoff);
8985
}
9086

9187
#undef WASM_SIMD_LIFTOFF_TEST

test/message/wasm-trace-memory-liftoff.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
// Flags: --no-stress-opt --trace-wasm-memory --liftoff --no-future
66
// Flags: --no-wasm-tier-up --experimental-wasm-simd
7+
// Flags: --enable-sse3 --enable-sse4-1
78

8-
// liftoff does not support simd128, so the s128 load and store traces are in
9-
// the turbofan tier and not liftoff
9+
// Force enable sse3 and sse4-1, since that will determine which execution tier
10+
// we use, and thus the expected output message will differ.
1011
load("test/message/wasm-trace-memory.js");

test/mjsunit/wasm/simd-call.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// found in the LICENSE file.
44

55
// Flags: --experimental-wasm-simd
6-
// Flags: --nowasm-tier-up
7-
// TODO(v8/10169)
86

97
load('test/mjsunit/wasm/wasm-module-builder.js');
108

0 commit comments

Comments
 (0)