Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
// Licensed under the MIT License.
 
#pragma once
 
#include <mutex>
#include <unordered_map>
 
#include "core/common/logging/logging.h"
#include "core/common/logging/sinks/cerr_sink.h"
#include "core/common/optional.h"
#include "core/framework/allocator.h"
#include "core/framework/session_options.h"
#include "core/session/environment.h"
#include "core/session/ort_env.h"
#include "core/session/abi_session_options_impl.h"
#include "core/session/inference_session.h"
#if defined(ENABLE_DLPACK)
#include "core/dlpack/dlpack_converter.h"
#endif
 
#include "onnxruntime_pybind.h"  // must use this for the include of <pybind11/pybind11.h>
 
// execution provider factory creator headers
struct OrtStatus {
  OrtErrorCode code;
  char msg[1];  // a null-terminated string
};
 
#define BACKEND_DEVICE BACKEND_PROC BACKEND_DNNL BACKEND_OPENVINO BACKEND_OPENBLAS BACKEND_MIGRAPHX BACKEND_ACL BACKEND_DML BACKEND_CANN BACKEND_WEBGPU
#include "core/session/onnxruntime_cxx_api.h"
#include "core/providers/providers.h"
#include "core/providers/provider_factory_creators.h"
#include "core/providers/tensorrt/tensorrt_provider_options.h"
#include "core/providers/nv_tensorrt_rtx/nv_provider_options.h"
 
#if defined(USE_CUDA)
#define BACKEND_PROC "GPU"
#else
#define BACKEND_PROC "CPU"
#endif
 
#ifdef USE_DNNL
#define BACKEND_DNNL "-DNNL"
#else
#define BACKEND_DNNL ""
#endif
 
#if defined(USE_MIGRAPHX) || defined(USE_MIGRAPHX_PROVIDER_INTERFACE)
#define BACKEND_MIGRAPHX "-MIGRAPHX"
#else
#define BACKEND_MIGRAPHX ""
#endif
 
#if defined(USE_OPENVINO) || defined(USE_OPENVINO_PROVIDER_INTERFACE)
#if OPENVINO_CONFIG_CPU
#define BACKEND_OPENVINO "-OPENVINO_CPU"
 
#elif OPENVINO_CONFIG_GPU
#define BACKEND_OPENVINO "-OPENVINO_GPU"
 
#elif OPENVINO_CONFIG_NPU
#define BACKEND_OPENVINO "-OPENVINO_NPU"
 
#elif OPENVINO_CONFIG_MULTI
#define BACKEND_OPENVINO "-OPENVINO_MULTI"
 
#elif OPENVINO_CONFIG_AUTO
#define BACKEND_OPENVINO "-OPENVINO_AUTO"
 
#elif OPENVINO_CONFIG_HETERO
#define BACKEND_OPENVINO "-OPENVINO_HETERO"
 
#elif OPENVINO_DISABLE_NPU_FALLBACK
#define BACKEND_OPENVINO "-OPENVINO_DISABLE_NPU_FALLBACK"
 
#else
#define BACKEND_OPENVINO ""
#endif  // OPENVINO_CONFIG_*
 
#else
#define BACKEND_OPENVINO ""
#endif  // defined(USE_OPENVINO) || defined(USE_OPENVINO_PROVIDER_INTERFACE)
 
#if USE_OPENBLAS
#define BACKEND_OPENBLAS "-OPENBLAS"
#else
#define BACKEND_OPENBLAS ""
#endif
 
#if USE_ACL
#define BACKEND_ACL "-ACL"
#else
#define BACKEND_ACL ""
#endif
 
#if USE_DML
#define BACKEND_DML "-DML"
#else
#define BACKEND_DML ""
#endif
 
#if USE_CANN
#define BACKEND_CANN "-CANN"
#else
#define BACKEND_CANN ""
#endif
 
#if USE_WEBGPU
#define BACKEND_WEBGPU "-WEBGPU"
#else
#define BACKEND_WEBGPU ""
#endif
 
