Skip to content
PR Quorum
Sign inStart free
← Review gallery
ggml-org/llama.cpp #25847openreviewed 6h ago

webgpu : add CONV_2D_DW (depthwise conv2d) kernel

by m1el+279 03 filesreviewed in 1m 41sView PR on GitHub
needs attentionThe panel surfaced issues that deserve attention before merge.1 finding · 1 high+

Reviewer panel

Correctness
deepseek/deepseek-v4-flash
1 found
Security
deepseek/deepseek-v4-flash
0 found
Architecture
deepseek/deepseek-v4-flash
errored

Findings

01Hhighconf 95%

Incorrect weight indexing in CWHN shader variant

ggml/src/ggml-webgpu/wgsl-shaders/conv2d_dw.wgsl:107

In the CWHN (contiguous-channels input) branch, the weight is indexed as params.offset_w + ky * knl_row + kx * params.channels + c. This assumes the weight is stored with channels innermost, but the weight tensor (src0) has shape [KW, KH, 1, C] and is stored in the standard contiguous (channel-major) layout: for each channel, all kernel elements are contiguous. The correct index should be params.offset_w + c * params.knl_h * params.knl_w + ky * params.knl_w + kx. The current indexing causes all reads to use wrong weight values, producing incorrect output for any CWHN input (i.e., when src1 is not contiguous but is contiguous-channels).

Suggested fix
let k = load_weight(params.offset_w + c * params.knl_h * params.knl_w + ky * params.knl_w + kx);
Want this on your own pull requests?
The same reviewer panel runs on every PR — one focused review, no noise.
Start freeLive demo