Skip to content

Commit 51b811e

Browse files
committed
Update (base update)
[ghstack-poisoned]
1 parent 94827b5 commit 51b811e

4 files changed

Lines changed: 14 additions & 12 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/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_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].

0 commit comments

Comments
 (0)