Repository navigation
Write output dims before the zero-batch early return - #11527
Open
anagnorisis2peripeteia wants to merge 1 commit into
Open
anagnorisis2peripeteia wants to merge 1 commit into
anagnorisis2peripeteia wants to merge 1 commit into
Conversation
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.
convolution, deconvolution, depth_to_space (nhwc + nchw2nhwc), and space_to_depth reshape returned success on batch_size == 0 without writing the output-dimension out-params, leaving stale values the subgraph writes into output shapes. Move each early return below the out-param writes; setup short-circuits on skip state so the extra computation is harmless. The depth_to_space raw input_height * block_size writes are replaced with guarded safe_mul versions. All five regression tests show stale SIZE_MAX without the fix and correct dims with it.
anagnorisis2peripeteia
force-pushed
the
fix-zero-batch-output-dims-conv-transpose
branch
from
October 7, 2026 15:28
7bd913c to
9f9745f
Compare
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.
Extends #11526 (pooling) to convolution, deconvolution, depth_to_space (both layouts), and space_to_depth: same stale out-param defect on the batch==0 path, proven with stale SIZE_MAX before and correct dims after in all five tests. Also replaces depth_to_space's raw dimension multiplies with guarded versions. 2408 tests pass, UBSan silent.