webonnx / wonnx

A WebGPU-accelerated ONNX inference run-time written 100% in Rust, ready for native and the web
Other
1.61k stars 59 forks source link

Fix grouped convolutions with 3x3 kernels #157

Closed SludgePhD closed 1 year ago

SludgePhD commented 1 year ago

Followup to https://github.com/webonnx/wonnx/pull/124, fixes the remaining bug.

The bug was caused by the 3x3 convolution optimization triggering for grouped convolutions, which adds padding to the kernel in preparation for conv_kernel_3x3.wgsl, but grouped convolutions aren't using that shader, so the default conv shader ended up using the wrong kernel data.

Also includes a fix for the out-of-bounds access check (testing that a u32 is < 0 never fails, it has to be done with an i32). This wasn't causing any issues as far as I can tell though.

pixelspark commented 1 year ago

Great work! :+1: merged