onnxruntime/winml/lib/Api.Ort/OnnxruntimeDmlSessionBuilder.h
Sheil Kumar 6255194659
All LearningModelSessions created from a common LearningModelDevice should share the same thread pool (#11457)
* Share thread pools between devices

* make tests reuse device

* Change cpu thread pool options for dml sessions to use 1 thread with no spinning

* fix test failure

* Update missing type constraints for dft

* Add comment and rename inference session parameter

* default missing causing inconsistent test behavior

Co-authored-by: Sheil Kumar <sheilk@microsoft.com>
2022-05-13 11:12:43 -07:00

37 lines
No EOL
1.2 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "OnnxruntimeSessionBuilder.h"
namespace _winml {
class OnnxruntimeEngineFactory;
class OnnxruntimeDmlSessionBuilder : public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
IOrtSessionBuilder> {
public:
HRESULT RuntimeClassInitialize(OnnxruntimeEngineFactory* engine_factory, ID3D12Device* device, ID3D12CommandQueue* queue, bool metacommands_enabled_);
HRESULT STDMETHODCALLTYPE CreateSessionOptions(
OrtSessionOptions** options) override;
HRESULT STDMETHODCALLTYPE CreateSession(
OrtSessionOptions* options,
OrtThreadPool* inter_op_thread_pool,
OrtThreadPool* intra_op_thread_pool,
OrtSession** session) override;
HRESULT STDMETHODCALLTYPE Initialize(
OrtSession* session) override;
private:
Microsoft::WRL::ComPtr<OnnxruntimeEngineFactory> engine_factory_;
winrt::com_ptr<ID3D12Device> device_;
winrt::com_ptr<ID3D12CommandQueue> queue_;
bool metacommands_enabled_ = true;
};
} // namespace _winml