Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GPU] Fix accuracy of runtime-quantized ONNX MNIST qlinear/convinteger (#39796)

David Nam2494d159ee29
diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/fuse_primitives_with_layout.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/fuse_primitives_with_layout.cpp
index 4e7c6301552..7263293bce8 100644
--- a/src/plugins/intel_gpu/src/graph/graph_optimizer/fuse_primitives_with_layout.cpp
+++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/fuse_primitives_with_layout.cpp
@@ -41,6 +41,13 @@ void fuse_primitives_with_layout::run(program& p) {
return;
}
+ // The fused quantize code supports only the scale/shift form, which prepare_quantization builds from
+ // constant ranges (prepare_primitive_fusing checks it as well). Fusing a quantize with runtime ranges
+ // would apply its input_low tensor as the input scale.
+ if (!node.get_scale_shift_opt()) {
+ return;
+ }
+
auto& input_node = node.get_dependency(0);
auto in_layout = input_node.get_output_layout();
if (input_node.get_users().size() != 1 || input_node.get_dependencies().empty() ||
diff --git a/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp b/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp
index dd6a6cff953..b6c3667071c 100644
--- a/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp
+++ b/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp
@@ -450,6 +450,28 @@ bool layout_optimizer::can_fuse_reorder(program_node& prev, program_node& next,
bool layout_optimizer::can_fuse_reorder_to_prev(program_node& prev, reorder_node& node, format fmt_prev, format fmt_next) {
bool allow_new_shape_infer = node.get_program().is_new_shape_infer();
+ const auto is_fp_to_int = [](data_types from, data_types to) {
+ return data_type_traits::is_floating_point(from) && !data_type_traits::is_floating_point(to);
+ };
+ // A Convert from floating point to an integral type (reorder in truncate mode) truncates toward zero and wraps
+ // out-of-range values. Except for select, whose kernel converts the same way, a previous node storing the
+ // integral type directly converts in its own way (e.g. saturates), so keep such a reorder.
+ if (node.get_primitive()->truncate && is_fp_to_int(prev.get_output_layout().data_type, node.get_output_layout().data_type) &&
+ !prev.is_type<select>()) {
+ return false;
+ }
+ // Once a node stores the truncated integral value of its floating-point result, another type conversion fused into
+ // it would make it store the floating-point result in the new type directly, dropping the truncation. The reorder
+ // chain shrinking keeps fp -> int -> fp reorders for the same reason.
+ const auto& prev_fused_prims = prev.get_fused_primitives();
+ const bool prev_truncates = std::any_of(prev_fused_prims.begin(), prev_fused_prims.end(), [&](const fused_primitive_desc& fd) {
+ return fd.is_type<reorder>() && fd.typed_desc<reorder>()->truncate &&
+ is_fp_to_int(fd.input_layout.data_type, fd.get_output_layout().data_type);
+ });
+ if (prev_truncates && prev.get_output_layout().data_type != node.get_output_layout().data_type) {
+ return false;
+ }
+
// Do not fuse a rank-reducing reorder into a producer whose fused higher-rank
// eltwise peer cannot be indexed correctly at the reduced rank (inner-spatial
// broadcast over the collapsed axes). Keeping the producer at its higher rank
diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/generic_eltwise_ref.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/generic_eltwise_ref.cl
index f1898888ce2..93953b082dd 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/generic_eltwise_ref.cl
+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/generic_eltwise_ref.cl
@@ -19,8 +19,9 @@
OUTPUT_PAD_AFTER_FEATURE_NUM) % OUTPUT_FEATURE_BLOCK_SIZE) % \
OUTPUT_FEATURE_BLOCK_SIZE)
#define GWS_FEATURE_SIZE(logical_feature_size) (OUTPUT_FEATURE_NUM + OUTPUT_FEATURE_PAD_RESET_SIZE)
- // Use non-safe indexing to address padding lanes past the logical feature range.
- #define GET_PAD_RESET_INDEX(prefix, num, idx_order) CAT(CAT(prefix, num), _GET_INDEX)(idx_order)
+ // Use raw indexing to address padding lanes past the logical feature range. _GET_INDEX is folded to the
+ // first element offset for a single-element tensor, which would make every padding lane overwrite it.
+ #define GET_PAD_RESET_INDEX(prefix, num, idx_order) CAT(CAT(prefix, num), _GET_INDEX_RAW)(idx_order)
#else
#define GWS_FEATURE_SIZE(logical_feature_size) (logical_feature_size)
#endif
diff --git a/src/plugins/intel_gpu/tests/unit/fusions/eltwise_fusion_test.cpp b/src/plugins/intel_gpu/tests/unit/fusions/eltwise_fusion_test.cpp
index cdcf05bce98..7c862d0b843 100644
--- a/src/plugins/intel_gpu/tests/unit/fusions/eltwise_fusion_test.cpp
+++ b/src/plugins/intel_gpu/tests/unit/fusions/eltwise_fusion_test.cpp
@@ -678,40 +678,18 @@ public:
layout get_input_layout3(eltwise_test_params& p) {
return layout{ {1, 1, 1, p.input_size[3]}, p.input_type, p.input_format };
}
-
- // Generate integer-valued f16 memory so the f16→i32→f16 ref-path reorders
- // are lossless (i32 truncation of an integer is a no-op).
- cldnn::memory::ptr get_int_f16_mem(cldnn::layout l) {
- auto prim = engine.allocate_memory(l);
- auto rnd_vec = rg.generate_random_1d<ov::float16>(l.get_tensor().count(), -4, 4, 1);
- set_values(prim, rnd_vec);
- return prim;
- }
-
- void execute(eltwise_test_params& p, bool count_reorder = false) {
- auto input_prim = get_int_f16_mem(get_input_layout(p));
-
- network network_not_fused(this->engine, this->topology_non_fused, cfg_not_fused);
- network network_fused(this->engine, this->topology_fused, cfg_fused);
-
- auto inputs = network_fused.get_input_ids();
- if (std::find(inputs.begin(), inputs.end(), "input") != inputs.end()) {
- network_fused.set_input_data("input", input_prim);
- network_not_fused.set_input_data("input", input_prim);
- }
-
- compare(network_not_fused, network_fused, p, count_reorder);
- }
};
TEST_P(eltwise_fusing_reorders, reorders_for_data_type) {
auto p = GetParam();
+ // A Convert from floating point to an integral type truncates toward zero, so neither reorder may be fused into the
+ // eltwise: fusing both of them made the eltwise store its floating-point result directly, dropping the truncation.
create_topologies(
input_layout("input", get_input_layout(p)),
- data("data", get_int_f16_mem(get_input_layout3(p))),
+ data("data", get_mem(get_input_layout3(p))),
eltwise("eltwise", { input_info("input"), input_info("data") }, p.mode, p.default_type),
reorder("reorder1", input_info("eltwise"), format::bfyx, data_types::i32, {}, reorder_mean_mode::subtract, padding(), true),
reorder("reorder2", input_info("reorder1"), format::bfyx, data_types::f16, {}, reorder_mean_mode::subtract, padding(), true),
- data("data2", get_int_f16_mem(get_input_layout3(p))),
+ data("data2", get_mem(get_input_layout3(p))),
eltwise("eltwise_min", { input_info("reorder2"), input_info("data2") }, eltwise_mode::min, p.default_type),
reorder("out", input_info("eltwise_min"), p.default_format, data_types::f32)
);
@@ -721,7 +699,7 @@ TEST_P(eltwise_fusing_reorders, reorders_for_data_type) {
}
INSTANTIATE_TEST_SUITE_P(fusings_gpu, eltwise_fusing_reorders, ::testing::ValuesIn(std::vector<eltwise_test_params>{
- eltwise_test_params{ { 1, 16, 16, 2 }, data_types::f16, data_types::f16, format::bfyx, data_types::f16, format::bfyx, eltwise_mode::max, 4, 6 },
+ eltwise_test_params{ { 1, 16, 16, 2 }, data_types::f16, data_types::f16, format::bfyx, data_types::f16, format::bfyx, eltwise_mode::max, 6, 6 },
}));
class eltwise_bf16_fusing_reorders : public EltwiseFusingTest {
@@ -729,40 +707,18 @@ public:
layout get_input_layout3(eltwise_test_params& p) {
return layout{ {1, 1, 1, p.input_size[3]}, p.input_type, p.input_format };
}
-
- // Generate integer-valued bf16 memory so the bf16→i32→bf16 ref-path reorders
- // are lossless (i32 truncation of an integer is a no-op).
- cldnn::memory::ptr get_int_bf16_mem(cldnn::layout l) {
- auto prim = engine.allocate_memory(l);
- auto rnd_vec = rg.generate_random_1d<ov::bfloat16>(l.get_tensor().count(), -4, 4, 1);
- set_values(prim, rnd_vec);
- return prim;
- }
-
- void execute(eltwise_test_params& p, bool count_reorder = false) {
- auto input_prim = get_int_bf16_mem(get_input_layout(p));
-
- network network_not_fused(this->engine, this->topology_non_fused, cfg_not_fused);
- network network_fused(this->engine, this->topology_fused, cfg_fused);
-
- auto inputs = network_fused.get_input_ids();
- if (std::find(inputs.begin(), inputs.end(), "input") != inputs.end()) {
- network_fused.set_input_data("input", input_prim);
- network_not_fused.set_input_data("input", input_prim);
- }
-
- compare(network_not_fused, network_fused, p, count_reorder);
- }
};
TEST_P(eltwise_bf16_fusing_reorders, reorders_for_data_type) {
auto p = GetParam();
+ // A Convert from floating point to an integral type truncates toward zero, so neither reorder may be fused into the
+ // eltwise: fusing both of them made the eltwise store its floating-point result directly, dropping the truncation.
create_topologies(
input_layout("input", get_input_layout(p)),
- data("data", get_int_bf16_mem(get_input_layout3(p))),
+ data("data", get_mem(get_input_layout3(p))),
eltwise("eltwise", { input_info("input"), input_info("data") }, p.mode, p.default_type),
reorder("reorder1", input_info("eltwise"), format::bfyx, data_types::i32, {}, reorder_mean_mode::subtract, padding(), true),
reorder("reorder2", input_info("reorder1"), format::bfyx, data_types::bf16, {}, reorder_mean_mode::subtract, padding(), true),
- data("data2", get_int_bf16_mem(get_input_layout3(p))),
+ data("data2", get_mem(get_input_layout3(p))),
eltwise("eltwise_min", { input_info("reorder2"), input_info("data2") }, eltwise_mode::min, p.default_type),
reorder("out", input_info("eltwise_min"), p.default_format, data_types::f32)
);
@@ -772,7 +728,7 @@ TEST_P(eltwise_bf16_fusing_reorders, reorders_for_data_type) {
}
INSTANTIATE_TEST_SUITE_P(fusings_gpu, eltwise_bf16_fusing_reorders, ::testing::ValuesIn(std::vector<eltwise_test_params>{
- eltwise_test_params{ { 1, 16, 16, 2 }, data_types::bf16, data_types::bf16, format::bfyx, data_types::bf16, format::bfyx, eltwise_mode::max, 4, 6 },
+ eltwise_test_params{ { 1, 16, 16, 2 }, data_types::bf16, data_types::bf16, format::bfyx, data_types::bf16, format::bfyx, eltwise_mode::max, 6, 6 },
}));
class eltwise_with_constant_input : public EltwiseFusingTest {};
diff --git a/src/plugins/intel_gpu/tests/unit/passes/fuse_primitives_with_layout.cpp b/src/plugins/intel_gpu/tests/unit/passes/fuse_primitives_with_layout.cpp
index 6f1d61abafe..5443214cbc6 100644
--- a/src/plugins/intel_gpu/tests/unit/passes/fuse_primitives_with_layout.cpp
+++ b/src/plugins/intel_gpu/tests/unit/passes/fuse_primitives_with_layout.cpp
@@ -56,3 +56,84 @@ TEST(fuse_primitives_with_layout, fuse_when_layout_format_of_input_and_output_ar
ASSERT_TRUE(has_node(*program, "quantize"));
}
+
+TEST(fuse_primitives_with_layout, not_fuse_quantize_with_runtime_ranges) {
+ // input1(b_fs_yx_fsv16) input2(b_fs_yx_fsv16)
+ // \ /
+ // eltwise(b_fs_yx_fsv16) in_lo in_hi out_lo out_hi (runtime inputs)
+ // | | | | |
+ // quantize(b_fs_yx_fsv16) ----------------------
+ // |
+ // reorder(bfyx)
+ //
+ // prepare_quantization builds the scale/shift form of a quantize only from constant ranges, and a fused quantize
+ // is generated only in that form. A quantize with runtime ranges (e.g. from a dynamically quantized activation)
+ // must stay a separate primitive, otherwise the fused code applies the input_low tensor as the input scale.
+ auto& engine = get_test_engine();
+
+ const auto data_layout = layout{ ov::PartialShape{1, 16, 2, 2}, data_types::f32, format::bfyx };
+ const auto range_layout = layout{ ov::PartialShape{1, 1, 1, 1}, data_types::f32, format::bfyx };
+ const int levels = 256;
+ const float in_lo = 0.0f;
+ const float in_hi = 255.0f;
+ const float out_lo = 0.0f;
+ const float out_hi = 25.5f;
+
+ // k + 0.25 keeps every value away from a rounding tie, and the values cover both clamps of the range.
+ std::vector<float> input1_data(data_layout.count());
+ for (size_t i = 0; i < input1_data.size(); ++i) {
+ input1_data[i] = static_cast<float>(static_cast<int>(i) * 5 - 20) + 0.25f;
+ }
+
+ auto input1 = engine.allocate_memory(data_layout);
+ auto input2 = engine.allocate_memory(data_layout);
+ set_values(input1, input1_data);
+ set_values(input2, std::vector<float>(data_layout.count(), 1.0f));
+
+ std::map<primitive_id, memory::ptr> ranges;
+ for (const auto& [id, value] : std::vector<std::pair<primitive_id, float>>{{"in_lo", in_lo}, {"in_hi", in_hi}, {"out_lo", out_lo}, {"out_hi", out_hi}}) {
+ ranges[id] = engine.allocate_memory(range_layout);
+ set_values(ranges[id], {value});
+ }
+
+ topology topology(
+ input_layout("input1", data_layout),
+ input_layout("input2", data_layout),
+ input_layout("in_lo", range_layout),
+ input_layout("in_hi", range_layout),
+ input_layout("out_lo", range_layout),
+ input_layout("out_hi", range_layout),
+ reorder("input1_fsv16", input_info("input1"), format::b_fs_yx_fsv16, data_types::f32),
+ reorder("input2_fsv16", input_info("input2"), format::b_fs_yx_fsv16, data_types::f32),
+ eltwise("multiply", input_info("input1_fsv16"), input_info("input2_fsv16"), eltwise_mode::prod),
+ quantize("quantize", input_info("multiply"), input_info("in_lo"), input_info("in_hi"), input_info("out_lo"), input_info("out_hi"),
+ levels, data_types::f32),
+ reorder("reorder", input_info("quantize"), format::bfyx, data_types::f32)
+ );
+
+ ExecutionConfig config = get_test_default_config(engine);
+ config.set_property(ov::intel_gpu::optimize_data(true));
+ network network(engine, topology, config);
+
+ ASSERT_TRUE(has_node(*network.get_program(), "quantize"));
+
+ network.set_input_data("input1", input1);
+ network.set_input_data("input2", input2);
+ for (const auto& [id, mem] : ranges) {
+ network.set_input_data(id, mem);
+ }
+ auto outputs = network.execute();
+
+ auto output = outputs.at("reorder").get_memory();
+ cldnn::mem_lock<float, mem_lock_type::read> output_ptr(output, get_test_stream());
+ for (size_t i = 0; i < input1_data.size(); ++i) {
+ const float x = input1_data[i];
+ float expected = out_lo;
+ if (x > in_hi) {
+ expected = out_hi;
+ } else if (x > in_lo) {
+ expected = std::round((x - in_lo) / (in_hi - in_lo) * (levels - 1)) / (levels - 1) * (out_hi - out_lo) + out_lo;
+ }
+ ASSERT_NEAR(output_ptr[i], expected, 1e-4f) << "index " << i << ", input " << x;
+ }
+}
diff --git a/src/plugins/intel_gpu/tests/unit/passes/remove_redundant_reorders_tests.cpp b/src/plugins/intel_gpu/tests/unit/passes/remove_redundant_reorders_tests.cpp
index da1dc7e5ead..18c5c11ec07 100644
--- a/src/plugins/intel_gpu/tests/unit/passes/remove_redundant_reorders_tests.cpp
+++ b/src/plugins/intel_gpu/tests/unit/passes/remove_redundant_reorders_tests.cpp
@@ -23,6 +23,7 @@
#include "shape_of_inst.h"
#include "arg_max_min_inst.h"
#include "gather_inst.h"
+#include "select_inst.h"
#include "pass_manager.h"
#include "to_string_utils.h"
@@ -439,6 +440,72 @@ TEST(remove_redundant_reorders, not_to_fuse_concat_with_reorder_inside_shape_of_
ASSERT_EQ(concat_layout.data_type, data_types::f32);
}
+namespace {
+// producer(f32) -> reorder(u8, truncate) -> reorder(f32, truncate)
+// A Convert from floating point to an integral type truncates toward zero and wraps out-of-range values. A producer other
+// than select would store the u8 result with its own output conversion, so the first Convert must stay. The select
+// kernel converts the same way as the Convert, but once the first Convert is fused into it, fusing the Convert back to
+// f32 as well would make it store the f32 result directly, dropping the truncation.
+void test_truncating_fp_to_int_to_fp_reorders(bool select_producer) {
+ auto& engine = get_test_engine();
+ const auto in_layout = layout{ ov::PartialShape{ 1, 4, 1, 1 }, data_types::f32, format::bfyx };
+ auto input = engine.allocate_memory(in_layout);
+ set_values(input, { -86.5f, -163.5f, 300.5f, 7.5f });
+
+ topology topology;
+ topology.add(input_layout("input", in_layout));
+ if (select_producer) {
+ auto mask = engine.allocate_memory({ ov::PartialShape{ 1, 4, 1, 1 }, data_types::i8, format::bfyx });
+ auto zeros = engine.allocate_memory(in_layout);
+ set_values<int8_t>(mask, { 1, 1, 1, 1 });
+ set_values(zeros, { 0.0f, 0.0f, 0.0f, 0.0f });
+ topology.add(data("mask", mask));
+ topology.add(data("zeros", zeros));
+ topology.add(cldnn::select("producer", input_info("mask"), input_info("input"), input_info("zeros")));
+ } else {
+ auto zero = engine.allocate_memory({ ov::PartialShape{ 1, 1, 1, 1 }, data_types::f32, format::bfyx });
+ set_values(zero, { 0.0f });
+ topology.add(data("zero", zero));
+ topology.add(eltwise("producer", input_info("input"), input_info("zero"), eltwise_mode::sum));
+ }
+ topology.add(reorder("to_u8", input_info("producer"), format::any, data_types::u8,
+ std::vector<float>(), reorder_mean_mode::subtract, padding(), true));
+ topology.add(reorder("to_f32", input_info("to_u8"), format::any, data_types::f32,
+ std::vector<float>(), reorder_mean_mode::subtract, padding(), true));
+
+ ExecutionConfig config = get_test_default_config(engine);
+ config.set_property(ov::intel_gpu::optimize_data(true));
+ network network(engine, topology, config);
+ network.set_input_data("input", input);
+
+ auto outputs = network.execute();
+
+ auto prog = network.get_program();
+ ASSERT_NE(prog, nullptr);
+ // The eltwise keeps storing f32 and the Convert to u8 stays. The select stores the truncated u8 value itself, and
+ // the Convert back to f32 stays.
+ ASSERT_EQ(has_node(*prog, "to_u8"), !select_producer);
+ ASSERT_TRUE(has_node(*prog, "producer"));
+ ASSERT_EQ(prog->get_node("producer").get_output_layout().data_type, select_producer ? data_types::u8 : data_types::f32);
+
+ // -86.5 -> -86 -> 170, -163.5 -> -163 -> 93, 300.5 -> 300 -> 44, 7.5 -> 7
+ const std::vector<float> expected = { 170.0f, 93.0f, 44.0f, 7.0f };
+ auto output = outputs.at("to_f32").get_memory();
+ cldnn::mem_lock<float, mem_lock_type::read> output_ptr(output, get_test_stream());
+ for (size_t i = 0; i < expected.size(); ++i) {
+ ASSERT_EQ(output_ptr[i], expected[i]) << "index " << i;
+ }
+}
+} // namespace
+
+TEST(remove_redundant_reorders, not_to_fuse_truncating_fp_to_int_reorder_to_prev) {
+ test_truncating_fp_to_int_to_fp_reorders(false);
+}
+
+TEST(remove_redundant_reorders, not_to_fuse_reorder_to_select_storing_truncated_int) {
+ test_truncating_fp_to_int_to_fp_reorders(true);
+}
+
TEST(remove_redundant_reorders, reorder_of_non_default_port) {
static const int32_t x_size = 2, y_size = 2, feature_num = 4, batch_num = 2;
auto& engine = get_test_engine();
diff --git a/src/plugins/intel_gpu/tests/unit/test_cases/eltwise_gpu_test.cpp b/src/plugins/intel_gpu/tests/unit/test_cases/eltwise_gpu_test.cpp
index f4ef80b5f65..f43325289b5 100644
--- a/src/plugins/intel_gpu/tests/unit/test_cases/eltwise_gpu_test.cpp
+++ b/src/plugins/intel_gpu/tests/unit/test_cases/eltwise_gpu_test.cpp
@@ -5138,6 +5138,60 @@ TEST(eltwise_gpu, vload8_rejects_blocked_feature_broadcast) {
test_vload8_feature_broadcast<ov::float16>(data_types::f16, false, tensor(2, 4, 16, 3), tensor(2, 1, 16, 3), false, false, false, format::b_fs_yx_fsv16);
}
+namespace {
+template <typename OutputT>
+void test_generic_ref_zeros_feature_padding_of_single_element_output(data_types output_type) {
+ // A single-element b_fs_yx_fsv16 output has one valid feature lane and 15 padding lanes. The padding-reset
+ // work-items of generic_eltwise_ref must store to their own lanes. OUTPUT_GET_INDEX of a single-element tensor is
+ // folded to the first element offset, so storing through it made every padding lane overwrite the result.
+ constexpr size_t feature_block_size = 16;
+ auto& engine = get_test_engine();
+
+ const layout in_layout{ov::PartialShape{1, 1, 1, 1}, data_types::f32, format::b_fs_yx_fsv16};
+ auto input = engine.allocate_memory(in_layout);
+ std::vector<float> input_data(in_layout.get_linear_size(), 0.0f);
+ input_data[0] = 3.0f;
+ set_values(input, input_data);
+ auto scale = engine.allocate_memory({ov::PartialShape{1, 1, 1, 1}, data_types::f32, format::bfyx});
+ set_values(scale, {0.5f});
+
+ topology topology(input_layout("input", in_layout),
+ data("scale", scale),
+ eltwise("eltwise", {input_info("input"), input_info("scale")}, eltwise_mode::prod, output_type));
+
+ ExecutionConfig config = get_test_default_config(engine);
+ config.set_property(ov::intel_gpu::force_implementations(ov::intel_gpu::ImplForcingMap{
+ {"eltwise", {format::b_fs_yx_fsv16, "generic_eltwise_ref", impl_types::ocl}},
+ }));
+ network network(engine, topology, config);
+ network.set_input_data("input", input);
+ ASSERT_NE(network.get_primitive_info("eltwise").find("generic_eltwise_ref"), std::string::npos);
+
+ // Fill the output with a dirty value to check that the padding lanes are reset.
+ auto eltwise_output = network.get_primitive("eltwise")->output_memory_ptr();
+ ASSERT_EQ(eltwise_output->get_layout().get_linear_size(), feature_block_size);
+ set_values(eltwise_output, std::vector<OutputT>(feature_block_size, OutputT(7.0f)));
+
+ auto outputs = network.execute();
+ auto output = outputs.at("eltwise").get_memory();
+ ASSERT_TRUE(engine.is_the_same_buffer(*eltwise_output, *output));
+ cldnn::mem_lock<OutputT, mem_lock_type::read> output_ptr(output, get_test_stream());
+ ASSERT_EQ(static_cast<float>(output_ptr[0]), 1.5f);
+ for (size_t lane = 1; lane < feature_block_size; ++lane) {
+ ASSERT_EQ(static_cast<float>(output_ptr[lane]), 0.0f) << "padding lane " << lane;
+ }
+}
+} // namespace
+
+TEST(eltwise_gpu, generic_ref_zeros_feature_padding_of_single_element_output_f32) {
+ test_generic_ref_zeros_feature_padding_of_single_element_output<float>(data_types::f32);
+}
+
+TEST(eltwise_gpu, generic_ref_zeros_feature_padding_of_single_element_output_f16) {
+ skip_if_no_fp16();
+ test_generic_ref_zeros_feature_padding_of_single_element_output<ov::float16>(data_types::f16);
+}
+
struct eltwise_layout_test_params {
eltwise_mode mode;
std::vector<ov::Dimension::value_type> input0_size;