From b1d5bc8418bcea98e3227eae00b1a1a237281366 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Wed, 1 Jun 2022 18:26:40 +0000 Subject: [PATCH] tint: Add tests showing tint:1332 is fixed The abstract-numeric work has fixed this, by removing the error for small floating point numbers. Fixed: tint:1332 Change-Id: Ibf7382795210220d343d62fe22d201cf67db1ccc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92244 Reviewed-by: Dan Sinclair Commit-Queue: Ben Clayton --- test/tint/bug/tint/1332.wgsl | 5 ++++ test/tint/bug/tint/1332.wgsl.expected.glsl | 11 +++++++++ test/tint/bug/tint/1332.wgsl.expected.hlsl | 5 ++++ test/tint/bug/tint/1332.wgsl.expected.msl | 9 +++++++ test/tint/bug/tint/1332.wgsl.expected.spvasm | 26 ++++++++++++++++++++ test/tint/bug/tint/1332.wgsl.expected.wgsl | 5 ++++ 6 files changed, 61 insertions(+) create mode 100644 test/tint/bug/tint/1332.wgsl create mode 100644 test/tint/bug/tint/1332.wgsl.expected.glsl create mode 100644 test/tint/bug/tint/1332.wgsl.expected.hlsl create mode 100644 test/tint/bug/tint/1332.wgsl.expected.msl create mode 100644 test/tint/bug/tint/1332.wgsl.expected.spvasm create mode 100644 test/tint/bug/tint/1332.wgsl.expected.wgsl diff --git a/test/tint/bug/tint/1332.wgsl b/test/tint/bug/tint/1332.wgsl new file mode 100644 index 0000000000..985fccb2a6 --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl @@ -0,0 +1,5 @@ +@stage(compute) @workgroup_size(1) +fn compute_main() { + let a = 1.23; + var b = max(a, 1.17549435e-38); +} diff --git a/test/tint/bug/tint/1332.wgsl.expected.glsl b/test/tint/bug/tint/1332.wgsl.expected.glsl new file mode 100644 index 0000000000..ce7977b410 --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +void compute_main() { + float b = max(1.230000019f, 1.17549435e-38f); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/bug/tint/1332.wgsl.expected.hlsl b/test/tint/bug/tint/1332.wgsl.expected.hlsl new file mode 100644 index 0000000000..6a9a78badf --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void compute_main() { + float b = max(1.230000019f, 1.17549435e-38f); + return; +} diff --git a/test/tint/bug/tint/1332.wgsl.expected.msl b/test/tint/bug/tint/1332.wgsl.expected.msl new file mode 100644 index 0000000000..57b645da11 --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +kernel void compute_main() { + float const a = 1.230000019f; + float b = fmax(1.230000019f, 1.17549435e-38f); + return; +} + diff --git a/test/tint/bug/tint/1332.wgsl.expected.spvasm b/test/tint/bug/tint/1332.wgsl.expected.spvasm new file mode 100644 index 0000000000..005dab5227 --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %8 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %compute_main "compute_main" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 +%float_1_23000002 = OpConstant %float 1.23000002 +%float_1_17549435en38 = OpConstant %float 1.17549435e-38 +%_ptr_Function_float = OpTypePointer Function %float + %12 = OpConstantNull %float +%compute_main = OpFunction %void None %1 + %4 = OpLabel + %b = OpVariable %_ptr_Function_float Function %12 + %7 = OpExtInst %float %8 NMax %float_1_23000002 %float_1_17549435en38 + OpStore %b %7 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1332.wgsl.expected.wgsl b/test/tint/bug/tint/1332.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0ccd8d4bb --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +@stage(compute) @workgroup_size(1) +fn compute_main() { + let a = 1.230000019; + var b = max(a, 1.17549435e-38); +}