Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#include "core/session/plugin_ep/ep_library_internal.h"
#include "core/session/plugin_ep/ep_factory_coreml.h"
#include "core/session/plugin_ep/ep_factory_cpu.h"
#include "core/session/plugin_ep/ep_factory_dml.h"
#include "core/session/plugin_ep/ep_factory_webgpu.h"
 
namespace onnxruntime {
 
std::unique_ptr<EpLibraryInternal> EpLibraryInternal::CreateCpuEp() {
  auto cpu_factory_impl = std::make_unique<CpuEpFactory>();
  auto internal_factory = std::make_unique<EpFactoryInternal>(std::move(cpu_factory_impl));
  return std::make_unique<EpLibraryInternal>(std::move(internal_factory));
}
 
#if defined(USE_COREML) && defined(__APPLE__)
std::unique_ptr<EpLibraryInternal> EpLibraryInternal::CreateCoreMLEp() {
  auto coreml_factory_impl = std::make_unique<CoreMLEpFactory>();
  auto internal_factory = std::make_unique<EpFactoryInternal>(std::move(coreml_factory_impl));
  return std::make_unique<EpLibraryInternal>(std::move(internal_factory));
}
#endif
 
#if defined(USE_DML)
 
std::unique_ptr<EpLibraryInternal> EpLibraryInternal::CreateDmlEp() {
  auto dml_factory_impl = std::make_unique<DmlEpFactory>();
  auto internal_factory = std::make_unique<EpFactoryInternal>(std::move(dml_factory_impl));
  return std::make_unique<EpLibraryInternal>(std::move(internal_factory));
}
#endif
 
#if defined(USE_WEBGPU) && !defined(ORT_USE_EP_API_ADAPTERS)
std::unique_ptr<EpLibraryInternal> EpLibraryInternal::CreateWebGpuEp(bool allow_virtual_devices) {
  auto webgpu_factory_impl = std::make_unique<WebGpuEpFactory>(allow_virtual_devices);
  auto internal_factory = std::make_unique<EpFactoryInternal>(std::move(webgpu_factory_impl));
  return std::make_unique<EpLibraryInternal>(std::move(internal_factory));
}
#endif
 
std::vector<std::unique_ptr<EpLibraryInternal>> EpLibraryInternal::CreateInternalEps(bool allow_virtual_devices) {
  std::vector<std::unique_ptr<EpLibraryInternal>> internal_eps;
  internal_eps.reserve(4);
 
  // CPU EP
  internal_eps.push_back(CreateCpuEp());
 
#if defined(USE_WEBGPU) && !defined(ORT_USE_EP_API_ADAPTERS)
  internal_eps.push_back(CreateWebGpuEp(allow_virtual_devices));
#else
  ORT_UNUSED_PARAMETER(allow_virtual_devices);
#endif
 
#if defined(USE_DML)
  internal_eps.push_back(CreateDmlEp());
#endif
 
// Unlike WebGPU, CoreML has no plugin-EP adapter, so it does not need an ORT_USE_EP_API_ADAPTERS exclusion.
// This matches DML.
#if defined(USE_COREML) && defined(__APPLE__)
  internal_eps.push_back(CreateCoreMLEp());
#endif
 
  return internal_eps;
}
 
}  // namespace onnxruntime