diff --git a/cgmanifest.json b/cgmanifest.json index 25fbd37602..b76d46cc43 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -22,7 +22,7 @@ "component": { "type": "git", "git": { - "commitHash": "9bda90b7e5e08c4c37a832d0cea218aed6af6470", + "commitHash": "703bd9caab50b139428cea1aaff9974ebee5742e", "repositoryUrl": "https://github.com/google/googletest.git" } } diff --git a/cmake/external/googletest b/cmake/external/googletest index 9bda90b7e5..703bd9caab 160000 --- a/cmake/external/googletest +++ b/cmake/external/googletest @@ -1 +1 @@ -Subproject commit 9bda90b7e5e08c4c37a832d0cea218aed6af6470 +Subproject commit 703bd9caab50b139428cea1aaff9974ebee5742e diff --git a/onnxruntime/test/framework/execution_frame_test.cc b/onnxruntime/test/framework/execution_frame_test.cc index ee67b5b473..36fcc9c1cb 100644 --- a/onnxruntime/test/framework/execution_frame_test.cc +++ b/onnxruntime/test/framework/execution_frame_test.cc @@ -90,7 +90,8 @@ TEST_F(ExecutionFrameTest, TensorAllocationTest) { OrtValue* p_ml_value = frame.GetMutableNodeInputOrOutputMLValue(0); Tensor* p_tensor = p_ml_value ? p_ml_value->GetMutable() : nullptr; EXPECT_TRUE(p_tensor); - EXPECT_EQ(p_tensor->Shape(), shape); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + EXPECT_EQ(*reinterpret_cast*>(&p_tensor->Shape()), *reinterpret_cast*>(&shape)); EXPECT_EQ(p_tensor->DataType(), DataTypeImpl::GetType()); //test share memory from tensor @@ -106,7 +107,8 @@ TEST_F(ExecutionFrameTest, TensorAllocationTest) { const OrtValue* p_ml_value_const = frame.GetNodeInputOrOutputMLValue(1); auto tensor2 = p_ml_value_const ? &(p_ml_value_const->Get()) : nullptr; EXPECT_TRUE(tensor2); - EXPECT_EQ(tensor2->Shape(), shape2); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + EXPECT_EQ(*reinterpret_cast*>(&tensor2->Shape()), *reinterpret_cast*>(&shape2)); EXPECT_EQ(tensor2->template Data(), p_tensor->template Data()); } @@ -155,7 +157,8 @@ TEST_F(ExecutionFrameTest, FeedInDataTest) { OrtValue* p_ml_value = frame.GetMutableNodeInputOrOutputMLValue(0); Tensor* p_tensor_arg_0 = p_ml_value ? p_ml_value->GetMutable() : nullptr; EXPECT_TRUE(p_tensor_arg_0); - EXPECT_EQ(p_tensor_arg_0->Shape(), shape); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + EXPECT_EQ(*reinterpret_cast*>(&p_tensor_arg_0->Shape()), *reinterpret_cast*>(&shape)); EXPECT_EQ(p_tensor_arg_0->DataType(), DataTypeImpl::GetType()); EXPECT_EQ(p_tensor_arg_0->MutableData(), value.GetMutable()->MutableData()); } diff --git a/onnxruntime/test/framework/float_16_test.cc b/onnxruntime/test/framework/float_16_test.cc index c141ea817c..bb4ccc930a 100644 --- a/onnxruntime/test/framework/float_16_test.cc +++ b/onnxruntime/test/framework/float_16_test.cc @@ -122,7 +122,8 @@ void RunSession(InferenceSession& session_object, ASSERT_EQ(1, fetches.size()); auto& rtensor = fetches.front().Get(); TensorShape expected_shape(dims_y); - EXPECT_EQ(expected_shape, rtensor.Shape()); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + EXPECT_EQ(*reinterpret_cast*>(&expected_shape), *reinterpret_cast*>(&rtensor.Shape())); const std::vector found(rtensor.template Data(), rtensor.template Data() + expected_shape.Size()); ASSERT_EQ(found.size(), values_y.size()); for (size_t i = 0; i < found.size(); i++) diff --git a/onnxruntime/test/framework/inference_session_test.cc b/onnxruntime/test/framework/inference_session_test.cc index ca5e2f8d7d..411bba33d9 100644 --- a/onnxruntime/test/framework/inference_session_test.cc +++ b/onnxruntime/test/framework/inference_session_test.cc @@ -176,7 +176,8 @@ template void VerifyOutputs(const Tensor& tensor, const std::vector& expected_dims, const std::vector& expected_values) { TensorShape expected_shape(expected_dims); - ASSERT_EQ(expected_shape, tensor.Shape()); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + ASSERT_EQ(*reinterpret_cast*>(&expected_shape), *reinterpret_cast*>(&tensor.Shape())); const std::vector found(tensor.template Data(), tensor.template Data() + expected_values.size()); ASSERT_EQ(expected_values, found); @@ -1312,7 +1313,8 @@ TEST(InferenceSessionTests, TestTruncatedSequence) { ASSERT_EQ(1, fetches.size()); auto& rtensor = fetches.front().Get(); TensorShape expected_shape(Y_dims); - ASSERT_EQ(expected_shape, rtensor.Shape()); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + ASSERT_EQ(*reinterpret_cast*>(&expected_shape), *reinterpret_cast*>(&rtensor.Shape())); for (size_t i = 0; i < Y_data.size(); ++i) EXPECT_NEAR(Y_data[i], rtensor.template Data()[i], FLT_EPSILON); @@ -1354,7 +1356,8 @@ TEST(InferenceSessionTests, TestTruncatedSequence) { std::vector truncated_output_dims = Y_dims; truncated_output_dims[0] = truncated_len; TensorShape truncated_shape(truncated_output_dims); - ASSERT_EQ(truncated_shape, truncated_rtensor.Shape()); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + ASSERT_EQ(*reinterpret_cast*>(&truncated_shape), *reinterpret_cast*>(&truncated_rtensor.Shape())); auto seq_output_stride = truncated_shape.SizeFromDimension(1); for (int i = 0; i < truncated_shape.Size(); ++i) EXPECT_NEAR(Y_data[i + seq_start * seq_output_stride], truncated_rtensor.template Data()[i], FLT_EPSILON); diff --git a/onnxruntime/test/framework/local_kernel_registry_test.cc b/onnxruntime/test/framework/local_kernel_registry_test.cc index 09352e92b0..9ef4d4de9b 100644 --- a/onnxruntime/test/framework/local_kernel_registry_test.cc +++ b/onnxruntime/test/framework/local_kernel_registry_test.cc @@ -214,7 +214,8 @@ void RunSession(InferenceSession& session_object, ASSERT_EQ(1, fetches.size()); auto& rtensor = fetches.front().Get(); TensorShape expected_shape(dims_y); - EXPECT_EQ(expected_shape, rtensor.Shape()); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + EXPECT_EQ(*reinterpret_cast*>(&expected_shape), *reinterpret_cast*>(&rtensor.Shape())); const std::vector found(rtensor.template Data(), rtensor.template Data() + expected_shape.Size()); ASSERT_EQ(values_y, found); } diff --git a/onnxruntime/test/framework/tensor_test.cc b/onnxruntime/test/framework/tensor_test.cc index 1dea1a5e95..d6b20a4b41 100644 --- a/onnxruntime/test/framework/tensor_test.cc +++ b/onnxruntime/test/framework/tensor_test.cc @@ -21,7 +21,8 @@ void CPUTensorTest(std::vector dims, const int offset = 0) { EXPECT_TRUE(data); Tensor t(DataTypeImpl::GetType(), shape, data, alloc->Info(), offset); auto tensor_shape = t.Shape(); - EXPECT_EQ(shape, tensor_shape); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + EXPECT_EQ(*reinterpret_cast*>(&shape), *reinterpret_cast*>(&tensor_shape)); EXPECT_EQ(t.DataType(), DataTypeImpl::GetType()); auto& location = t.Location(); EXPECT_STREQ(location.name, CPU); @@ -36,7 +37,8 @@ void CPUTensorTest(std::vector dims, const int offset = 0) { Tensor new_t(DataTypeImpl::GetType(), shape, alloc, offset); tensor_shape = new_t.Shape(); - EXPECT_EQ(shape, tensor_shape); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + EXPECT_EQ(*reinterpret_cast*>(&shape), *reinterpret_cast*>(&tensor_shape)); EXPECT_EQ(new_t.DataType(), DataTypeImpl::GetType()); auto& new_location = new_t.Location(); ASSERT_STREQ(new_location.name, CPU); @@ -150,7 +152,8 @@ TEST(TensorTest, StringTensorTest) { Tensor t(DataTypeImpl::GetType(), shape, alloc); auto& tensor_shape = t.Shape(); - EXPECT_EQ(shape, tensor_shape); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + EXPECT_EQ(*reinterpret_cast*>(&shape), *reinterpret_cast*>(&tensor_shape)); EXPECT_EQ(t.DataType(), DataTypeImpl::GetType()); auto& location = t.Location(); ASSERT_STREQ(location.name, CPU); diff --git a/onnxruntime/test/optimizer/graph_transform_test.cc b/onnxruntime/test/optimizer/graph_transform_test.cc index 46e3682c0c..6bce5a239c 100644 --- a/onnxruntime/test/optimizer/graph_transform_test.cc +++ b/onnxruntime/test/optimizer/graph_transform_test.cc @@ -678,7 +678,8 @@ TEST(GraphTransformationTests, FuseConvBnAddMulFloat16) { ASSERT_EQ(1, fetches.size()); auto& rtensor = fetches.front().Get(); TensorShape expected_shape(expected_dims_prod); - ASSERT_EQ(expected_shape, rtensor.Shape()); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + ASSERT_EQ(*reinterpret_cast*>(&expected_shape), *reinterpret_cast*>(&rtensor.Shape())); const std::vector found(rtensor.template Data(), rtensor.template Data() + expected_dims_prod.size()); ASSERT_EQ(expected_values_prod, found); diff --git a/onnxruntime/test/providers/cpu/controlflow/loop_test.cc b/onnxruntime/test/providers/cpu/controlflow/loop_test.cc index e6813e2a07..b6e1660364 100644 --- a/onnxruntime/test/providers/cpu/controlflow/loop_test.cc +++ b/onnxruntime/test/providers/cpu/controlflow/loop_test.cc @@ -620,7 +620,8 @@ TEST(Loop, SubgraphInputShadowsOuterScopeValue) { auto& b_out = fetches[0].Get(); TensorShape expected_shape(scalar); - ASSERT_EQ(expected_shape, b_out.Shape()); + //Use reinterpret_cast to bypass a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 + ASSERT_EQ(*reinterpret_cast*>(&expected_shape), *reinterpret_cast*>(&b_out.Shape())); ASSERT_EQ(b_out.DataAsSpan()[0], expected_value_b); auto user_defined_vals_out = fetches[1].Get().DataAsSpan();