Skip to content

[GPU] Restrict memory reuse to layout-compatible buffers for oneDNN#33967

Merged
e-ddykim merged 7 commits intoopenvinotoolkit:masterfrom
davidsnam-intel:david/fix-memory-reuse-for-onednn
Feb 6, 2026
Merged

[GPU] Restrict memory reuse to layout-compatible buffers for oneDNN#33967
e-ddykim merged 7 commits intoopenvinotoolkit:masterfrom
davidsnam-intel:david/fix-memory-reuse-for-onednn

Conversation

@davidsnam-intel
Copy link
Contributor

@davidsnam-intel davidsnam-intel commented Feb 4, 2026

Issue:

  • During GPU execution with oneDNN convolution in blocked layouts (e.g. fsv16), NaNs may appear in the output when the input feature dimension is not a multiple of the block size (typically 16) and memory reuse is enabled.
  • The issue does not reproduce when memory pooling/reuse is disabled or when ocl impl for convolution is used instead of oneDNN.

Root cause:

  • oneDNN primitives assume that inputs in blocked layouts are properly zero-padded in the feature tail lanes when the feature dimension is not aligned to the block size.
  • However, when memory reuse is enabled, an input buffer produced by a previous primitive may contain non-zero garbage values in the feature tail lanes.
  • Because oneDNN convolution reads these tail lanes implicitly, unexpected values can propagate into computation and result in NaNs.

How to fix:

  • For oneDNN primitives with blocked layouts, memory reuse is restricted to buffers with layout-compatible feature dimensions.
  • When the feature dimension is not aligned to the block size (e.g. not a multiple of 16 for fsv16), memory reuse is allowed only if the source and candidate buffers have matching feature sizes.
  • This preserves memory reuse for compatible layouts while preventing unsafe reuse that can corrupt channel tail data

Graphs:

image

Tickets:

@davidsnam-intel davidsnam-intel requested review from a team as code owners February 4, 2026 11:17
@github-actions github-actions bot added the category: GPU OpenVINO GPU plugin label Feb 4, 2026
@davidsnam-intel davidsnam-intel changed the title [GPU] Forbid memory reuse for unaligned blocked oneDNN inputs [GPU] Restrict memory reuse to layout-compatible buffers for oneDNN Feb 5, 2026
@davidsnam-intel davidsnam-intel force-pushed the david/fix-memory-reuse-for-onednn branch from cf4241b to bec9d75 Compare February 5, 2026 19:11
Copy link
Contributor

@e-ddykim e-ddykim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good to me

@e-ddykim e-ddykim enabled auto-merge February 6, 2026 03:25
@e-ddykim e-ddykim added this pull request to the merge queue Feb 6, 2026
Merged via the queue into openvinotoolkit:master with commit 6fe0e5d Feb 6, 2026
195 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: GPU OpenVINO GPU plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants