Skip to content

Write workspace_size on zero-batch early return in convolution reshape - #11530

Open
anagnorisis2peripeteia wants to merge 1 commit into
google:masterfrom
anagnorisis2peripeteia:fix-conv-deconv-zero-batch-workspace
Open

anagnorisis2peripeteia wants to merge 1 commit into
google:masterfrom
anagnorisis2peripeteia:fix-conv-deconv-zero-batch-workspace

Conversation

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor

reshape_convolution2d_nhwc returned success on batch_size==0 without writing *workspace_size.

Before: zero_batch_workspace fails with workspace_size=SIZE_MAX (18446744073709551615), expected 0.
After: passes, workspace_size==0.

Matches the pattern fixed for bmm/fc/pack-lh/reduce-nd/resize-bilinear. Complements #11527 which fixed output dims on the same path but left workspace untouched. Deconvolution f32 public API passes workspace=NULL internally, so only convolution is reachable here; pqs8 deconv path left for follow-up.

reshape_convolution2d_nhwc returned success on batch_size==0 without
writing *workspace_size, leaving caller memory uninitialized. Follows
the same pattern fixed for batch-matmul, fully-connected, pack-lh,
reduce-nd, and resize-bilinear. Complements google#11527 which fixed output
dims on the same path but left workspace untouched.
anagnorisis2peripeteia added a commit to anagnorisis2peripeteia/XNNPACK that referenced this pull request Oct 7, 2026
reshape_deconvolution2d_nhwc returns at batch_size == 0 before
reshape_igemm_path, which is the only writer of *workspace_size. The
pqs8_qs8_qc8w variant is the only deconvolution type that passes a
non-NULL workspace_size (src/subgraph/deconvolution-2d.c:491), so its
caller reads an unwritten value; src/subgraph/deconvolution-2d.c:519
then compares that against old_workspace_size to decide on
reallocation.

Same defect and fix as google#11530, on the deconvolution side. Distinct from
google#11527: that PR moves the early return past the output-dim writes, but
still before the workspace write, so it does not cover this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant