Repository navigation
Write workspace_size on zero-batch early return in convolution reshape - #11530
Open
anagnorisis2peripeteia wants to merge 1 commit into
Open
anagnorisis2peripeteia wants to merge 1 commit into
anagnorisis2peripeteia wants to merge 1 commit into
Conversation
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.
This was referenced Oct 3, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.