Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backends/webgpu/runtime/WebGPUShaderRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <executorch/backends/webgpu/runtime/ops/adamw/adamw_step_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/add/binary_add_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/addmm/addmm_tiled_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/amax/amax_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/amin/amin_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/argmax/arg_reduce_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/avg_pool2d/avg_pool2d_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/batch_norm/batch_norm_wgsl.h>
Expand Down Expand Up @@ -48,6 +46,8 @@
#include <executorch/backends/webgpu/runtime/ops/et_vk_sdpa/et_vk_sdpa_qk_entry_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/et_vk_sdpa/et_vk_sdpa_qk_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/expand_copy/expand_copy_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/extrema/amax_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/extrema/amin_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/fill/fill_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/flip/flip_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/floor_divide/binary_floor_divide_wgsl.h>
Expand Down
2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/amax/Reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <executorch/backends/webgpu/runtime/WebGPUGraph.h>
#include <executorch/backends/webgpu/runtime/WebGPUUtils.h>
#include <executorch/backends/webgpu/runtime/ops/OperatorRegistry.h>
#include <executorch/backends/webgpu/runtime/ops/amax/amax_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/extrema/amax_wgsl.h>

#include <webgpu/webgpu.h>

Expand Down
2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/amin/Reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <executorch/backends/webgpu/runtime/WebGPUGraph.h>
#include <executorch/backends/webgpu/runtime/WebGPUUtils.h>
#include <executorch/backends/webgpu/runtime/ops/OperatorRegistry.h>
#include <executorch/backends/webgpu/runtime/ops/amin/amin_wgsl.h>
#include <executorch/backends/webgpu/runtime/ops/extrema/amin_wgsl.h>

#include <webgpu/webgpu.h>

Expand Down
49 changes: 0 additions & 49 deletions backends/webgpu/runtime/ops/amin/amin.wgsl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from amax.wgsl - DO NOT EDIT.
// @generated from extrema.wgsl - DO NOT EDIT.
// wgsl-sha256: 35fc059d7c72caa17f9cb1128823ecfd8f75be4ce24b6cd4f9629a97b52f64c0
inline constexpr const char* kAmaxWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from amin.wgsl - DO NOT EDIT.
// @generated from extrema.wgsl - DO NOT EDIT.
// wgsl-sha256: 8cb6035ae4d34eb2a6cc973d93d9847905722e967239c96033fccfe3a1943cb2
inline constexpr const char* kAminWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn main(
var acc = input[base];
var i = lid.x;
while (i < params.reduce_size) {
acc = max(acc, input[base + i]);
acc = ${REDUCE_FN}(acc, input[base + i]);
i = i + wg_size;
}
partials[lid.x] = acc;
Expand All @@ -42,7 +42,7 @@ fn main(
if (lid.x == 0u) {
var m = partials[0];
for (var t = 1u; t < wg_size; t = t + 1u) {
m = max(m, partials[t]);
m = ${REDUCE_FN}(m, partials[t]);
}
output[row] = m;
}
Expand Down
13 changes: 13 additions & 0 deletions backends/webgpu/runtime/ops/extrema/extrema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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.

extrema:
parameter_names_with_default_values:
REDUCE_FN: max
shader_variants:
- NAME: amax
- NAME: amin
REDUCE_FN: min
21 changes: 0 additions & 21 deletions backends/webgpu/runtime/ops/unary/abs.wgsl

This file was deleted.

2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/unary/abs_wgsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from abs.wgsl - DO NOT EDIT.
// @generated from unary.wgsl - DO NOT EDIT.
// wgsl-sha256: 39d3c163fdf6a92286828f4b3217e00294e3ca5634a878ed5fd34e3b1cdf0a27
inline constexpr const char* kAbsWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
21 changes: 0 additions & 21 deletions backends/webgpu/runtime/ops/unary/cos.wgsl

This file was deleted.

2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/unary/cos_wgsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from cos.wgsl - DO NOT EDIT.
// @generated from unary.wgsl - DO NOT EDIT.
// wgsl-sha256: 9df78873e5fae98d347c26db2a02b047ea3d5d2c93f0761cb9ac6995f9a71ab2
inline constexpr const char* kCosWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/unary/exp_wgsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from exp.wgsl - DO NOT EDIT.
// @generated from unary.wgsl - DO NOT EDIT.
// wgsl-sha256: 3171399bc36acf9c1cb2a03c2a31038318203c4c63ab03c4881df7a660346020
inline constexpr const char* kExpWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
21 changes: 0 additions & 21 deletions backends/webgpu/runtime/ops/unary/hardswish.wgsl

This file was deleted.

2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/unary/hardswish_wgsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from hardswish.wgsl - DO NOT EDIT.
// @generated from unary.wgsl - DO NOT EDIT.
// wgsl-sha256: c874a15ef6cdaec71187296016cc2a1515f5e7c889b97dfa8fd4b278e6e2c3d5
inline constexpr const char* kHardswishWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
21 changes: 0 additions & 21 deletions backends/webgpu/runtime/ops/unary/neg.wgsl

This file was deleted.

2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/unary/neg_wgsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from neg.wgsl - DO NOT EDIT.
// @generated from unary.wgsl - DO NOT EDIT.
// wgsl-sha256: 8851b9f42d14153f6f04484fee2f8bf67bda26dea892ff48768e09e6ad49cee1
inline constexpr const char* kNegWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
21 changes: 0 additions & 21 deletions backends/webgpu/runtime/ops/unary/round.wgsl

This file was deleted.

2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/unary/round_wgsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from round.wgsl - DO NOT EDIT.
// @generated from unary.wgsl - DO NOT EDIT.
// wgsl-sha256: 8f3e0edbeb81aa50f35e691c78554e8057fa8d78fe8a86454f4f42e5e8871452
inline constexpr const char* kRoundWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
21 changes: 0 additions & 21 deletions backends/webgpu/runtime/ops/unary/rsqrt.wgsl

This file was deleted.

2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/unary/rsqrt_wgsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from rsqrt.wgsl - DO NOT EDIT.
// @generated from unary.wgsl - DO NOT EDIT.
// wgsl-sha256: 108765d5a23b87473f34651875d08abf2a5fa8980bd92fc8cbe3617295097747
inline constexpr const char* kRsqrtWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
21 changes: 0 additions & 21 deletions backends/webgpu/runtime/ops/unary/sin.wgsl

This file was deleted.

2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/unary/sin_wgsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from sin.wgsl - DO NOT EDIT.
// @generated from unary.wgsl - DO NOT EDIT.
// wgsl-sha256: e5762804773659d348fddddcef4935807ae6fe7d92c92eb17a2f44aae8f2c5b9
inline constexpr const char* kSinWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
21 changes: 0 additions & 21 deletions backends/webgpu/runtime/ops/unary/sqrt.wgsl

This file was deleted.

2 changes: 1 addition & 1 deletion backends/webgpu/runtime/ops/unary/sqrt_wgsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace executorch::backends::webgpu {

// @generated from sqrt.wgsl - DO NOT EDIT.
// @generated from unary.wgsl - DO NOT EDIT.
// wgsl-sha256: 008534ae365969f5c180b42e8d6d0b131df78f181e5435abbcafc3ffb8be8aac
inline constexpr const char* kSqrtWGSL = R"(
@group(0) @binding(0) var<storage, read> input: array<f32>;
Expand Down
Loading
Loading