#if defined(USE_CUDA) || defined(USE_CUDA_PROVIDER_INTERFACE)
#include "core/providers/cuda/cuda_provider_factory.h"
#include "core/providers/cuda/cuda_execution_provider_info.h"
#endif
#if defined(USE_TENSORRT) || defined(USE_TENSORRT_PROVIDER_INTERFACE)
#include "core/providers/tensorrt/tensorrt_provider_factory.h"
#endif
#if defined(USE_NV) || defined(USE_NV_PROVIDER_INTERFACE)
#include "core/providers/nv_tensorrt_rtx/nv_provider_factory.h"
#endif
#if defined(USE_MIGRAPHX) || defined(USE_MIGRAPHX_PROVIDER_INTERFACE)
#include "core/providers/migraphx/migraphx_provider_factory.h"
#include "core/providers/migraphx/migraphx_execution_provider_info.h"
#endif
#if defined(USE_OPENVINO) || defined(USE_OPENVINO_PROVIDER_INTERFACE)
#include "core/providers/openvino/openvino_provider_factory.h"
// TODO remove deprecated global config
namespace onnxruntime {
ProviderInfo_OpenVINO* TryGetProviderInfo_OpenVINO();
namespace python {
extern std::string openvino_device_type;
}
}  // namespace onnxruntime
#endif
#ifdef USE_ACL
#include "core/providers/acl/acl_provider_factory.h"
#endif
#ifdef USE_DML
#include "core/providers/dml/dml_provider_factory.h"
#endif
#ifdef USE_CANN
#include "core/providers/cann/cann_provider_factory.h"
#include "core/providers/cann/cann_execution_provider_info.h"
#endif
 
#if defined(USE_CUDA) || defined(USE_CUDA_PROVIDER_INTERFACE)
namespace onnxruntime {
ProviderInfo_CUDA* TryGetProviderInfo_CUDA();
ProviderInfo_CUDA& GetProviderInfo_CUDA();
namespace python {
// TODO remove deprecated global config
extern OrtCudnnConvAlgoSearch cudnn_conv_algo_search;
// TODO remove deprecated global config
extern bool do_copy_in_default_stream;
// TODO remove deprecated global config
extern onnxruntime::cuda::TunableOpInfo tunable_op;
extern onnxruntime::CUDAExecutionProviderExternalAllocatorInfo external_allocator_info;
}  // namespace python
}  // namespace onnxruntime
#endif
 
#if defined(USE_TENSORRT) || defined(USE_TENSORRT_PROVIDER_INTERFACE)
namespace onnxruntime {
ProviderInfo_TensorRT* TryGetProviderInfo_TensorRT();
ProviderInfo_TensorRT& GetProviderInfo_TensorRT();
}  // namespace onnxruntime
#endif
 
#if defined(USE_NV) || defined(USE_NV_PROVIDER_INTERFACE)
namespace onnxruntime {
ProviderInfo_Nv* TryGetProviderInfo_Nv();
ProviderInfo_Nv& GetProviderInfo_Nv();
}  // namespace onnxruntime
#endif
 
#ifdef USE_CANN
namespace onnxruntime {
ProviderInfo_CANN* TryGetProviderInfo_CANN();
ProviderInfo_CANN& GetProviderInfo_CANN();
}  // namespace onnxruntime
#endif
 
#if defined(USE_MIGRAPHX) || defined(USE_CUDA) || defined(USE_CUDA_PROVIDER_INTERFACE)
namespace onnxruntime {
namespace python {
extern onnxruntime::ArenaExtendStrategy arena_extend_strategy;
}  // namespace python
}  // namespace onnxruntime
#endif
 
#ifdef USE_MIGRAPHX
namespace onnxruntime {
ProviderInfo_MIGraphX* TryGetProviderInfo_MIGraphX();
ProviderInfo_MIGraphX& GetProviderInfo_MIGraphX();
namespace python::migraphx::external {
extern void* alloc_fn;
extern void* free_fn;
extern void* empty_cache_fn;
inline bool UseExternalAllocator() {
  return alloc_fn != nullptr && free_fn != nullptr;
}
}  // namespace python::migraphx::external
}  // namespace onnxruntime
 
#endif
 
#include "core/providers/dnnl/dnnl_provider_factory.h"
#include "core/providers/shared_library/provider_host_api.h"
#include "onnxruntime_pybind_module_functions.h"
namespace onnxruntime {
#if !defined(SHARED_PROVIDER) && !defined(DISABLE_SPARSE_TENSORS)
class SparseTensor;
#endif
namespace python {
 
// TODO remove deprecated global config
extern OrtDevice::DeviceId cuda_device_id;
// TODO remove deprecated global config
extern size_t gpu_mem_limit;
 
struct PyEpContextDataReadRegistration;
struct PyEpSelectionRegistration;
 
#if !defined(ORT_MINIMAL_BUILD)
using PyEpSelectionDelegate =
    std::function<std::vector<const OrtEpDevice*>(const std::vector<const OrtEpDevice*>& ep_devices,
                                                  const std::map<std::string, std::string>& model_metadata,
                                                  const std::map<std::string, std::string>& runtime_metadata,
                                                  size_t max_selections)>;
 
struct PyEpSelectionRegistration {
  PyEpSelectionDelegate delegate;
};
#endif
 
// Thin wrapper over internal C OrtSessionOptions to store additional state.
struct PySessionOptions : public OrtSessionOptions {
  PySessionOptions() = default;
 
