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
[gpu] fix windows SEH exception issue (#33092)
Yazhan Maf1b45285fb7b
diff --git a/src/plugins/intel_gpu/src/plugin/ops/constant.cpp b/src/plugins/intel_gpu/src/plugin/ops/constant.cppindex 9f61dfe72ba..d0bc42a0116 100644--- a/src/plugins/intel_gpu/src/plugin/ops/constant.cpp+++ b/src/plugins/intel_gpu/src/plugin/ops/constant.cpp@@ -125,6 +125,23 @@ static void create_data(ProgramBuilder& p, const ov::Shape& const_shape, const sconst auto* f64data = op->get_data_ptr<double>();auto f32buf = reinterpret_cast<float*>(buf);f32buf[0] = static_cast<float>(f64data[0]);+ } else if (out_dtype == cldnn::data_types::f32 &&+ (op->get_output_element_type(0) == ov::element::u16 ||+ op->get_output_element_type(0) == ov::element::i16)) {+ size_t count = ov::shape_size(const_shape);+ auto f32buf = reinterpret_cast<float*>(buf);++ if (op->get_output_element_type(0) == ov::element::u16) {+ const auto* u16data = op->get_data_ptr<uint16_t>();+ for (size_t i = 0; i < count; i++) {+ f32buf[i] = static_cast<float>(u16data[i]);+ }+ } else {+ const auto* i16data = op->get_data_ptr<int16_t>();+ for (size_t i = 0; i < count; i++) {+ f32buf[i] = static_cast<float>(i16data[i]);+ }+ }} else {std::memcpy(&buf[0], &data[0], bufSize);}diff --git a/src/tests/functional/plugin/shared/include/shared_test_classes/subgraph/constant_result.hpp b/src/tests/functional/plugin/shared/include/shared_test_classes/subgraph/constant_result.hppindex 29ad2ccb282..374368ce4ab 100644--- a/src/tests/functional/plugin/shared/include/shared_test_classes/subgraph/constant_result.hpp+++ b/src/tests/functional/plugin/shared/include/shared_test_classes/subgraph/constant_result.hpp@@ -34,6 +34,7 @@ public:protected:void SetUp() override;+ void run() override;};} // namespace testdiff --git a/src/tests/functional/plugin/shared/src/subgraph/constant_result.cpp b/src/tests/functional/plugin/shared/src/subgraph/constant_result.cppindex 54b524a61dc..b83831d6ffa 100644--- a/src/tests/functional/plugin/shared/src/subgraph/constant_result.cpp+++ b/src/tests/functional/plugin/shared/src/subgraph/constant_result.cpp@@ -66,5 +66,49 @@ void ConstantResultSubgraphTest::SetUp() {createGraph(type, input_shape, input_type);}++void ConstantResultSubgraphTest::run() {+ compile_model();+ inferRequest = compiledModel.create_infer_request();+ ASSERT_TRUE(inferRequest);+ inferRequest.infer();++ const auto& [type, input_shape, input_type, _] = this->GetParam();+ if (input_type == ov::element::i16 || input_type == ov::element::u16) {+ auto outputs = function->get_results();+ for (size_t i = 0; i < outputs.size(); ++i) {+ auto result_tensor = inferRequest.get_tensor(outputs[i]);+ ASSERT_TRUE(result_tensor);++ auto constant_node = std::dynamic_pointer_cast<ov::op::v0::Constant>(+ outputs[i]->get_input_node_shared_ptr(0));+ ASSERT_TRUE(constant_node) << "Failed to get constant node for output " << i;++ size_t num_elements = result_tensor.get_size();+ ASSERT_EQ(result_tensor.get_element_type(), input_type)+ << "Output type mismatch for " << input_type;++ if (input_type == ov::element::i16) {+ auto expected_data = constant_node->get_data_ptr<int16_t>();+ auto actual_data = result_tensor.data<int16_t>();+ for (size_t j = 0; j < num_elements; ++j) {+ EXPECT_EQ(actual_data[j], expected_data[j])+ << "Mismatch at element " << j << "/" << num_elements+ << ": expected " << expected_data[j]+ << ", got " << actual_data[j];+ }+ } else {+ auto expected_data = constant_node->get_data_ptr<uint16_t>();+ auto actual_data = result_tensor.data<uint16_t>();+ for (size_t j = 0; j < num_elements; ++j) {+ EXPECT_EQ(actual_data[j], expected_data[j])+ << "Mismatch at element " << j << "/" << num_elements+ << ": expected " << expected_data[j]+ << ", got " << actual_data[j];+ }+ }+ }+ }+}} // namespace test} // namespace ov