Skip to content

[CPU][DEBUG CAPS] Fix failure on models with dynamic type constant nodes#34000

Merged
aobolensk merged 5 commits intoopenvinotoolkit:masterfrom
aobolensk:cpu-debug-dump-fix
Feb 18, 2026
Merged

[CPU][DEBUG CAPS] Fix failure on models with dynamic type constant nodes#34000
aobolensk merged 5 commits intoopenvinotoolkit:masterfrom
aobolensk:cpu-debug-dump-fix

Conversation

@aobolensk
Copy link
Contributor

Tickets:

  • N/A

@aobolensk aobolensk requested review from a team as code owners February 6, 2026 14:22
@github-actions github-actions bot added the category: CPU OpenVINO CPU plugin label Feb 6, 2026
@aobolensk aobolensk requested a review from a team as a code owner February 11, 2026 15:31
@aobolensk aobolensk changed the title [CPU][DEBUG CAPS] Fix failure on models with dynamic type constant nodes Fix ValuesToString failure on models with dynamic type constants Feb 11, 2026
@github-actions github-actions bot added category: Core OpenVINO Core (aka ngraph) and removed category: CPU OpenVINO CPU plugin labels Feb 11, 2026
@aobolensk aobolensk removed request for a team February 11, 2026 15:31

template <ov::element::Type_t ET, typename std::enable_if<ET == element::dynamic>::type* = nullptr>
static result_type visit(const void* const ptr, const size_t index) {
return "";
Copy link
Contributor

Choose a reason for hiding this comment

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

what about result_type{} or {}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, done

}

template <ov::element::Type_t ET, typename std::enable_if<ET == element::dynamic>::type* = nullptr>
static result_type visit(const void* const ptr, const size_t num_elements, std::vector<std::string>& strs) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

the variable names can be removed or [[maybe_unused]]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed variable names

Copy link
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 ValuesToString / ValueToString failures when encountering ov::element::dynamic constants by adding dynamic-type handling to the visitor dispatch.

Changes:

  • Adds element::dynamic overloads for ValueToString and ValuesToString.
  • Expands IfTypeOf dispatch to include dynamic so dynamic constants don’t route to unsupported behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +375 to +382
static result_type visit(const void* const ptr, const size_t index) {
return element::iterator<ET>(ptr)[index];
}

template <ov::element::Type_t ET, typename std::enable_if<ET == element::dynamic>::type* = nullptr>
static result_type visit(const void* const ptr, const size_t index) {
return {};
}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

For ET == element::dynamic, both visit templates are viable (the unconstrained template also matches), which can lead to an ambiguous overload or still instantiate element::iterator<ET> for dynamic. Constrain the non-dynamic overload (e.g., ET != element::dynamic) or merge into a single template using if constexpr to avoid compiling the iterator path for dynamic.

Copilot uses AI. Check for mistakes.
}

template <ov::element::Type_t ET, typename std::enable_if<ET == element::dynamic>::type* = nullptr>
static result_type visit(const void* const ptr, const size_t num_elements, std::vector<std::string>& strs) {}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The dynamic overload leaves strs unchanged, so get_value_strings() can return an empty vector even when shape_size(m_shape) is non-zero. This creates inconsistent behavior vs. other element types (which always append num_elements entries). Consider appending/resizing strs with num_elements placeholder strings (e.g., empty strings) so the output cardinality remains consistent.

Suggested change
static result_type visit(const void* const ptr, const size_t num_elements, std::vector<std::string>& strs) {}
static result_type visit(const void* const /*ptr*/,
const size_t num_elements,
std::vector<std::string>& strs) {
// For dynamic element type, we cannot obtain concrete values, but we still
// need to keep the output cardinality consistent with num_elements.
// Append num_elements placeholder (empty) strings.
strs.insert(strs.end(), num_elements, std::string{});
}

Copilot uses AI. Check for mistakes.
}

template <ov::element::Type_t ET, typename std::enable_if<ET == element::dynamic>::type* = nullptr>
static result_type visit(const void* const ptr, const size_t num_elements, std::vector<std::string>& strs) {}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

