Commit c4468c39 authored by Deepti Gandluri's avatar Deepti Gandluri Committed by Commit Bot

[wasm-simd] Remove simd lowering compilation env variable

Bug: v8:11613
Change-Id: I25bf720164129c3d95ebc07d0c2a0f6e6b8ee9af
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2847473Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74131}
parent 7961ab1b
......@@ -7470,7 +7470,7 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic(
wasm::CompilationEnv env(
nullptr, wasm::UseTrapHandler::kNoTrapHandler,
wasm::RuntimeExceptionSupport::kNoRuntimeExceptionSupport,
wasm::WasmFeatures::All(), wasm::LowerSimd::kNoLowerSimd);
wasm::WasmFeatures::All());
WasmGraphBuilder builder(&env, mcgraph->zone(), mcgraph, sig,
source_positions);
......@@ -7870,8 +7870,7 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation(
call_descriptor = GetI32WasmCallDescriptor(&zone, call_descriptor);
}
if (ContainsSimd(func_body.sig) &&
(!CpuFeatures::SupportsWasmSimd128() || env->lower_simd)) {
if (ContainsSimd(func_body.sig) && !CpuFeatures::SupportsWasmSimd128()) {
call_descriptor = GetI32WasmCallDescriptorForSimd(&zone, call_descriptor);
}
......
......@@ -38,8 +38,6 @@ enum RuntimeExceptionSupport : bool {
enum UseTrapHandler : bool { kUseTrapHandler = true, kNoTrapHandler = false };
enum LowerSimd : bool { kLowerSimd = true, kNoLowerSimd = false };
// The {CompilationEnv} encapsulates the module data that is used during
// compilation. CompilationEnvs are shareable across multiple compilations.
struct CompilationEnv {
......@@ -66,8 +64,6 @@ struct CompilationEnv {
// Features enabled for this compilation.
const WasmFeatures enabled_features;
const LowerSimd lower_simd;
static constexpr uint32_t kMaxMemoryPagesAtRuntime =
std::min(kV8MaxWasmMemoryPages,
std::numeric_limits<uintptr_t>::max() / kWasmPageSize);
......@@ -75,8 +71,7 @@ struct CompilationEnv {
constexpr CompilationEnv(const WasmModule* module,
UseTrapHandler use_trap_handler,
RuntimeExceptionSupport runtime_exception_support,
const WasmFeatures& enabled_features,
LowerSimd lower_simd = kNoLowerSimd)
const WasmFeatures& enabled_features)
: module(module),
use_trap_handler(use_trap_handler),
runtime_exception_support(runtime_exception_support),
......@@ -90,8 +85,7 @@ struct CompilationEnv {
module && module->has_maximum_pages ? module->maximum_pages
: max_mem_pages()) *
uint64_t{kWasmPageSize})),
enabled_features(enabled_features),
lower_simd(lower_simd) {}
enabled_features(enabled_features) {}
};
// The wire bytes are either owned by the StreamingDecoder, or (after streaming)
......
......@@ -881,7 +881,7 @@ void NativeModule::LogWasmCodes(Isolate* isolate, Script script) {
CompilationEnv NativeModule::CreateCompilationEnv() const {
return {module(), use_trap_handler_, kRuntimeExceptionSupport,
enabled_features_, kNoLowerSimd};
enabled_features_};
}
WasmCode* NativeModule::AddCodeForTesting(Handle<Code> code) {
......
......@@ -22,7 +22,7 @@ class LiftoffCompileEnvironment {
handle_scope_(isolate_),
zone_(isolate_->allocator(), ZONE_NAME),
wasm_runner_(nullptr, TestExecutionTier::kLiftoff, 0,
kRuntimeExceptionSupport, kNoLowerSimd) {
kRuntimeExceptionSupport) {
// Add a table of length 1, for indirect calls.
wasm_runner_.builder().AddIndirectFunctionTable(nullptr, 1);
// Set tiered down such that we generate debugging code.
......
......@@ -16,20 +16,18 @@ namespace wasm {
namespace test_run_wasm_relaxed_simd {
// Use this for experimental relaxed-simd opcodes.
#define WASM_RELAXED_SIMD_TEST(name) \
void RunWasm_##name##_Impl(LowerSimd lower_simd, \
TestExecutionTier execution_tier); \
TEST(RunWasm_##name##_turbofan) { \
if (!CpuFeatures::SupportsWasmSimd128()) return; \
EXPERIMENTAL_FLAG_SCOPE(relaxed_simd); \
RunWasm_##name##_Impl(kNoLowerSimd, TestExecutionTier::kTurbofan); \
} \
TEST(RunWasm_##name##_interpreter) { \
EXPERIMENTAL_FLAG_SCOPE(relaxed_simd); \
RunWasm_##name##_Impl(kNoLowerSimd, TestExecutionTier::kInterpreter); \
} \
void RunWasm_##name##_Impl(LowerSimd lower_simd, \
TestExecutionTier execution_tier)
#define WASM_RELAXED_SIMD_TEST(name) \
void RunWasm_##name##_Impl(TestExecutionTier execution_tier); \
TEST(RunWasm_##name##_turbofan) { \
if (!CpuFeatures::SupportsWasmSimd128()) return; \
EXPERIMENTAL_FLAG_SCOPE(relaxed_simd); \
RunWasm_##name##_Impl(TestExecutionTier::kTurbofan); \
} \
TEST(RunWasm_##name##_interpreter) { \
EXPERIMENTAL_FLAG_SCOPE(relaxed_simd); \
RunWasm_##name##_Impl(TestExecutionTier::kInterpreter); \
} \
void RunWasm_##name##_Impl(TestExecutionTier execution_tier)
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X || \
V8_TARGET_ARCH_PPC64
......@@ -125,7 +123,7 @@ bool ExpectFused(TestExecutionTier tier) {
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X || \
V8_TARGET_ARCH_PPC64
WASM_RELAXED_SIMD_TEST(F32x4Qfma) {
WasmRunner<int32_t, float, float, float> r(execution_tier, lower_simd);
WasmRunner<int32_t, float, float, float> r(execution_tier);
// Set up global to hold mask output.
float* g = r.builder().AddGlobal<float>(kWasmS128);
// Build fn to splat test values, perform compare op, and write the result.
......@@ -149,7 +147,7 @@ WASM_RELAXED_SIMD_TEST(F32x4Qfma) {
}
WASM_RELAXED_SIMD_TEST(F32x4Qfms) {
WasmRunner<int32_t, float, float, float> r(execution_tier, lower_simd);
WasmRunner<int32_t, float, float, float> r(execution_tier);
// Set up global to hold mask output.
float* g = r.builder().AddGlobal<float>(kWasmS128);
// Build fn to splat test values, perform compare op, and write the result.
......@@ -173,7 +171,7 @@ WASM_RELAXED_SIMD_TEST(F32x4Qfms) {
}
WASM_RELAXED_SIMD_TEST(F64x2Qfma) {
WasmRunner<int32_t, double, double, double> r(execution_tier, lower_simd);
WasmRunner<int32_t, double, double, double> r(execution_tier);
// Set up global to hold mask output.
double* g = r.builder().AddGlobal<double>(kWasmS128);
// Build fn to splat test values, perform compare op, and write the result.
......@@ -197,7 +195,7 @@ WASM_RELAXED_SIMD_TEST(F64x2Qfma) {
}
WASM_RELAXED_SIMD_TEST(F64x2Qfms) {
WasmRunner<int32_t, double, double, double> r(execution_tier, lower_simd);
WasmRunner<int32_t, double, double, double> r(execution_tier);
// Set up global to hold mask output.
double* g = r.builder().AddGlobal<double>(kWasmS128);
// Build fn to splat test values, perform compare op, and write the result.
......@@ -223,13 +221,13 @@ WASM_RELAXED_SIMD_TEST(F64x2Qfms) {
// V8_TARGET_ARCH_PPC64
WASM_RELAXED_SIMD_TEST(F32x4RecipApprox) {
RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4RecipApprox,
base::Recip, false /* !exact */);
RunF32x4UnOpTest(execution_tier, kExprF32x4RecipApprox, base::Recip,
false /* !exact */);
}
WASM_RELAXED_SIMD_TEST(F32x4RecipSqrtApprox) {
RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4RecipSqrtApprox,
base::RecipSqrt, false /* !exact */);
RunF32x4UnOpTest(execution_tier, kExprF32x4RecipSqrtApprox, base::RecipSqrt,
false /* !exact */);
}
#undef WASM_RELAXED_SIMD_TEST
......
......@@ -30,14 +30,14 @@ namespace test_run_wasm_simd_liftoff {
void RunWasm_##name##_Impl()
WASM_SIMD_LIFTOFF_TEST(S128Local) {
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd);
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff);
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_LOCAL_GET(temp1)), WASM_ONE);
CHECK_EQ(1, r.Call());
}
WASM_SIMD_LIFTOFF_TEST(S128Global) {
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd);
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff);
int32_t* g0 = r.builder().AddGlobal<int32_t>(kWasmS128);
int32_t* g1 = r.builder().AddGlobal<int32_t>(kWasmS128);
......@@ -58,7 +58,7 @@ WASM_SIMD_LIFTOFF_TEST(S128Param) {
// Test how SIMD parameters in functions are processed. There is no easy way
// to specify a SIMD value when initializing a WasmRunner, so we manually
// add a new function with the right signature, and call it from main.
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd);
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff);
TestSignatures sigs;
// We use a temp local to materialize a SIMD value, since at this point
// Liftoff does not support any SIMD operations.
......@@ -74,7 +74,7 @@ WASM_SIMD_LIFTOFF_TEST(S128Param) {
WASM_SIMD_LIFTOFF_TEST(S128Return) {
// Test how functions returning SIMD values are processed.
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd);
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff);
TestSignatures sigs;
WasmFunctionCompiler& simd_func = r.NewFunction(sigs.s_i());
byte temp1 = simd_func.AllocateLocal(kWasmS128);
......@@ -93,7 +93,7 @@ WASM_SIMD_LIFTOFF_TEST(REGRESS_1088273) {
// explicitly skip them.
if (!CpuFeatures::SupportsWasmSimd128()) return;
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd);
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff);
TestSignatures sigs;
WasmFunctionCompiler& simd_func = r.NewFunction(sigs.s_i());
byte temp1 = simd_func.AllocateLocal(kWasmS128);
......@@ -109,7 +109,7 @@ WASM_SIMD_LIFTOFF_TEST(REGRESS_1088273) {
// implementation in Liftoff is a bit more tricky due to shuffle requiring
// adjacent registers in ARM/ARM64.
WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle) {
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd);
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff);
// Temps to use up registers and force non-adjacent registers for shuffle.
byte local0 = r.AllocateLocal(kWasmS128);
byte local1 = r.AllocateLocal(kWasmS128);
......@@ -154,7 +154,7 @@ WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle) {
// Exercise logic in Liftoff's implementation of shuffle when inputs to the
// shuffle are the same register.
WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle_SingleOperand) {
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd);
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff);
byte local0 = r.AllocateLocal(kWasmS128);
byte* g0 = r.builder().AddGlobal<byte>(kWasmS128);
......@@ -190,7 +190,7 @@ WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle_SingleOperand) {
// incorrect instruction for storing zeroes into the slot when the slot offset
// was too large to fit in the instruction as an immediate.
WASM_SIMD_LIFTOFF_TEST(FillStackSlotsWithZero_CheckStartOffset) {
WasmRunner<int64_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd);
WasmRunner<int64_t> r(TestExecutionTier::kLiftoff);
// Function that takes in 32 i64 arguments, returns i64. This gets us a large
// enough starting offset from which we spill locals.
// start = 32 * 8 + 16 (instance) = 272 (cannot fit in signed int9).
......
This diff is collapsed.
......@@ -21,14 +21,12 @@ namespace wasm {
TestingModuleBuilder::TestingModuleBuilder(
Zone* zone, ManuallyImportedJSFunction* maybe_import,
TestExecutionTier tier, RuntimeExceptionSupport exception_support,
LowerSimd lower_simd)
TestExecutionTier tier, RuntimeExceptionSupport exception_support)
: test_module_(std::make_shared<WasmModule>()),
isolate_(CcTest::InitIsolateOnce()),
enabled_features_(WasmFeatures::FromIsolate(isolate_)),
execution_tier_(tier),
runtime_exception_support_(exception_support),
lower_simd_(lower_simd) {
runtime_exception_support_(exception_support) {
WasmJs::Install(isolate_, true);
test_module_->untagged_globals_buffer_size = kMaxGlobalsSize;
memset(globals_data_, 0, sizeof(globals_data_));
......@@ -313,7 +311,7 @@ CompilationEnv TestingModuleBuilder::CreateCompilationEnv() {
V8_TRAP_HANDLER_SUPPORTED && i::FLAG_wasm_trap_handler;
return {test_module_.get(),
is_trap_handler_enabled ? kUseTrapHandler : kNoTrapHandler,
runtime_exception_support_, enabled_features_, lower_simd()};
runtime_exception_support_, enabled_features_};
}
const WasmGlobal* TestingModuleBuilder::AddGlobal(ValueType type) {
......
......@@ -98,7 +98,7 @@ struct ManuallyImportedJSFunction {
class TestingModuleBuilder {
public:
TestingModuleBuilder(Zone*, ManuallyImportedJSFunction*, TestExecutionTier,
RuntimeExceptionSupport, LowerSimd);
RuntimeExceptionSupport);
~TestingModuleBuilder();
void ChangeOriginToAsmjs() { test_module_->origin = kAsmJsSloppyOrigin; }
......@@ -219,7 +219,6 @@ class TestingModuleBuilder {
WasmInterpreter* interpreter() const { return interpreter_.get(); }
bool interpret() const { return interpreter_ != nullptr; }
LowerSimd lower_simd() const { return lower_simd_; }
Isolate* isolate() const { return isolate_; }
Handle<WasmInstanceObject> instance_object() const {
return instance_object_;
......@@ -273,7 +272,6 @@ class TestingModuleBuilder {
Handle<WasmInstanceObject> instance_object_;
NativeModule* native_module_ = nullptr;
RuntimeExceptionSupport runtime_exception_support_;
LowerSimd lower_simd_;
// Data segment arrays that are normally allocated on the instance.
std::vector<byte> data_segment_data_;
......@@ -386,11 +384,10 @@ class WasmRunnerBase : public InitializedHandleScope {
public:
WasmRunnerBase(ManuallyImportedJSFunction* maybe_import,
TestExecutionTier execution_tier, int num_params,
RuntimeExceptionSupport runtime_exception_support,
LowerSimd lower_simd)
RuntimeExceptionSupport runtime_exception_support)
: zone_(&allocator_, ZONE_NAME, kCompressGraphZone),
builder_(&zone_, maybe_import, execution_tier,
runtime_exception_support, lower_simd),
runtime_exception_support),
wrapper_(&zone_, num_params) {}
static void SetUpTrapCallback() {
......@@ -549,10 +546,9 @@ class WasmRunner : public WasmRunnerBase {
ManuallyImportedJSFunction* maybe_import = nullptr,
const char* main_fn_name = "main",
RuntimeExceptionSupport runtime_exception_support =
kNoRuntimeExceptionSupport,
LowerSimd lower_simd = kNoLowerSimd)
kNoRuntimeExceptionSupport)
: WasmRunnerBase(maybe_import, execution_tier, sizeof...(ParamTypes),
runtime_exception_support, lower_simd) {
runtime_exception_support) {
WasmFunctionCompiler& main_fn =
NewFunction<ReturnType, ParamTypes...>(main_fn_name);
// Non-zero if there is an import.
......@@ -563,10 +559,6 @@ class WasmRunner : public WasmRunnerBase {
}
}
WasmRunner(TestExecutionTier execution_tier, LowerSimd lower_simd)
: WasmRunner(execution_tier, nullptr, "main", kNoRuntimeExceptionSupport,
lower_simd) {}
ReturnType Call(ParamTypes... p) {
Isolate* isolate = CcTest::InitIsolateOnce();
// Save the original context, because CEntry (for runtime calls) will
......
This diff is collapsed.
......@@ -38,43 +38,41 @@ using DoubleUnOp = double (*)(double);
using DoubleBinOp = double (*)(double, double);
using DoubleCompareOp = int64_t (*)(double, double);
void RunI8x16UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int8UnOp expected_op);
void RunI8x16UnOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int8UnOp expected_op);
template <typename T = int8_t, typename OpType = T (*)(T, T)>
void RunI8x16BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, OpType expected_op);
void RunI8x16BinOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
OpType expected_op);
void RunI8x16ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int8ShiftOp expected_op);
void RunI8x16ShiftOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int8ShiftOp expected_op);
void RunI8x16MixedRelationalOpTest(TestExecutionTier execution_tier,
LowerSimd lower_simd, WasmOpcode opcode,
Int8BinOp expected_op);
WasmOpcode opcode, Int8BinOp expected_op);
void RunI16x8UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int16UnOp expected_op);
void RunI16x8UnOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int16UnOp expected_op);
template <typename T = int16_t, typename OpType = T (*)(T, T)>
void RunI16x8BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, OpType expected_op);
void RunI16x8ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int16ShiftOp expected_op);
void RunI16x8BinOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
OpType expected_op);
void RunI16x8ShiftOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int16ShiftOp expected_op);
void RunI16x8MixedRelationalOpTest(TestExecutionTier execution_tier,
LowerSimd lower_simd, WasmOpcode opcode,
Int16BinOp expected_op);
void RunI32x4UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int32UnOp expected_op);
void RunI32x4BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int32BinOp expected_op);
void RunI32x4ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int32ShiftOp expected_op);
void RunI64x2UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int64UnOp expected_op);
void RunI64x2BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int64BinOp expected_op);
void RunI64x2ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int64ShiftOp expected_op);
WasmOpcode opcode, Int16BinOp expected_op);
void RunI32x4UnOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int32UnOp expected_op);
void RunI32x4BinOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int32BinOp expected_op);
void RunI32x4ShiftOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int32ShiftOp expected_op);
void RunI64x2UnOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int64UnOp expected_op);
void RunI64x2BinOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int64BinOp expected_op);
void RunI64x2ShiftOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
Int64ShiftOp expected_op);
// Generic expected value functions.
template <typename T, typename = typename std::enable_if<
......@@ -152,24 +150,20 @@ bool IsCanonical(double actual);
void CheckDoubleResult(double x, double y, double expected, double actual,
bool exact = true);
void RunF32x4UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, FloatUnOp expected_op,
bool exact = true);
void RunF32x4UnOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
FloatUnOp expected_op, bool exact = true);
void RunF32x4BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, FloatBinOp expected_op);
void RunF32x4BinOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
FloatBinOp expected_op);
void RunF32x4CompareOpTest(TestExecutionTier execution_tier,
LowerSimd lower_simd, WasmOpcode opcode,
void RunF32x4CompareOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
FloatCompareOp expected_op);
void RunF64x2UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, DoubleUnOp expected_op,
bool exact = true);
void RunF64x2BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, DoubleBinOp expected_op);
void RunF64x2CompareOpTest(TestExecutionTier execution_tier,
LowerSimd lower_simd, WasmOpcode opcode,
void RunF64x2UnOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
DoubleUnOp expected_op, bool exact = true);
void RunF64x2BinOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
DoubleBinOp expected_op);
void RunF64x2CompareOpTest(TestExecutionTier execution_tier, WasmOpcode opcode,
DoubleCompareOp expected_op);
} // namespace wasm
......
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