Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend CPU Plugin with SegmentMax-16 reference implementation #28979

Open
wants to merge 47 commits into
base: master
Choose a base branch
from

Conversation

p-wysocki
Copy link
Contributor

@p-wysocki p-wysocki commented Feb 13, 2025

p-wysocki and others added 30 commits January 27, 2025 15:08
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
Signed-off-by: p-wysocki <[email protected]>
…max_shape_inference_test.cpp

Co-authored-by: Pawel Raasz <[email protected]>
@p-wysocki p-wysocki requested review from a team as code owners February 13, 2025 15:34
@github-actions github-actions bot added category: Core OpenVINO Core (aka ngraph) category: IE Tests OpenVINO Test: plugins and common category: CPU OpenVINO CPU plugin category: TEMPLATE OpenVINO Template plugin category: CPP API OpenVINO CPP API bindings labels Feb 13, 2025
Copy link
Contributor

@t-jankowski t-jankowski left a comment

Choose a reason for hiding this comment

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

Ok for src/core/reference part.


template <typename T,
typename T_idx,
typename std::enable_if<std::is_same<typename std::decay<T_idx>::type, int64_t>::value>::type* = nullptr>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
typename std::enable_if<std::is_same<typename std::decay<T_idx>::type, int64_t>::value>::type* = nullptr>
typename std::enable_if_t<std::is_same_v<typename std::decay_t<T_idx>, int64_t>>* = nullptr>


template <typename T,
typename T_idx,
typename std::enable_if<!std::is_same<typename std::decay<T_idx>::type, int64_t>::value>::type* = nullptr>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
typename std::enable_if<!std::is_same<typename std::decay<T_idx>::type, int64_t>::value>::type* = nullptr>
typename std::enable_if_t<!std::is_same_v<typename std::decay_t<T_idx>, int64_t>>* = nullptr>

github-merge-queue bot pushed a commit that referenced this pull request Feb 17, 2025
### Details:
 - Add reference implementation
 - Add tests

### Related PRs:
 - #28103
 - #28698
 - #28979
 - #28999

### Tickets:
 - CVS-158917

---------

Signed-off-by: p-wysocki <[email protected]>
Co-authored-by: Roman Kazantsev <[email protected]>
Co-authored-by: Pawel Raasz <[email protected]>
Co-authored-by: Katarzyna Mitrus <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Feb 18, 2025
### Details:
- The original PR
(#28788) has been
mistakenly force-merged due to a mistake in merge queue settings. It was
later reverted, so this is the "new" Ref PR.
 - Add reference implementation
 - Add tests

### Related PRs:
 - #28103
 - #28698
 - #28979
 - #28999

### Tickets:
 - CVS-158917

---------

Signed-off-by: p-wysocki <[email protected]>
Co-authored-by: Roman Kazantsev <[email protected]>
Co-authored-by: Pawel Raasz <[email protected]>
Co-authored-by: Katarzyna Mitrus <[email protected]>
@github-actions github-actions bot removed category: Core OpenVINO Core (aka ngraph) category: IE Tests OpenVINO Test: plugins and common category: TEMPLATE OpenVINO Template plugin category: CPP API OpenVINO CPP API bindings labels Feb 19, 2025
Comment on lines +96 to +98
if (useNumSegments) {
auto numSegments = std::make_shared<ov::op::v0::Constant>(segmentIdsPrecision, ov::Shape{}, numSegmentsValue);
segmentMax = std::make_shared<ov::op::v16::SegmentMax>(dataParameter, segmentIdsConst, numSegments, fillMode);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can a scenario with numSegments as Parameter be tested as well?

Comment on lines +106 to +110
OV_CASE2(ov::element::f32, ov::element::i64, float, int64_t),
OV_CASE2(ov::element::f16, ov::element::i32, ov::float16, int32_t),
OV_CASE2(ov::element::f16, ov::element::i64, ov::float16, int64_t),
OV_CASE2(ov::element::bf16, ov::element::i32, ov::bfloat16, int32_t),
OV_CASE2(ov::element::bf16, ov::element::i64, ov::bfloat16, int64_t),
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK i64 is converted by CPU plugin to i32, could you please verify that cases for i64 are correctly executed here?

template <class T, class T_idx>
void SegmentMax::executeImpl() {
const auto& data_shape = getSrcMemoryAtPort(0)->getStaticDims();
const auto& output_shape = getDstMemoryAtPort(0)->getShape().getStaticDims();
Copy link
Contributor

Choose a reason for hiding this comment

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

As output shape can be related to the num_segments input (if provided). Consider implementation of some additional logic and override the "needShapeInfer()" from CPU Node class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: CPU OpenVINO CPU plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants