From b8ed5c135a434e196c7bda1576e3a4ca1e38417f Mon Sep 17 00:00:00 2001 From: Steve Suzuki Date: Tue, 26 Aug 2025 16:03:54 +0000 Subject: [PATCH 1/3] Prevent error from being fused with scalar in simd_op_check Fix the output mismatch in fmls with float16 type where error() was optimized in a way that it is fused with scalar computation. compute_root() makes sure scalar result is computed independently. --- test/correctness/simd_op_check.h | 1 + 1 file changed, 1 insertion(+) diff --git a/test/correctness/simd_op_check.h b/test/correctness/simd_op_check.h index bb48ce12ce5f..d1968bc810b3 100644 --- a/test/correctness/simd_op_check.h +++ b/test/correctness/simd_op_check.h @@ -327,6 +327,7 @@ class SimdOpCheckTest { // Include a scalar version Halide::Func f_scalar("scalar_" + name); f_scalar(x, y) = e; + f_scalar.compute_root(); if (has_inline_reduction.result) { // If there's an inline reduction, we want to vectorize it From d5250738f911e41fb34e83d6a7fff2b8643f8059 Mon Sep 17 00:00:00 2001 From: Steve Suzuki Date: Tue, 18 Nov 2025 08:06:01 +0000 Subject: [PATCH 2/3] Add comments --- test/correctness/simd_op_check.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/correctness/simd_op_check.h b/test/correctness/simd_op_check.h index d1968bc810b3..53af05c5795f 100644 --- a/test/correctness/simd_op_check.h +++ b/test/correctness/simd_op_check.h @@ -327,6 +327,8 @@ class SimdOpCheckTest { // Include a scalar version Halide::Func f_scalar("scalar_" + name); f_scalar(x, y) = e; + // Make sure scalar result is computed independently to prevent it + // from being fused into error() by optimization which complicates floating point errors. f_scalar.compute_root(); if (has_inline_reduction.result) { From 0246ae370d2d40153c32f9d04ba00e7c64fb4f7b Mon Sep 17 00:00:00 2001 From: Alex Reinking Date: Tue, 18 Nov 2025 11:48:13 -0500 Subject: [PATCH 3/3] Update vector load*_splat checks in simd_op_check_wasm.cpp --- test/correctness/simd_op_check_wasm.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/correctness/simd_op_check_wasm.cpp b/test/correctness/simd_op_check_wasm.cpp index 36434a8e8a8a..0fa8dd7c7ac5 100644 --- a/test/correctness/simd_op_check_wasm.cpp +++ b/test/correctness/simd_op_check_wasm.cpp @@ -385,11 +385,11 @@ class SimdOpCheckWASM : public SimdOpCheckTest { // check("v128.load32_zero", 2 * w, in_u32(0)); // check("v128.load64_zero", 2 * w, in_u64(0)); - // Load vector with identical lanes generates *.splat. - check("i8x16.splat", 16 * w, in_u8(0)); - check("i16x8.splat", 8 * w, in_u16(0)); - check("i32x4.splat", 4 * w, in_u32(0)); - check("i64x2.splat", 2 * w, in_u64(0)); + // Load vector with identical lanes generates load*_splat. + check("v128.load8_splat", 16 * w, in_u8(0)); + check("v128.load16_splat", 8 * w, in_u16(0)); + check("v128.load32_splat", 4 * w, in_u32(0)); + check("v128.load64_splat", 2 * w, in_u64(0)); // Load Lane // TODO: does Halide have any idiom that obviously generates these?