Skip to content

Update size each time to ensure correct data copy in If node#34971

Open
mangguo321 wants to merge 2 commits intoopenvinotoolkit:masterfrom
mangguo321:mang/if_node_fix
Open

Update size each time to ensure correct data copy in If node#34971
mangguo321 wants to merge 2 commits intoopenvinotoolkit:masterfrom
mangguo321:mang/if_node_fix

Conversation

@mangguo321
Copy link
Copy Markdown
Contributor

Details:

  • PortMapHelper initializes the size to 0 during construction and refresh it only inside redefineTo at execution time. However, when the runtime shape is static, redefineTo may be skipped, leaving the size at 0 and causing cpu_convert to use an incorrect element count.
  • This PR updates the size from srcMemPtr shape on every redefineTo call, ensure that cpu_convert always receives the correct size

Tickets:

@mangguo321 mangguo321 requested review from a team as code owners March 27, 2026 01:30
@github-actions github-actions bot added the category: CPU OpenVINO CPU plugin label Mar 27, 2026
@yuxu42 yuxu42 requested a review from Copilot March 27, 2026 02:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an element-count bookkeeping issue in the Intel CPU plugin If node port mapping, ensuring cpu_convert copies/converts the correct number of elements even when the shape stays static at runtime.

Changes:

  • Update If::PortMapHelper::redefineTo() to refresh size on every call (not only when output memory descriptors are redefined).

Comment on lines 70 to 72
}
size = srcMemPtr->getShape().getElementsCount();
}
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

[HIGH] This is a behavioral bug fix in the If port mapping/data-copy path, but the PR doesn't add a regression test to ensure the element-count passed to cpu_convert is non-zero/accurate when the source memory descriptor is undefined at PortMapHelper construction and the runtime shape is static (the scenario described in the PR). Please add a targeted CPU functional/unit test that reproduces the prior failure (e.g., static runtime shape + required copy/convert between If external/internal memories) to prevent regressions.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@mangguo321 mangguo321 requested review from a team as code owners March 27, 2026 07:39
@github-actions github-actions bot added the category: IE Tests OpenVINO Test: plugins and common label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: CPU OpenVINO CPU plugin category: IE Tests OpenVINO Test: plugins and common

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants