mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Document generation for operator kernels, enable internal overload of DML EP to initialize on software-only devices (#13428)
### Description The documentation pipeline does not require an actual GPU, and running on GPU-capable agents costs more. So to enable running on CPU-only devices and to potentially consolidate future pipelines, and since the tests are not actually executed on this device anyway (it just needs to initialize the EP for the sake of operator kernel enumeration), add an initialization flag to skip the software device check - this is only an internal overload not exposed in the public API. See https://github.com/microsoft/onnxruntime/pull/13308. ### Motivation and Context - *If it fixes an open issue, please link to the issue here.* NA
This commit is contained in:
parent
d80212d42c
commit
0201cd75e1
3 changed files with 13 additions and 3 deletions
|
|
@ -105,6 +105,10 @@ bool IsSoftwareAdapter(IDXGIAdapter1* adapter) {
|
|||
}
|
||||
|
||||
std::shared_ptr<IExecutionProviderFactory> DMLProviderFactoryCreator::Create(int device_id) {
|
||||
return Create(device_id, /*skip_software_device_check*/ false);
|
||||
}
|
||||
|
||||
std::shared_ptr<IExecutionProviderFactory> DMLProviderFactoryCreator::Create(int device_id, bool skip_software_device_check) {
|
||||
#ifdef _GAMING_XBOX
|
||||
ComPtr<ID3D12Device> d3d12_device;
|
||||
D3D12XBOX_CREATE_DEVICE_PARAMETERS params = {};
|
||||
|
|
@ -120,8 +124,13 @@ std::shared_ptr<IExecutionProviderFactory> DMLProviderFactoryCreator::Create(int
|
|||
ComPtr<IDXGIAdapter1> adapter;
|
||||
ORT_THROW_IF_FAILED(dxgi_factory->EnumAdapters1(device_id, &adapter));
|
||||
|
||||
// Disallow using DML with the software adapter (Microsoft Basic Display Adapter) because CPU evaluations are much faster
|
||||
ORT_THROW_HR_IF(E_INVALIDARG, IsSoftwareAdapter(adapter.Get()));
|
||||
// Disallow using DML with the software adapter (Microsoft Basic Display Adapter) because CPU evaluations are much
|
||||
// faster. Some scenarios though call for EP initialization without this check (as execution will not actually occur
|
||||
// anyway) such as operation kernel registry enumeration for documentation purposes.
|
||||
if (!skip_software_device_check)
|
||||
{
|
||||
ORT_THROW_HR_IF(E_INVALIDARG, IsSoftwareAdapter(adapter.Get()));
|
||||
}
|
||||
|
||||
ComPtr<ID3D12Device> d3d12_device;
|
||||
ORT_THROW_IF_FAILED(D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_GRAPHICS_PPV_ARGS(d3d12_device.ReleaseAndGetAddressOf())));
|
||||
|
|
|
|||
|
|
@ -10,5 +10,6 @@
|
|||
namespace onnxruntime {
|
||||
struct DMLProviderFactoryCreator {
|
||||
static std::shared_ptr<IExecutionProviderFactory> Create(int device_id);
|
||||
static std::shared_ptr<IExecutionProviderFactory> Create(int device_id, bool skip_software_device_check);
|
||||
};
|
||||
} // namespace onnxruntime
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void addGlobalSchemaFunctions(pybind11::module& m) {
|
|||
onnxruntime::ArmNNProviderFactoryCreator::Create(0),
|
||||
#endif
|
||||
#ifdef USE_DML
|
||||
onnxruntime::DMLProviderFactoryCreator::Create(0),
|
||||
onnxruntime::DMLProviderFactoryCreator::Create(0, /*skip_software_device_check*/ true),
|
||||
#endif
|
||||
#ifdef USE_NNAPI
|
||||
onnxruntime::NnapiProviderFactoryCreator::Create(0),
|
||||
|
|
|
|||
Loading…
Reference in a new issue