Fix issue in construction of DummyArena. (#3416)

This commit is contained in:
Pranav Sharma 2020-04-03 08:28:05 -07:00 committed by GitHub
parent 85131e760c
commit 14f4c3e25f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View file

@ -151,6 +151,13 @@ file(GLOB_RECURSE onnxruntime_test_providers_cpu_src CONFIGURE_DEPENDS
)
list(APPEND onnxruntime_test_providers_src ${onnxruntime_test_providers_cpu_src})
if (onnxruntime_USE_DNNL)
file(GLOB_RECURSE onnxruntime_test_providers_dnnl_src CONFIGURE_DEPENDS
"${TEST_SRC_DIR}/providers/dnnl/*"
)
list(APPEND onnxruntime_test_providers_src ${onnxruntime_test_providers_dnnl_src})
endif()
if (onnxruntime_USE_NGRAPH)
file(GLOB_RECURSE onnxruntime_test_providers_ngraph_src CONFIGURE_DEPENDS
"${TEST_SRC_DIR}/providers/ngraph/*"

View file

@ -37,7 +37,11 @@ class DummyArena : public IArenaAllocator {
public:
explicit DummyArena(std::unique_ptr<IDeviceAllocator> resource_allocator)
: allocator_(std::move(resource_allocator)),
info_(allocator_->Info().name, OrtAllocatorType::OrtArenaAllocator, allocator_->Info().device, allocator_->Info().id) {
info_(allocator_->Info().name,
OrtAllocatorType::OrtArenaAllocator,
allocator_->Info().device,
allocator_->Info().id,
allocator_->Info().mem_type) {
}
~DummyArena() override = default;

View file

@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "core/providers/dnnl/dnnl_execution_provider.h"
#include "gtest/gtest.h"
namespace onnxruntime {
namespace test {
TEST(DNNLExecutionProviderTest, MetadataTest) {
DNNLExecutionProviderInfo info;
info.create_arena = false;
auto provider = onnxruntime::make_unique<DNNLExecutionProvider>(info);
EXPECT_TRUE(provider != nullptr);
ASSERT_STREQ(provider->GetAllocator(0, OrtMemTypeCPUOutput)->Info().name, "DnnlCpu");
}
} // namespace test
} // namespace onnxruntime