Skip to content

Commit da7874c

Browse files
authored
[WebGPU] fix test failure in Reduce operators on macOS ARM64 (microsoft#24108)
### Description fix test failure in Reduce operators on macOS ARM64 ``` [E:onnxruntime:ReduceL1, sequential_executor.cc:572 ExecuteKernel] Non-zero status code returned while running ReduceL1 node. Name:'node1' Status Message: webgpu_context.cc:259 Run Uniform variable[0] (output_size) data type mismatch in program "ReduceL1", Expected: u32, Actual: i32 ```
1 parent 731b27e commit da7874c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

onnxruntime/core/providers/webgpu/reduction/reduction_ops.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,13 @@ Status ReduceKernel<allow_multi_axes>::ComputeInternal(ComputeContext& context)
191191
auto output = context.Output(0, input_tensor->Shape());
192192
// We need to run the operation even for scalar inputs for these ops
193193
const auto code = GetOpSpecificCode(input_tensor);
194+
constexpr uint32_t output_size = 1;
195+
constexpr uint32_t reduce_axes = 0;
194196
ReduceKernelProgram program(name_, keepdims_, noop_with_empty_axes_, input_axes, code, false);
195-
std::vector<uint32_t> reduce_axes = {0};
196197
program.AddInput({input_tensor, ProgramTensorMetadataDependency::TypeAndRank})
197198
.AddOutput({output, ProgramTensorMetadataDependency::TypeAndRank})
198199
.SetDispatchGroupSize(1)
199-
.AddUniformVariables({{1}, {static_cast<uint32_t>(noop_with_empty_axes_ ? 1 : 0)}, {reduce_axes}});
200+
.AddUniformVariables({{output_size}, {static_cast<uint32_t>(noop_with_empty_axes_ ? 1 : 0)}, {reduce_axes}});
200201
return context.RunProgram(program);
201202
} else {
202203
// For other ops, or when axes is empty with noop_with_empty_axes_ true, just copy the input

0 commit comments

Comments
 (0)