From d981a0c1e6e287ebb2549b96638fb7267a1c2cfa Mon Sep 17 00:00:00 2001 From: Julian Ng-Thow-Hing Date: Wed, 22 Jul 2026 15:29:52 -0700 Subject: [PATCH] Update [ghstack-poisoned] --- backends/webgpu/test/op_tests/cases.py | 13 +++++++++++++ backends/webgpu/test/ops/test_minimum.py | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 backends/webgpu/test/ops/test_minimum.py diff --git a/backends/webgpu/test/op_tests/cases.py b/backends/webgpu/test/op_tests/cases.py index 182cd5afcaf..5b7f0381b2f 100644 --- a/backends/webgpu/test/op_tests/cases.py +++ b/backends/webgpu/test/op_tests/cases.py @@ -34,6 +34,7 @@ CatModule, CONFIGS as _CAT_CONFIGS, ) +from executorch.backends.webgpu.test.ops.test_minimum import MinimumModule from executorch.backends.webgpu.test.ops.test_mul import ( CONFIGS as _MUL_CONFIGS, MulModule, @@ -184,6 +185,18 @@ def _fn_config_suite(module_cls, configs) -> WebGPUTestSuite: ) +@register_op_test("minimum") +def _minimum_suite() -> WebGPUTestSuite: + # Same-shape numeric coverage (flat binary kernel; broadcast stays smoke). + return WebGPUTestSuite( + module_factory=lambda: MinimumModule(), + cases=[ + Case(name="2d", inputs=((M1, M2), (M1, M2))), + Case(name="3d", inputs=((S, S1, S2), (S, S1, S2))), + ], + ) + + @register_op_test("view_copy") def _view_copy_suite() -> WebGPUTestSuite: return _fn_config_suite(ViewModule, _VIEW_CONFIGS) diff --git a/backends/webgpu/test/ops/test_minimum.py b/backends/webgpu/test/ops/test_minimum.py new file mode 100644 index 00000000000..f8f8088fef5 --- /dev/null +++ b/backends/webgpu/test/ops/test_minimum.py @@ -0,0 +1,18 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +"""`aten.minimum.default` module for the WebGPU op-test framework. + +`MinimumModule` is imported by `cases.py`. minimum is a same-shape elementwise +binary op mirroring the landed `add`/`mul` pattern (flat 2D-dispatch kernel). +""" + +import torch + + +class MinimumModule(torch.nn.Module): + def forward(self, a: torch.Tensor, b: torch.Tensor) -> torch.Tensor: + return torch.minimum(a, b)