This empty-body overload will typically trigger unused-parameter warnings for ptr, num_elements, and strs. To keep builds warning-clean, either omit parameter names in the signature or explicitly mark them unused (e.g., (void)ptr;).

Suggested change
static result_type visit(const void* const ptr, const size_t num_elements, std::vector<std::string>& strs) {}
static result_type visit(const void* const ptr, const size_t num_elements, std::vector<std::string>& strs) {
(void)ptr;
(void)num_elements;
(void)strs;
}

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed variable names instead

@praasz praasz added the pr: needs tests PR needs tests updating label Feb 13, 2026
return element::iterator<ET>(ptr)[index];
}

template <ov::element::Type_t ET, typename std::enable_if<ET == element::dynamic>::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.

Can you add test?
The constant cannot be created with dynamic type the could should be not required at all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The constant cannot be created with dynamic type the could should be not required at all

Actually we can and they are used. CPU plugin uses dynanic type constants with 0 shape
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is IR after CPU specific transformations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@praasz added tests

Copy link
Contributor

Choose a reason for hiding this comment

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

The dynamic type mean no data so still member which access data should throw as incorrect use.
The public IR shouldn't have such constant it looks like it has to be handled by CPU.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted core changes and re-apply previous CPU-only solution

@aobolensk aobolensk requested a review from praasz February 13, 2026 10:30
std::vector<std::string> out;
using namespace ov::element;
IfTypeOf<SUPPORTED_ET, string>::apply<ValuesToString>(get_element_type(), get_data_ptr(), shape_size(m_shape), out);
IfTypeOf<SUPPORTED_ET, dynamic, string>::apply<ValuesToString>(get_element_type(),
Copy link
Contributor

Choose a reason for hiding this comment

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

The dynamic has to be remove, there still should be an exception

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@EgorDuplensky shall we switch to the previous CPU-only related fix?

return element::iterator<ET>(ptr)[index];
}

template <ov::element::Type_t ET, typename std::enable_if<ET == element::dynamic>::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.

The dynamic type mean no data so still member which access data should throw as incorrect use.
The public IR shouldn't have such constant it looks like it has to be handled by CPU.

@github-actions github-actions bot added category: CPU OpenVINO CPU plugin and removed category: Core OpenVINO Core (aka ngraph) labels Feb 17, 2026
@aobolensk aobolensk changed the title Fix ValuesToString failure on models with dynamic type constants [CPU][DEBUG CAPS] Fix failure on models with dynamic type constant nodes Feb 17, 2026
@aobolensk aobolensk requested a review from praasz February 17, 2026 08:18
Comment on lines +567 to +570
for (const auto& v : constop->get_value_strings()) {
os << sep << v;
sep = ",";
}
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
for (const auto& v : constop->get_value_strings()) {
os << sep << v;
sep = ",";
}
os << ov::util::join(constop->get_value_strings(), ",");

Optional, or use default separator ", "?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied, thanks

@praasz praasz removed the pr: needs tests PR needs tests updating label Feb 18, 2026
@praasz praasz added this to the 2026.1 milestone Feb 18, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 18, 2026
### Details:
Filling the testing gap for `dynamic` type constants observed in
#34000

### Tickets:
 - N/A
@aobolensk aobolensk enabled auto-merge February 18, 2026 18:00
@aobolensk aobolensk added this pull request to the merge queue Feb 18, 2026
Naseer-010 pushed a commit to Naseer-010/openvino that referenced this pull request Feb 18, 2026
### Details:
Filling the testing gap for `dynamic` type constants observed in
openvinotoolkit#34000

### Tickets:
 - N/A
Merged via the queue into openvinotoolkit:master with commit b817324 Feb 18, 2026
261 of 271 checks passed
@aobolensk aobolensk deleted the cpu-debug-dump-fix branch February 18, 2026 20:17
wilson-seok pushed a commit to wilson-seok/openvino that referenced this pull request Feb 19, 2026
### Details:
Filling the testing gap for `dynamic` type constants observed in
openvinotoolkit#34000

### Tickets:
 - N/A
wilson-seok pushed a commit to wilson-seok/openvino that referenced this pull request Feb 19, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants