mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-30 03:37:44 +00:00
Avoid command list reset in common case of re-used command list execution (#18370)
### Description <!-- Describe your changes. --> ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Co-authored-by: Jeff Bloomfield <jeffbloo@microsoft.com>
This commit is contained in:
parent
d5f3aae3fd
commit
531e875fb5
1 changed files with 18 additions and 0 deletions
|
|
@ -251,6 +251,24 @@ void DmlCommandRecorder::ExecuteCommandList(
|
|||
_Out_ uint64_t* completionValue
|
||||
)
|
||||
{
|
||||
if (!m_operationsRecordedInCurrentCommandList)
|
||||
{
|
||||
// The caller can re-use relevant resources after the next set of work to be
|
||||
// flushed has completed. Its command list hasn't been executed yet, just batched.
|
||||
GpuEvent gpuEvent = m_queue->GetNextCompletionEvent();
|
||||
gpuEvent.fence.CopyTo(fence);
|
||||
*completionValue = gpuEvent.fenceValue;
|
||||
|
||||
m_queue->ExecuteCommandLists(
|
||||
gsl::span<ID3D12CommandList*>(reinterpret_cast<ID3D12CommandList**>(&commandList), 1));
|
||||
|
||||
// Fail early if something horrifying happens
|
||||
ORT_THROW_IF_FAILED(m_dmlDevice->GetDeviceRemovedReason());
|
||||
ORT_THROW_IF_FAILED(m_d3dDevice->GetDeviceRemovedReason());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ORT_THROW_IF_FAILED(m_currentCommandList->Close());
|
||||
|
||||
if (m_operationsRecordedInCurrentCommandList)
|
||||
|
|
|
|||
Loading…
Reference in a new issue