mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-28 20:11:22 +00:00
Temporarily flush and sync weight copies before initialization
This commit is contained in:
parent
d7b7e4b010
commit
789eb66fda
4 changed files with 12 additions and 0 deletions
|
|
@ -946,6 +946,13 @@ namespace Dml
|
|||
assert(!m_closed);
|
||||
m_context->Flush();
|
||||
}
|
||||
|
||||
void __stdcall ExecutionProviderImpl::FlushAndSync() const
|
||||
{
|
||||
Flush();
|
||||
m_context->GetCurrentCompletionEvent().WaitForSignal();
|
||||
m_context->ReleaseCompletedReferences();
|
||||
}
|
||||
|
||||
void ExecutionProviderImpl::SetDefaultRoundingMode(AllocatorRoundingMode roundingMode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ namespace Dml
|
|||
|
||||
STDMETHOD_(D3D12_COMMAND_LIST_TYPE, GetCommandListTypeForQueue)() const override;
|
||||
STDMETHOD_(void, Flush)() const override;
|
||||
STDMETHOD_(void, FlushAndSync)() const override;
|
||||
|
||||
void SetDefaultRoundingMode(AllocatorRoundingMode roundingMode);
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ namespace Dml
|
|||
m_persistentResourceBinding = DML_BUFFER_BINDING { m_persistentResource.Get(), 0, persistentResourceSize };
|
||||
}
|
||||
|
||||
// For temporary prototyping, allow weight upload to complete before issuing initialization work which reads those weights
|
||||
m_provider->FlushAndSync();
|
||||
|
||||
ORT_THROW_IF_FAILED(m_provider->InitializeOperator(
|
||||
m_compiledExecutionPlanOperator.Get(),
|
||||
m_persistentResourceBinding ? &*m_persistentResourceBinding : nullptr,
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ namespace Dml
|
|||
|
||||
STDMETHOD_(D3D12_COMMAND_LIST_TYPE, GetCommandListTypeForQueue)() const noexcept = 0;
|
||||
STDMETHOD_(void, Flush)() const noexcept = 0;
|
||||
STDMETHOD_(void, FlushAndSync)() const noexcept = 0;
|
||||
|
||||
STDMETHOD_(ID3D12Resource*, DecodeResource)(void* allocation) const noexcept = 0;
|
||||
STDMETHOD(AllocatePooledResource(size_t size, AllocatorRoundingMode roundingMode, ID3D12Resource **d3dResource, IUnknown* *pooledResource)) const noexcept = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue