[JSEP] fix constructor for OrtDevice (#15805)

### Description
Add the missing `OrtDevice` initialization in JSEP introduced by #15618
This commit is contained in:
Yulong Wang 2023-05-04 07:51:17 -07:00 committed by GitHub
parent 33d1372729
commit df7424e11f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -295,7 +295,7 @@ std::unique_ptr<KernelRegistry> 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<js::JsCustomAllocator>();