From df7424e11fb55ac81efcbc8850f0ac89b8082a81 Mon Sep 17 00:00:00 2001 From: Yulong Wang <7679871+fs-eire@users.noreply.github.com> Date: Thu, 4 May 2023 07:51:17 -0700 Subject: [PATCH] [JSEP] fix constructor for OrtDevice (#15805) ### Description Add the missing `OrtDevice` initialization in JSEP introduced by #15618 --- onnxruntime/core/providers/js/js_execution_provider.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/onnxruntime/core/providers/js/js_execution_provider.cc b/onnxruntime/core/providers/js/js_execution_provider.cc index 2fba425b32..6d7ab8ae72 100644 --- a/onnxruntime/core/providers/js/js_execution_provider.cc +++ b/onnxruntime/core/providers/js/js_execution_provider.cc @@ -295,7 +295,7 @@ std::unique_ptr RegisterKernels() { using namespace js; JsExecutionProvider::JsExecutionProvider(const JsExecutionProviderInfo& info) - : IExecutionProvider{kJsExecutionProvider, true} { + : IExecutionProvider{kJsExecutionProvider, OrtDevice(OrtDevice::GPU, OrtDevice::MemType::DEFAULT, 0), true} { } // implement RegisterAllocator to test/validate sharing the CPU EP's allocator @@ -315,10 +315,9 @@ void JsExecutionProvider::RegisterAllocator(AllocatorManager& allocator_manager) InsertAllocator(cpu_alloc); } - OrtDevice custom_device{OrtDevice::GPU, OrtDevice::MemType::DEFAULT, 0}; auto custom_alloc = GetAllocator(OrtMemTypeDefault); if (!custom_alloc) { - custom_alloc = allocator_manager.GetAllocator(OrtMemTypeDefault, custom_device); + custom_alloc = allocator_manager.GetAllocator(OrtMemTypeDefault, default_device_); if (!custom_alloc) { AllocatorCreationInfo customAllocatorCreationInfo([&](int) { return std::make_unique();