mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Fix issue in construction of DummyArena. (#3416)
This commit is contained in:
parent
85131e760c
commit
14f4c3e25f
3 changed files with 29 additions and 1 deletions
|
|
@ -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/*"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in a new issue