Skip to content

Commit aae1a11

Browse files
committed
Update (base update)
[ghstack-poisoned]
1 parent f3385d0 commit aae1a11

10 files changed

Lines changed: 22 additions & 28 deletions

File tree

backends/webgpu/runtime/ops/log_softmax/LogSoftmax.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ struct LogSoftmaxParams {
2929
uint32_t inner;
3030
uint32_t pad_;
3131
};
32-
static_assert(sizeof(LogSoftmaxParams) == 16, "LogSoftmaxParams must be 16 bytes");
32+
static_assert(
33+
sizeof(LogSoftmaxParams) == 16,
34+
"LogSoftmaxParams must be 16 bytes");
3335

3436
// Decompose dims into [outer, R, inner] for a reduction along `dim`.
3537
void decompose(
@@ -85,7 +87,8 @@ void log_softmax_impl(WebGPUGraph& graph, const std::vector<int>& args) {
8587
for (int64_t d : in.dims) {
8688
numel *= static_cast<uint64_t>(d);
8789
}
88-
if (in.nbytes != numel * sizeof(float) || out.nbytes != numel * sizeof(float)) {
90+
if (in.nbytes != numel * sizeof(float) ||
91+
out.nbytes != numel * sizeof(float)) {
8992
throw std::runtime_error(
9093
"WebGPU log_softmax: fp32-only (byte-size mismatch)");
9194
}
@@ -205,7 +208,9 @@ void log_softmax_impl(WebGPUGraph& graph, const std::vector<int>& args) {
205208
wgpuQueueWriteBuffer(g.queue(), params_buf, 0, &p, sizeof(p));
206209
g.dispatch_at(dispatch_idx).workgroup_count_x =
207210
utils::compute_1d_workgroup_count(
208-
g.device(), static_cast<uint32_t>(live_lines), wg_size,
211+
g.device(),
212+
static_cast<uint32_t>(live_lines),
213+
wg_size,
209214
"log_softmax(resize)");
210215
g.set_cur_dims(out_id, std::vector<int64_t>(d.begin(), d.end()));
211216
});

backends/webgpu/runtime/ops/reduce/Reduce.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ void reduce_impl(
227227
wgpuQueueWriteBuffer(g.queue(), params_buf, 0, &p, sizeof(p));
228228
g.dispatch_at(dispatch_idx).workgroup_count_x =
229229
utils::compute_1d_workgroup_count(
230-
g.device(), static_cast<uint32_t>(live_outputs), wg_size,
230+
g.device(),
231+
static_cast<uint32_t>(live_outputs),
232+
wg_size,
231233
"reduce(resize)");
232234
// Propagate reduced output dims for downstream resize hooks.
233235
int64_t nd = static_cast<int64_t>(d.size());

backends/webgpu/runtime/ops/softmax/Softmax.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ void softmax_impl(WebGPUGraph& graph, const std::vector<int>& args) {
173173

174174
// Dynamic shapes: recompute the decomposition for the reduced dim + dispatch.
175175
WGPUBuffer params_buf = uniform_buffer;
176-
const uint64_t build_numel =
177-
static_cast<uint64_t>(outer) * r * inner;
176+
const uint64_t build_numel = static_cast<uint64_t>(outer) * r * inner;
178177
graph.add_tensor_resize_hook(
179178
in_id,
180179
[in_id, out_id, dim, build_numel, wg_size, dispatch_idx, params_buf](
@@ -198,7 +197,9 @@ void softmax_impl(WebGPUGraph& graph, const std::vector<int>& args) {
198197
wgpuQueueWriteBuffer(g.queue(), params_buf, 0, &p, sizeof(p));
199198
g.dispatch_at(dispatch_idx).workgroup_count_x =
200199
utils::compute_1d_workgroup_count(
201-
g.device(), static_cast<uint32_t>(live_lines), wg_size,
200+
g.device(),
201+
static_cast<uint32_t>(live_lines),
202+
wg_size,
202203
"softmax(resize)");
203204
g.set_cur_dims(out_id, d);
204205
});

backends/webgpu/test/ops/test_bmm.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
import torch
2121

22-
from executorch.backends.vulkan.partitioner.vulkan_partitioner import (
23-
VulkanPartitioner,
24-
)
22+
from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
2523
from executorch.exir import to_edge_transform_and_lower
2624

2725
# name -> (shape_a [B, M, K], shape_b [B, K, N]). Output is [B, M, N].

backends/webgpu/test/ops/test_div.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121
import torch
2222

23-
from executorch.backends.vulkan.partitioner.vulkan_partitioner import (
24-
VulkanPartitioner,
25-
)
23+
from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
2624
from executorch.exir import to_edge_transform_and_lower
2725

2826
# name -> (shape_a, shape_b). Output shape is the broadcast of the two.

backends/webgpu/test/ops/test_linear.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
import torch
2121

22-
from executorch.backends.vulkan.partitioner.vulkan_partitioner import (
23-
VulkanPartitioner,
24-
)
22+
from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
2523
from executorch.exir import to_edge_transform_and_lower
2624

2725
# name -> (M, K, N). weight is [N, K]; output is [M, N].

backends/webgpu/test/ops/test_log_softmax.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121
import torch
2222

23-
from executorch.backends.vulkan.partitioner.vulkan_partitioner import (
24-
VulkanPartitioner,
25-
)
23+
from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
2624
from executorch.exir import to_edge_transform_and_lower
2725

2826

backends/webgpu/test/ops/test_reduce.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
import torch
2121

22-
from executorch.backends.vulkan.partitioner.vulkan_partitioner import (
23-
VulkanPartitioner,
24-
)
22+
from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
2523
from executorch.exir import to_edge_transform_and_lower
2624

2725

backends/webgpu/test/ops/test_softmax.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121

2222
import torch
2323

24-
from executorch.backends.vulkan.partitioner.vulkan_partitioner import (
25-
VulkanPartitioner,
26-
)
24+
from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
2725
from executorch.exir import to_edge_transform_and_lower
2826

2927
# name -> (shape, dim). dim=-1 => inner=1 (attention); a middle dim => inner>1.

backends/webgpu/test/ops/test_sub.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
import torch
2121

22-
from executorch.backends.vulkan.partitioner.vulkan_partitioner import (
23-
VulkanPartitioner,
24-
)
22+
from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
2523
from executorch.exir import to_edge_transform_and_lower
2624

2725

0 commit comments

Comments
 (0)