Skip to content

Commit fc8f31c

Browse files
authored
[Relaxed SIMD] Fix validation and fuzzer handling (#8967)
1. An opcode was not noted as requiring the feature. 2. Like NaNs, we can't optimize wasms and then compare them, if relaxed SIMD is enabled.
1 parent 8e444fc commit fc8f31c

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

scripts/fuzz_opt.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,11 @@ def can_run(self, wasm):
864864

865865
@override
866866
def can_compare_to_self(self):
867-
# With nans, VM differences can confuse us, so only very simple VMs
868-
# can compare to themselves after opts in that case.
869-
return not NANS
867+
# With nans or relaxed SIMD, VM differences can confuse us, including
868+
# differences between binaryen and V8 (binaryen's behavior can get
869+
# "baked" into the wasm when it precomputes code, so we cannot compare
870+
# V8's output before binaryen opts and after binaryen opts).
871+
return not NANS and all_disallowed(['relaxed-simd'])
870872

871873
@override
872874
def can_compare_to_other(self, other):
@@ -2048,10 +2050,11 @@ def handle(self, wasm):
20482050
compare(output, optimized_output, 'Two-Opt')
20492051

20502052
# If we can, also test in V8. We also cannot compare if there are NaNs
2051-
# (as optimizations can lead to different outputs), and we must
2052-
# disallow some features.
2053+
# or relaxed SIMD (as binaryen optimizations can lead to different
2054+
# outputs from V8), and we must disallow features that don't even work
2055+
# in V8.
20532056
# TODO: relax some of these
2054-
if NANS or not all_disallowed(DISALLOWED_FEATURES_IN_V8):
2057+
if NANS or not all_disallowed(['relaxed-simd']) or not all_disallowed(DISALLOWED_FEATURES_IN_V8):
20552058
return
20562059

20572060
output = run_d8_wasm(wasm, args=[second_wasm])

src/ir/features.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ inline FeatureSet get(BinaryOp op) {
173173
case RelaxedMinVecF64x2:
174174
case RelaxedMaxVecF64x2:
175175
case RelaxedSwizzleVecI8x16:
176-
case RelaxedQ15MulrSVecI16x8: {
176+
case RelaxedQ15MulrSVecI16x8:
177+
case RelaxedDotI8x16I7x16SToVecI16x8: {
177178
ret.setSIMD();
178179
ret.setRelaxedSIMD();
179180
break;

0 commit comments

Comments
 (0)