OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[core] Improve concat evaluate and reference implementation (#38357)
Pawel Raaszabd9360076af
diff --git a/src/core/reference/include/openvino/reference/concat.hpp b/src/core/reference/include/openvino/reference/concat.hppindex 815da3488a9..28fcbcf2740 100644--- a/src/core/reference/include/openvino/reference/concat.hpp+++ b/src/core/reference/include/openvino/reference/concat.hpp@@ -4,20 +4,28 @@#pragma once+#include <cstdint>+#include <string>#include <vector>#include "openvino/core/shape.hpp"-#include "openvino/core/type/element_type.hpp"namespace ov {namespace reference {+/// \brief Concatenates string data.+void concat(const std::vector<const std::string*>& args,+ std::string* out,+ const std::vector<Shape>& in_shapes,+ const Shape& out_shape,+ int64_t concatenation_axis);++/// \brief Concatenates non-string data given its bitwidth (byte-aligned or sub-byte packed).void concat(const std::vector<const char*>& args,char* out,const std::vector<Shape>& in_shapes,const Shape& out_shape,int64_t concatenation_axis,- size_t elem_size,- const ov::element::Type& elem_type = ov::element::Type_t::dynamic);+ size_t bitwidth);} // namespace reference} // namespace ovdiff --git a/src/core/reference/include/openvino/reference/scaled_dot_product_attention.hpp b/src/core/reference/include/openvino/reference/scaled_dot_product_attention.hppindex b00c1f94cfa..cba41f36c8c 100644--- a/src/core/reference/include/openvino/reference/scaled_dot_product_attention.hpp+++ b/src/core/reference/include/openvino/reference/scaled_dot_product_attention.hpp@@ -152,7 +152,7 @@ void scaled_dot_product_attention(const T* query,{qk_shape, target_sink_shape},gk_softmax_shape,qk_shape.size() - 1,- sizeof(T));+ sizeof(T) * 8);qk_data = std::move(qk_data_with_sink);}std::vector<T> qk_data_softmax(qk_data.size(), 0);diff --git a/src/core/reference/include/openvino/reference/sequences.hpp b/src/core/reference/include/openvino/reference/sequences.hppindex 77f78e4b345..c6ab2ec48c3 100644--- a/src/core/reference/include/openvino/reference/sequences.hpp+++ b/src/core/reference/include/openvino/reference/sequences.hpp@@ -253,7 +253,7 @@ void cell_pass(CellType type,for (size_t i = 0; i < num_splits; ++i)to_concat_pointers[i] = h_list[i].data();- reference::concat(to_concat_pointers, outputs[0], in_shapes, out_shape, 1, sizeof(T));+ reference::concat(to_concat_pointers, outputs[0], in_shapes, out_shape, 1, sizeof(T) * 8);if (is_reverse) // enable_mask{@@ -364,19 +364,20 @@ void lstm_sequence(const char* X,Shape output_shape_y{H_shape[0], 2, X_shape[1], H_shape[2]};Shape output_shape_h_c{H_shape[0], 2, H_shape[2]};- reference::concat({forward_res_y.data(), reverse_res_y.data()}, Y, in_shapes_y, output_shape_y, 1, sizeof(T));+ constexpr auto bitwidth = sizeof(T) * 8;+ reference::concat({forward_res_y.data(), reverse_res_y.data()}, Y, in_shapes_y, output_shape_y, 1, bitwidth);reference::concat({forward_res[0].data(), reverse_res[0].data()},Ho,in_shapes_h_c,output_shape_h_c,1,- sizeof(T));+ bitwidth);reference::concat({forward_res[1].data(), reverse_res[1].data()},Co,in_shapes_h_c,output_shape_h_c,1,- sizeof(T));+ bitwidth);}}@@ -480,8 +481,9 @@ void gru_sequence(const char* X,Shape output_shape_y{H_shape[0], 2, X_shape[1], H_shape[2]};Shape output_shape_h{H_shape[0], 2, H_shape[2]};- reference::concat({forward_res_y.data(), reverse_res_y.data()}, Y, in_shapes_y, output_shape_y, 1, sizeof(T));- reference::concat({forward_res_h.data(), reverse_res_h.data()}, Ho, in_shapes_h, output_shape_h, 1, sizeof(T));+ constexpr auto bitwidth = sizeof(T) * 8;+ reference::concat({forward_res_y.data(), reverse_res_y.data()}, Y, in_shapes_y, output_shape_y, 1, bitwidth);+ reference::concat({forward_res_h.data(), reverse_res_h.data()}, Ho, in_shapes_h, output_shape_h, 1, bitwidth);}}@@ -568,8 +570,9 @@ void rnn_sequence(const char* X,Shape output_shape_y{H_shape[0], 2, X_shape[1], H_shape[2]};Shape output_shape_h{H_shape[0], 2, H_shape[2]};- reference::concat({forward_res_y.data(), reverse_res_y.data()}, Y, in_shapes_y, output_shape_y, 1, sizeof(T));- reference::concat({forward_res_h.data(), reverse_res_h.data()}, Ho, in_shapes_h, output_shape_h, 1, sizeof(T));+ constexpr auto bitwidth = sizeof(T) * 8;+ reference::concat({forward_res_y.data(), reverse_res_y.data()}, Y, in_shapes_y, output_shape_y, 1, bitwidth);+ reference::concat({forward_res_h.data(), reverse_res_h.data()}, Ho, in_shapes_h, output_shape_h, 1, bitwidth);}}} // namespace referencediff --git a/src/core/reference/src/op/concat.cpp b/src/core/reference/src/op/concat.cppindex 5124c33734e..883655d247d 100644--- a/src/core/reference/src/op/concat.cpp+++ b/src/core/reference/src/op/concat.cpp@@ -6,63 +6,75 @@#include <cstring>-namespace ov {-namespace reference {+namespace ov::reference {namespace {std::vector<size_t> calculate_shape_sizes(const std::vector<Shape>& in_shapes) {std::vector<size_t> sizes;sizes.reserve(in_shapes.size());- std::transform(begin(in_shapes), end(in_shapes), std::back_inserter(sizes), [](const Shape& shape) {+ std::transform(begin(in_shapes), end(in_shapes), std::back_inserter(sizes), [](auto&& shape) {return shape_size(shape);});return sizes;}-void copy_elements(const char* arg,- char* out,- size_t in_offset,- size_t out_offset,- size_t num_of_elements,- size_t elem_size) {- std::memcpy(out + (out_offset * elem_size), arg + (in_offset * elem_size), num_of_elements * elem_size);+// Per-input byte size = op(total_elements / steps), shared by all concat() overloads below.+template <class UnaryOp>+std::vector<size_t> calculate_sizes(const std::vector<Shape>& in_shapes, size_t steps, UnaryOp op) {+ auto sizes = calculate_shape_sizes(in_shapes);+ std::transform(sizes.begin(), sizes.end(), sizes.begin(), [steps, op](size_t total) {+ return op(total / steps);+ });+ return sizes;}+} // namespace++void concat(const std::vector<const std::string*>& args,+ std::string* out,+ const std::vector<Shape>& in_shapes,+ const Shape& out_shape,+ int64_t concatenation_axis) {+ const auto steps = shape_size(out_shape.begin(), out_shape.begin() + concatenation_axis);+ if (steps == 0) {+ return;+ }+ const auto sizes = calculate_sizes(in_shapes, steps, [](auto&& count) {+ return count;+ });-void copy_string_elements(const char* arg,- char* out,- size_t in_offset,- size_t out_offset,- size_t num_of_elements,- size_t) {- const auto src_begin = std::next(reinterpret_cast<const std::string*>(arg), in_offset);- const auto out_ptr = std::next(reinterpret_cast<std::string*>(out), out_offset);- std::copy_n(src_begin, num_of_elements, out_ptr);+ for (size_t step = 0; step < steps; ++step) {+ for (size_t in_index = 0; in_index < args.size(); ++in_index) {+ const size_t size = sizes[in_index];+ out = std::copy_n(args[in_index] + step * size, size, out);+ }+ }}-} // namespacevoid concat(const std::vector<const char*>& args,char* out,const std::vector<Shape>& in_shapes,const Shape& out_shape,int64_t concatenation_axis,- size_t elem_size,- const ov::element::Type& elem_type) {+ size_t bitwidth) {const auto steps = shape_size(out_shape.begin(), out_shape.begin() + concatenation_axis);- const auto& shape_sizes = calculate_shape_sizes(in_shapes);-- const auto copy_func = elem_type == ov::element::string ? copy_string_elements : copy_elements;+ if (steps == 0) {+ return;+ }+ // Byte-aligned: multiply by elem_size directly - count * bitwidth would overflow 8x sooner.+ const auto sizes = bitwidth % 8 == 0 ? calculate_sizes(in_shapes,+ steps,+ [elem_size = bitwidth / 8](auto&& count) {+ return count * elem_size;+ })+ : calculate_sizes(in_shapes, steps, [bitwidth](auto&& count) {+ return (count * bitwidth) / 8;+ });- size_t out_offset = 0;for (size_t step = 0; step < steps; ++step) {for (size_t in_index = 0; in_index < args.size(); ++in_index) {- size_t size = shape_sizes[in_index] / steps;- if (elem_type == ov::element::u4 || elem_type == ov::element::i4)- size /= 2;- const size_t in_offset = step * size;- copy_func(args[in_index], out, in_offset, out_offset, size, elem_size);-- out_offset += size;+ const size_t size = sizes[in_index];+ std::memcpy(out, args[in_index] + step * size, size);+ out += size;}}}-} // namespace reference-} // namespace ov+} // namespace ov::referencediff --git a/src/core/reference/src/op/loop.cpp b/src/core/reference/src/op/loop.cppindex 208f64873bd..52fcb797b23 100644--- a/src/core/reference/src/op/loop.cpp+++ b/src/core/reference/src/op/loop.cpp@@ -218,7 +218,7 @@ void loop(const std::shared_ptr<Model>& func,shapes_to_concat,shape,concat_desc->m_axis,- out[concat_desc->m_output_index].get_element_type().size());+ out[concat_desc->m_output_index].get_element_type().bitwidth());}} else {OPENVINO_THROW("ExecutionCondition is false. Zero count of iteration not supported.");diff --git a/src/core/reference/src/op/tensor_iterator.cpp b/src/core/reference/src/op/tensor_iterator.cppindex d24ce6071f0..5546effbf4f 100644--- a/src/core/reference/src/op/tensor_iterator.cpp+++ b/src/core/reference/src/op/tensor_iterator.cpp@@ -133,7 +133,7 @@ void tensor_iterator(uint64_t num_iterations,shapes_to_concat,shape,concat_desc->m_axis,- out[concat_desc->m_output_index].get_element_type().size());+ out[concat_desc->m_output_index].get_element_type().bitwidth());}}} // namespace referencediff --git a/src/core/src/op/concat.cpp b/src/core/src/op/concat.cppindex 59af15fa90b..1fde1aedf44 100644--- a/src/core/src/op/concat.cpp+++ b/src/core/src/op/concat.cpp@@ -4,6 +4,9 @@#include "openvino/op/concat.hpp"+#include <algorithm>+#include <type_traits>+#include "bound_evaluate.hpp"#include "concat_shape_inference.hpp"#include "itt.hpp"@@ -14,6 +17,44 @@namespace ov {namespace op {namespace v0 {+namespace {+template <class T>+std::vector<const T*> get_data_ptrs(const TensorVector& inputs) {+ std::vector<const T*> ptrs;+ ptrs.reserve(inputs.size());+ for (auto& input : inputs) {+ if constexpr (std::is_same_v<T, std::string>) {+ ptrs.emplace_back(input.data<T>());+ } else {+ ptrs.emplace_back(static_cast<const T*>(input.data()));+ }+ }+ return ptrs;+}++enum class concat_kind { unsupported, string, bytes };++concat_kind get_concat_kind(const element::Type& elem_type,+ const std::vector<Shape>& input_shapes,+ const Shape& output_shape,+ size_t axis) {+ if (elem_type == element::string) {+ return concat_kind::string;+ } else if (const auto bitwidth = elem_type.bitwidth(); bitwidth >= 8) {+ return concat_kind::bytes;+ } else if (bitwidth == 0) {+ return concat_kind::unsupported;+ } else {+ const auto steps = ov::shape_size(output_shape.begin(), output_shape.begin() + axis);+ const auto is_misaligned = [steps, bitwidth](auto&& shape) {+ return (ov::shape_size(shape) / steps * bitwidth) % 8 != 0;+ };+ return steps == 0 || std::none_of(input_shapes.begin(), input_shapes.end(), is_misaligned)+ ? concat_kind::bytes+ : concat_kind::unsupported;+ }+}+} // namespaceConcat::Concat(const OutputVector& args, int64_t axis) : Op(args), m_axis(axis) {constructor_validate_and_infer_types();@@ -56,35 +97,46 @@ bool Concat::evaluate(TensorVector& outputs, const TensorVector& inputs) const {const auto inputs_count = inputs.size();std::vector<Shape> arg_shapes;std::vector<PartialShape> input_shapes;- std::vector<const char*> arg_bufs;arg_shapes.reserve(inputs_count);input_shapes.reserve(inputs_count);- arg_bufs.reserve(inputs_count);for (auto& input : inputs) {const auto& input_shape = input.get_shape();arg_shapes.emplace_back(input_shape);input_shapes.emplace_back(input_shape);- arg_bufs.emplace_back(static_cast<const char*>(input.data()));}+ const auto& elem_type = outputs[0].get_element_type();const auto& out_shape = shape_infer(this, input_shapes).front().to_shape();- outputs.front().set_shape(out_shape);- const auto elem_type = outputs.front().get_element_type();- reference::concat(arg_bufs,- static_cast<char*>(outputs.front().data()),- arg_shapes,- out_shape,- ov::util::normalize(this->get_axis(), out_shape.size()),- elem_type.size(),- elem_type);+ const auto axis = ov::util::normalize(get_axis(), out_shape.size());- return true;+ outputs.front().set_shape(out_shape);+ switch (get_concat_kind(elem_type, arg_shapes, out_shape, axis)) {+ case concat_kind::string:+ reference::concat(get_data_ptrs<std::string>(inputs),+ outputs[0].data<std::string>(),+ arg_shapes,+ out_shape,+ axis);+ return true;+ case concat_kind::bytes:+ reference::concat(get_data_ptrs<char>(inputs),+ static_cast<char*>(outputs[0].data()),+ arg_shapes,+ out_shape,+ axis,+ elem_type.bitwidth());+ return true;+ case concat_kind::unsupported:+ [[fallthrough]];+ default:+ return false;+ }}bool Concat::has_evaluate() const {OV_OP_SCOPE(v0_Concat_has_evaluate);- return true;+ return get_output_element_type(0).is_static();}bool Concat::evaluate_lower(TensorVector& output_values) const {diff --git a/src/plugins/intel_gpu/src/graph/loop.cpp b/src/plugins/intel_gpu/src/graph/loop.cppindex 10d64306719..e99ff1023f9 100644--- a/src/plugins/intel_gpu/src/graph/loop.cpp+++ b/src/plugins/intel_gpu/src/graph/loop.cpp@@ -949,7 +949,7 @@ void loop_inst::concatenated_memory_mapping::concat_mem(const int64_t curent_iteauto sliced_layout = sliced_data_prim->get_output_layout(io_prim_map.internal_id.idx);auto concat_mem_shape = concat_layout.get_shape();auto sliced_mem_shape = sliced_layout.get_shape();- auto elem_size = ov::element::Type(concat_layout.data_type).size();+ auto elem_size = ov::element::Type(concat_layout.data_type).bitwidth();const auto stride = io_prim_map.stride;const auto axis = io_prim_map.axis;const auto step = std::abs(stride);diff --git a/src/plugins/template/tests/functional/op_reference/base_reference_test.cpp b/src/plugins/template/tests/functional/op_reference/base_reference_test.cppindex 8ada301138f..b8a9c7675be 100644--- a/src/plugins/template/tests/functional/op_reference/base_reference_test.cpp+++ b/src/plugins/template/tests/functional/op_reference/base_reference_test.cpp@@ -92,8 +92,14 @@ void CommonReferenceTest::ValidateBlobs(const ov::Tensor& refBlob,// compare() get fundamental element type with element_type_traits firstly and cast data to relative ov type with// 'from' types listed below have a fundamental analogue as int8_t, but int8_t is converted only to i8 with from- std::vector<ov::element::Type> raw_data_comp_only =- {ov::element::u1, ov::element::u2, ov::element::u3, ov::element::u4, ov::element::u6, ov::element::i4};+ std::vector<ov::element::Type> raw_data_comp_only = {ov::element::u1,+ ov::element::u2,+ ov::element::u3,+ ov::element::u4,+ ov::element::u6,+ ov::element::i4,+ ov::element::nf4,+ ov::element::f4e2m1};const auto& element_type = refBlob.get_element_type();if (!legacy_compare &&std::find(raw_data_comp_only.begin(), raw_data_comp_only.end(), element_type) == raw_data_comp_only.end()) {diff --git a/src/plugins/template/tests/functional/op_reference/concat.cpp b/src/plugins/template/tests/functional/op_reference/concat.cppindex d7b8fedab9d..1a69028f55e 100644--- a/src/plugins/template/tests/functional/op_reference/concat.cpp+++ b/src/plugins/template/tests/functional/op_reference/concat.cpp@@ -6,7 +6,10 @@#include <gtest/gtest.h>+#include <type_traits>+#include "base_reference_test.hpp"+#include "openvino/core/type/float4_e2m1.hpp"#include "openvino/op/add.hpp"#include "openvino/op/constant.hpp"#include "openvino/op/parameter.hpp"@@ -146,6 +149,125 @@ std::vector<ConcatParams> generateParams() {return params;}+template <element::Type_t ET>+std::vector<ConcatParams> generateParamsNibblePacked() {+ // 4-bit "nibble" types with int8_t as their raw storage type (u4, i4, nf4).+ static_assert(!std::is_same_v<typename element_type_traits<ET>::value_type, ov::float4_e2m1>,+ "f4e2m1's value_type encodes a numeric float, not a raw byte - use generateParamsBitPackedF4E2M1");+ using T = typename element_type_traits<ET>::value_type;+ std::vector<ConcatParams> params{+ ConcatParams({},+ reference_tests::Tensor(ET, {2, 2}, std::vector<T>{0x21, 0x43}), // rows [1,2],[3,4]+ reference_tests::Tensor(ET, {2, 2}, std::vector<T>{0x65, 0x17}), // rows [5,6],[7,1]+ reference_tests::Tensor(ET, {2, 0}, std::vector<T>{}),+ 1,+ reference_tests::Tensor(ET, {2, 4}, std::vector<T>{0x21, 0x65, 0x43, 0x17}),+ "concat_nibble_packed_axis_1"),+ };+ return params;+}++std::vector<ConcatParams> generateParamsBitPackedF4E2M1() {+ const auto ET = element::f4e2m1;+ using T = int8_t;+ std::vector<ConcatParams> params{+ ConcatParams({},+ reference_tests::Tensor(ET, {2, 2}, std::vector<T>{0x21, 0x43}), // rows [1,2],[3,4]+ reference_tests::Tensor(ET, {2, 2}, std::vector<T>{0x65, 0x17}), // rows [5,6],[7,1]+ reference_tests::Tensor(ET, {2, 0}, std::vector<T>{}),+ 1,+ reference_tests::Tensor(ET, {2, 4}, std::vector<T>{0x21, 0x65, 0x43, 0x17}),+ "concat_f4e2m1_packed_axis_1"),+ };+ return params;+}++std::vector<ConcatParams> generateParamsBitPackedU2() {+ const auto ET = element::u2;+ using T = element_type_traits<element::Type_t::u2>::value_type;+ std::vector<ConcatParams> params{+ ConcatParams({},+ reference_tests::Tensor(ET, {2, 4}, std::vector<T>{0x39, 0x1B}),+ reference_tests::Tensor(ET, {2, 4}, std::vector<T>{0x14, 0x41}),+ reference_tests::Tensor(ET, {2, 0}, std::vector<T>{}),+ 1,+ reference_tests::Tensor(ET, {2, 8}, std::vector<T>{0x39, 0x14, 0x1B, 0x41}),+ "concat_u2_packed_axis_1"),+ };+ return params;+}++std::vector<ConcatParams> generateParamsBitPackedU1() {+ const auto ET = element::u1;+ using T = element_type_traits<element::Type_t::u1>::value_type;+ std::vector<ConcatParams> params{+ ConcatParams({},+ reference_tests::Tensor(ET, {2, 8}, std::vector<T>{0x2A, 0x15}),+ reference_tests::Tensor(ET, {2, 8}, std::vector<T>{0x33, 0x0C}),+ reference_tests::Tensor(ET, {2, 0}, std::vector<T>{}),+ 1,+ reference_tests::Tensor(ET, {2, 16}, std::vector<T>{0x2A, 0x33, 0x15, 0x0C}),+ "concat_u1_packed_axis_1"),+ };+ return params;+}++std::vector<ConcatParams> generateParamsBitPackedU3() {+ const auto ET = element::u3;+ using T = element_type_traits<element::Type_t::u3>::value_type;+ std::vector<ConcatParams> params{+ ConcatParams(+ {},+ reference_tests::Tensor(ET,+ {2, 8},+ std::vector<T>{0x1a, static_cast<T>(0xc2), static_cast<T>(0xfa), 0x77, 0x39, 0x05}),+ reference_tests::Tensor(ET,+ {2, 8},+ std::vector<T>{static_cast<T>(0xd1),+ 0x58,+ 0x1f,+ static_cast<T>(0x88),+ static_cast<T>(0xc6),+ static_cast<T>(0xfa)}),+ reference_tests::Tensor(ET, {2, 0}, std::vector<T>{}),+ 1,+ reference_tests::Tensor(ET,+ {2, 16},+ std::vector<T>{0x1a,+ static_cast<T>(0xc2),+ static_cast<T>(0xfa),+ static_cast<T>(0xd1),+ 0x58,+ 0x1f,+ 0x77,+ 0x39,+ 0x05,+ static_cast<T>(0x88),+ static_cast<T>(0xc6),+ static_cast<T>(0xfa)}),+ "concat_u3_packed_axis_1"),+ };+ return params;+}++std::vector<ConcatParams> generateParamsBitPackedU6() {+ const auto ET = element::u6;+ using T = element_type_traits<element::Type_t::u6>::value_type;+ std::vector<ConcatParams> params{+ ConcatParams({},+ reference_tests::Tensor(ET, {2, 4}, std::vector<T>{0x42, 0x00, 0x0c, 0x52, 0x3c, 0x42}),+ reference_tests::Tensor(ET, {2, 4}, std::vector<T>{0x44, 0x61, 0x1c, 0x09, 0x45, 0x04}),+ reference_tests::Tensor(ET, {2, 0}, std::vector<T>{}),+ 1,+ reference_tests::Tensor(+ ET,+ {2, 8},+ std::vector<T>{0x42, 0x00, 0x0c, 0x44, 0x61, 0x1c, 0x52, 0x3c, 0x42, 0x09, 0x45, 0x04}),+ "concat_u6_packed_axis_1"),+ };+ return params;+}+std::vector<ConcatParams> generateStringParams() {const auto ET = ov::element::string;using T = typename element_type_traits<ov::element::string>::value_type;@@ -240,6 +362,14 @@ std::vector<ConcatParams> generateCombinedParams() {generateParams<element::Type_t::f16>(),generateParams<element::Type_t::f32>(),generateParams<element::Type_t::f64>(),+ generateParamsNibblePacked<element::Type_t::u4>(),+ generateParamsNibblePacked<element::Type_t::i4>(),+ generateParamsNibblePacked<element::Type_t::nf4>(),+ generateParamsBitPackedF4E2M1(),+ generateParamsBitPackedU2(),+ generateParamsBitPackedU1(),+ generateParamsBitPackedU3(),+ generateParamsBitPackedU6(),generateStringParams(),generateParams4Bit<element::Type_t::i4>(),generateParams4Bit<element::Type_t::u4>(),@@ -257,6 +387,92 @@ INSTANTIATE_TEST_SUITE_P(smoke_Concat_With_Hardcoded_Refs,testing::ValuesIn(generateCombinedParams()),ReferenceConcatTest::getTestCaseName);+struct ConcatSupportParams {+ ConcatSupportParams(const element::Type& et,+ const Shape& shape,+ int64_t axis,+ bool supported,+ const std::string& testcaseName)+ : et(et),+ shape(shape),+ axis(axis),+ supported(supported),+ testcaseName(testcaseName) {}++ element::Type et;+ Shape shape;+ int64_t axis;+ bool supported;+ std::string testcaseName;+};++class ReferenceConcatSupportTest : public testing::TestWithParam<ConcatSupportParams> {+public:+ static std::string getTestCaseName(const testing::TestParamInfo<ConcatSupportParams>& obj) {+ return obj.param.testcaseName;+ }+};++TEST_P(ReferenceConcatSupportTest, evaluate) {+ const auto& p = GetParam();+ auto arg1 = std::make_shared<op::v0::Parameter>(p.et, p.shape);+ auto arg2 = std::make_shared<op::v0::Parameter>(p.et, p.shape);+ auto concat = std::make_shared<op::v0::Concat>(NodeVector{arg1, arg2}, p.axis);++ ov::Tensor a_tensor(p.et, p.shape);+ ov::Tensor b_tensor(p.et, p.shape);+ ov::TensorVector outputs{ov::Tensor(p.et, Shape{})};+ ov::TensorVector inputs{a_tensor, b_tensor};+ EXPECT_EQ(concat->evaluate(outputs, inputs), p.supported);+}++std::vector<ConcatSupportParams> generateConcatSupportParams() {+ std::vector<ConcatSupportParams> params;++ // u3/u6 align to a 3-byte group (8/4 elements respectively), unlike the other packed types below.+ for (const auto& et : {element::u1, element::u2, element::u3, element::u4, element::u6}) {+ for (const auto& shape : {Shape{2, 3}, Shape{3}}) {+ const auto axis = static_cast<int64_t>(shape.size()) - 1;+ params.emplace_back(et,+ shape,+ axis,+ false,+ "misaligned_" + et.get_type_name() + "_shape" + std::to_string(shape.size()) + "d");+ }+ }++ // 4 elements/row byte-aligns u2/u4/u6 (need a multiple of 4, 2 and 4 respectively), but u1/u3 both+ // need a multiple of 8, so the same shape must be rejected for them.+ for (const auto& et : {element::u1, element::u2, element::u3, element::u4, element::u6}) {+ const bool supported = et != element::u1 && et != element::u3;+ params.emplace_back(et, Shape{2, 4}, 1, supported, "tail4_" + et.get_type_name());+ }++ // u3 aligns every 8 elements (8*3=24 bits), u6 every 4 elements (4*6=24 bits) - both are multiples+ // of the same 24-bit/3-byte group, so larger multiples (16/8, 24/12, ...) stay aligned too.+ params.emplace_back(element::u3, Shape{2, 7}, 1, false, "boundary_u3_tail7"); // below boundary+ params.emplace_back(element::u3, Shape{2, 8}, 1, true, "boundary_u3_tail8"); // exact boundary+ params.emplace_back(element::u3, Shape{2, 9}, 1, false, "boundary_u3_tail9"); // above boundary+ params.emplace_back(element::u3, Shape{2, 16}, 1, true, "boundary_u3_tail16"); // 2x boundary+ params.emplace_back(element::u6, Shape{2, 3}, 1, false, "boundary_u6_tail3"); // below boundary+ params.emplace_back(element::u6, Shape{2, 4}, 1, true, "boundary_u6_tail4"); // exact boundary+ params.emplace_back(element::u6, Shape{2, 5}, 1, false, "boundary_u6_tail5"); // above boundary+ params.emplace_back(element::u6, Shape{2, 8}, 1, true, "boundary_u6_tail8"); // 2x boundary++ // A zero-sized dim before the concat axis means there are no rows to copy, so the per-row+ // byte-alignment check is skipped even though the 3-element tail would otherwise be misaligned.+ for (const auto& et : {element::u3, element::u6}) {+ params.emplace_back(et, Shape{0, 3}, 1, true, "zero_leading_dim_" + et.get_type_name());+ }++ return params;+}++INSTANTIATE_TEST_SUITE_P(smoke_Concat_Evaluate_Support,+ ReferenceConcatSupportTest,+ testing::ValuesIn(generateConcatSupportParams()),+ ReferenceConcatSupportTest::getTestCaseName);+//// concat_vector_params, concat_vector_largestruct ConcatParamsVectorLarge {