  PySessionOptions(const PySessionOptions& other)
      : OrtSessionOptions(static_cast<const OrtSessionOptions&>(other)) {
    std::lock_guard<std::mutex> lock{other.py_callback_mutex};
    py_ep_selection_registration = other.py_ep_selection_registration;
    py_ep_context_data_read_registration = other.py_ep_context_data_read_registration;
 
    if (py_ep_selection_registration) {
      value.ep_selection_policy.state = py_ep_selection_registration.get();
    }
 
    if (py_ep_context_data_read_registration) {
      value.ep_context_data_read_state = py_ep_context_data_read_registration.get();
    }
  }
 
  mutable std::mutex py_callback_mutex;
  std::shared_ptr<PyEpSelectionRegistration> py_ep_selection_registration;
  std::shared_ptr<PyEpContextDataReadRegistration> py_ep_context_data_read_registration;
};
 
struct PySessionOptionsSnapshot {
  OrtSessionOptions options;
  std::shared_ptr<PyEpSelectionRegistration> py_ep_selection_registration;
  std::shared_ptr<PyEpContextDataReadRegistration> py_ep_context_data_read_registration;
};
 
inline PySessionOptionsSnapshot CreatePySessionOptionsSnapshot(const PySessionOptions& session_options) {
  std::lock_guard<std::mutex> lock{session_options.py_callback_mutex};
  PySessionOptionsSnapshot snapshot{
      static_cast<const OrtSessionOptions&>(session_options),
      session_options.py_ep_selection_registration,
      session_options.py_ep_context_data_read_registration};
 
  if (snapshot.py_ep_selection_registration) {
    snapshot.options.value.ep_selection_policy.state = snapshot.py_ep_selection_registration.get();
  }
 
  if (snapshot.py_ep_context_data_read_registration) {
    snapshot.options.value.ep_context_data_read_state = snapshot.py_ep_context_data_read_registration.get();
  }
 
  return snapshot;
}
 
// Thin wrapper over internal C++ InferenceSession to accommodate custom op library management for the Python user
struct PyInferenceSession {
  PyInferenceSession(OrtEnv& env, const OrtSessionOptions& so,
                     std::shared_ptr<PyEpSelectionRegistration> py_ep_selection_registration,
                     std::shared_ptr<PyEpContextDataReadRegistration> py_ep_context_data_read_registration)
      : py_ep_selection_registration_(std::move(py_ep_selection_registration)),
        py_ep_context_data_read_registration_(std::move(py_ep_context_data_read_registration)),
        session_options_(so) {
    sess_ = std::make_unique<InferenceSession>(so.value, env.GetEnvironment());
  }
 
#if !defined(ORT_MINIMAL_BUILD)
  PyInferenceSession(OrtEnv& env, const OrtSessionOptions& so,
                     std::shared_ptr<PyEpSelectionRegistration> py_ep_selection_registration,
                     std::shared_ptr<PyEpContextDataReadRegistration> py_ep_context_data_read_registration,
                     const std::string& arg, bool is_arg_file_name)
      : py_ep_selection_registration_(std::move(py_ep_selection_registration)),
        py_ep_context_data_read_registration_(std::move(py_ep_context_data_read_registration)),
        session_options_(so) {
    if (is_arg_file_name) {
      // Given arg is the file path. Invoke the corresponding ctor().
      sess_ = std::make_unique<InferenceSession>(so.value, env.GetEnvironment(), arg);
    } else {
      // Given arg is the model content as bytes. Invoke the corresponding ctor().
      std::istringstream buffer(arg);
      sess_ = std::make_unique<InferenceSession>(so.value, env.GetEnvironment(), buffer);
    }
  }
#endif
 
  // Returns true if the session options have provider information from either
  // setting explicit providers, setting a provider that supports a OrtEpDevice(s), or
  // setting a selection policy (e.g., prefer gpu).
  bool HasProvidersInSessionOptions() const {
    return !session_options_.provider_factories.empty() ||
           session_options_.value.ep_selection_policy.enable;
  }
 
  // Returns (and updates) a reference to the OrtSessionOptions for this inference session.
  OrtSessionOptions& GetOrtSessionOptions() {
    if (sess_) {
      // Copy internal value from InferenceSession as it is the source of truth
      // and the option configurations may have changed.
      session_options_.value = sess_->GetSessionOptions();
    }
    return session_options_;
  }
 
