Skip to content

[GPU] Fix reshape in-place optimization with feature padding#33978

Open
zhanmyz wants to merge 1 commit intoopenvinotoolkit:masterfrom
zhanmyz:cvs-175476-object_detection-issue-v4
Open

[GPU] Fix reshape in-place optimization with feature padding#33978
zhanmyz wants to merge 1 commit intoopenvinotoolkit:masterfrom
zhanmyz:cvs-175476-object_detection-issue-v4

Conversation

@zhanmyz
Copy link
Contributor

@zhanmyz zhanmyz commented Feb 5, 2026

Details:

  • Fix batch inconsistency error in reshape layer when input tensor has feature dimension padding during in-place optimization.

Description of the issue(symptom, root-cause, how it was resolved)

  • Symptom: TF_Ssd_Inception_v2_coco model produces incorrect inference results for batch=2 at BoxPredictor_5/Reshape layer [2,24,1,1]→[2,6,1,4].

  • Root Cause:

    • BoxPredictor_5/Reshape receives input with feature dimension upper padding (upper_pad=[0,8,0,0]) from upstream convolution layer
    • The has_outer_padding_offset() function in reshape_inst.h only checks input_pad._lower_size[1] != 0 for feature dimension.
    • It misses the upper padding case (input_pad._upper_size[1] != 0), and returns true.
    • In-place optimization reinterprets memory buffer directly, causing reshape to read data from wrong memory offsets due to padding.
  • Resolution:

    • Modified reshape_inst.h::has_outer_padding_offset() to also check input_pad._upper_size[1] != 0.
    • Ensures feature dimension with any padding (lower or upper) prevents in-place optimization.

The code and line that caused this issue (if it is not changed directly)

// Expected a padded input of only batch axis with 'bxxx' format
if (input_layout.format.dims_order()[0] != 0 ||
input_pad._lower_size[1] != 0)
return false;

Reproduction step and snapshot (if applicable. Do not attach for customer model)

python -m pytest test_ovc_mo.py
-n 2
--tb=native
--env_conf=.automation/env_config.yml
--test_conf=.automation/test_configs/desktop_test_config_gpu_llm.yml
-m "not launch_only_if_manually_specified"
--pregen_irs=models/irs_mapping.csv
--tf_models_version=1.15.2
--modules pipelines/production/tf/light
-k "TF_Ssd_Inception_v2_coco_api_2_True"
--dynamism_type=None
--log-cli-level INFO

Problematic graph

image

Checklist

  • [v] Is it a proper fix? (not a workaround)
  • [v] Did you include test case for this fix, if necessary?
  • [v] Did you review existing test that can be extended to cover this scenario? Which test did you review?

Tickets:

  - Fix batch inconsistency error in reshape layer when input has feature upper padding
  - This occurs in BoxPredictor_5/Reshape [2,24,1,1]→[2,6,1,4] where input has upper_pad=[0,8,0,0]
  - Original has_outer_padding_offset() only checked lower padding of feature dimension, missing upper padding case
  - Modify has_outer_padding_offset() in reshape_inst.h to also check input_pad._upper_size[1] != 0
  - This prevents incorrect in-place optimization when feature dimension has any padding

  - *CVS-175476*

Signed-off-by: zhanmyz <yazhan.ma@intel.com>
@zhanmyz zhanmyz requested review from a team as code owners February 5, 2026 10:17
@zhanmyz zhanmyz added the category: GPU OpenVINO GPU plugin label Feb 5, 2026
@zhanmyz zhanmyz requested a review from wilson-seok February 5, 2026 10:17
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.

1 participant