  InferenceSession* GetSessionHandle() const { return sess_.get(); }
 
  const std::shared_ptr<PyEpSelectionRegistration>& GetEpSelectionRegistration() const {
    return py_ep_selection_registration_;
  }
 
  const std::shared_ptr<PyEpContextDataReadRegistration>& GetEpContextDataReadRegistration() const {
    return py_ep_context_data_read_registration_;
  }
 
  Status BeginInitialization() {
    std::lock_guard<std::mutex> lock{initialization_mutex_};
    ORT_RETURN_IF(initialization_in_progress_, "Session initialization is already in progress.");
    initialization_in_progress_ = true;
    return Status::OK();
  }
 
  void EndInitialization() noexcept {
    std::lock_guard<std::mutex> lock{initialization_mutex_};
    initialization_in_progress_ = false;
  }
 
  virtual ~PyInferenceSession() = default;
 
 protected:
  PyInferenceSession(std::unique_ptr<InferenceSession> sess)
      : sess_(std::move(sess)) {
  }
 
 private:
  std::shared_ptr<PyEpSelectionRegistration> py_ep_selection_registration_;
  std::shared_ptr<PyEpContextDataReadRegistration> py_ep_context_data_read_registration_;
  OrtSessionOptions session_options_;
  std::mutex initialization_mutex_;
  bool initialization_in_progress_{false};
  std::unique_ptr<InferenceSession> sess_;
};
 
inline const PySessionOptions& GetDefaultCPUSessionOptions() {
  static PySessionOptions so;
  return so;
}
 
inline AllocatorPtr& GetAllocator() {
  static AllocatorPtr alloc = CPUAllocator::DefaultInstance();
  return alloc;
}
 
#if !defined(DISABLE_SPARSE_TENSORS)
// This class exposes SparseTensor to Python
// The class serves two major purposes
// - to be able to map numpy arrays memory and use it on input, this serves as a reference holder
//   so incoming arrays do not disappear. To this end we create an instance of SparseTensor
//   on top of the user provided numpy arrays and create a duplicate of py::objects for those
//   numpy array for ref-counting purposes and store it here.
//
// - to be able to expose SparseTensor returned from run method. We get an OrtValue from run()
//   and store a copy of it in ort_value_. The OrtValue shared_ptr ref-counting will make sure
//   the memory stays around.
//
//   An object of the class must never have both instance_ and ort_value_ have data at the same time.
class PySparseTensor {
 public:
  /// <summary>
  /// Use this constructor when you created a SparseTensor instance which is backed
  /// by python array storage and it important that they stay alive while this object is
  /// alive
  /// </summary>
  /// <param name="instance">a fully constructed and populated instance of SparseTensor</param>
  /// <param name="storage">a collection reference guards</param>
  PySparseTensor(std::unique_ptr<SparseTensor>&& instance,
                 std::vector<pybind11::object>&& storage)
      : instance_(std::move(instance)), backing_storage_(std::move(storage)), ort_value_() {
  }
 
  /// <summary>
  /// Same as above but no backing storage as SparseTensor owns the memory
  /// </summary>
  /// <param name="instance"></param>
  explicit PySparseTensor(std::unique_ptr<SparseTensor>&& instance)
      : instance_(std::move(instance)), backing_storage_(), ort_value_() {
  }
 
  /// <summary>
  /// Edge case when we can not copy memory on GPU and therefore
  /// can not own it.
  /// </summary>
  /// <param name="ort_value"></param>
  explicit PySparseTensor(const OrtValue& ort_value)
      : instance_(), backing_storage_(), ort_value_(ort_value) {}
 
  PySparseTensor(const PySparseTensor&) = delete;
  PySparseTensor& operator=(const PySparseTensor&) = delete;
 
  PySparseTensor(PySparseTensor&& o) noexcept {
    *this = std::move(o);
  }
 
  PySparseTensor& operator=(PySparseTensor&& o) noexcept {
    instance_ = std::move(o.instance_);
    backing_storage_ = std::move(o.backing_storage_);
    ort_value_ = std::move(o.ort_value_);
    return *this;
  }
 
  ~PySparseTensor();
 
  const SparseTensor& Instance() const {
    if (instance_) {
      return *instance_;
    }
    return ort_value_.Get<SparseTensor>();
  }
 
  std::unique_ptr<OrtValue> AsOrtValue() const;
 
 private:
  // instance_ represents data that comes as input. Thus we depend on numpy
  // arrays that own the underlying memory to stay around. We store copies
  // of py::objects for those arrays in backing_storage_ as an extra ref-count.
 
  // If we have and are able to copy from the OrtValue returned by run() to CPU, then this owns the data
  // and backing_storage_ is empty.
  std::unique_ptr<SparseTensor> instance_;
  std::vector<pybind11::object> backing_storage_;
 
  // We create a copy of OrtValue when we obtain it from a run method.
  OrtValue ort_value_;
};
#endif  // !defined(DISABLE_SPARSE_TENSORS)
 
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push)
// You can attempt to make 'onnxruntime::python::SessionObjectInitializer::Get' constexpr
#pragma warning(disable : 26497)
#endif
class SessionObjectInitializer {
 public:
  typedef const PySessionOptions& Arg1;
  // typedef logging::LoggingManager* Arg2;
  static const std::string default_logger_id;
  operator Arg1() {
    return GetDefaultCPUSessionOptions();
  }
 
  // operator Arg2() {
  //   static LoggingManager default_logging_manager{std::unique_ptr<ISink>{new CErrSink{}},
  //                                                 Severity::kWARNING, false, LoggingManager::InstanceType::Default,
  //                                                 &default_logger_id};
  //   return &default_logging_manager;
  // }
 
  static SessionObjectInitializer Get() {
    return SessionObjectInitializer();
  }
};
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(pop)
#endif
 
void SetGlobalThreadingOptions(const OrtThreadingOptions&& tp_options);
bool CheckIfUsingGlobalThreadPool();
Environment& GetEnv();
OrtEnv* GetOrtEnv();
 
// Initialize an InferenceSession.
// Any provider_options should have entries in matching order to provider_types.
void InitializeSession(InferenceSession* sess,
                       ExecutionProviderRegistrationFn ep_registration_fn,
                       const std::vector<std::string>& provider_types = {},
                       const ProviderOptionsVector& provider_options = {},
                       const std::unordered_set<std::string>& disabled_optimizer_names = {});
 
// Checks if PyErrOccured, fetches status and throws.
void ThrowIfPyErrOccured();
 
void addOrtValueMethods(pybind11::module& m);
 
void addIoBindingMethods(pybind11::module& m);
 
void addSparseTensorMethods(pybind11::module& m);
 
void addAdapterFormatMethods(pybind11::module& m);
 
void addGlobalSchemaFunctions(pybind11::module& m);
 
void addOpKernelSubmodule(pybind11::module& m);
 
void addOpSchemaSubmodule(pybind11::module& m);
 
const char* GetDeviceName(const OrtDevice& device);
 
// Allocator name for an OrtMemoryInfo. Differs from GetDeviceName only for WebGPU, whose
// GPU device carries no vendor id and so would otherwise be named CUDA.
const char* GetDeviceAllocatorName(const OrtDevice& device);
 
bool IsCudaDeviceIdValid(const onnxruntime::logging::Logger& logger, int id);
 
AllocatorPtr GetCudaAllocator(OrtDevice::DeviceId id);
 
bool CheckIfTensor(const std::vector<const NodeArg*>& def_list,
                   const std::string& name,
                   /*out*/ ONNX_NAMESPACE::TypeProto& type_proto);
 
#if defined(ENABLE_DLPACK)
 
// Allocate a new Capsule object, which takes the ownership of OrtValue.
// Caller is responsible for releasing.
// This function calls OrtValueToDlpack(...).
PyObject* ToDlpack(OrtValue ort_value);
 
// Consume a Capsule object and claims the ownership of its underlying tensor to
// create a OrtValue. This function calls DlpackToOrtValue(...) to do the conversion.
OrtValue FromDlpack(PyObject* dlpack_tensor, const bool is_bool_tensor);
 
// Destructor for Capsule object holding a DLPack structure.
void DlpackCapsuleDestructor(PyObject* data);
 
#endif
 
}  // namespace python
 
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_Tensorrt(const OrtTensorRTProviderOptions* params);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_Tensorrt(const OrtTensorRTProviderOptionsV2* params);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_Tensorrt(int device_id);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_MIGraphX(const OrtMIGraphXProviderOptions* params);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_MIGraphX(int device_id);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_Cuda(const OrtCUDAProviderOptions* params);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_Dnnl(const OrtDnnlProviderOptions* params);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_ACL(bool enable_fast_math);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_DML(int device_id);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_Nnapi(
    uint32_t flags, const optional<std::string>& partitioning_stop_ops_list);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_VSINPU();
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_Rknpu();
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_CoreML(uint32_t flags);
}  // namespace onnxruntime