From dfd4bce36e64c8b99513611e28a157fd456e23f2 Mon Sep 17 00:00:00 2001 From: maggie1059 <34173352+maggie1059@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:44:16 -0700 Subject: [PATCH] Use compute queues by default in DML EP (#20438) ### Description We originally only use compute queues for compute-only devices; this change sets the default for DX12 devices to use compute queues as well. ### Motivation and Context There have been issues with TDRs occurring when using the current default queues, which doesn't happen on compute queues. --- onnxruntime/core/providers/dml/dml_provider_factory.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/dml/dml_provider_factory.cc b/onnxruntime/core/providers/dml/dml_provider_factory.cc index 7a665ef82f..9a0b2fcc6c 100644 --- a/onnxruntime/core/providers/dml/dml_provider_factory.cc +++ b/onnxruntime/core/providers/dml/dml_provider_factory.cc @@ -542,7 +542,11 @@ static D3D12_COMMAND_LIST_TYPE CalculateCommandListType(ID3D12Device* d3d12_devi sizeof(feature_levels) )); - auto use_compute_command_list = (feature_levels.MaxSupportedFeatureLevel <= D3D_FEATURE_LEVEL_1_0_CORE); + // Use compute queue whenever possible on supported hardware to avoid TDR and maintain UI QoS + // Core and generic devices only have compute queues, DX11 has "immediate" submission, DX12 has both + auto use_compute_command_list = (feature_levels.MaxSupportedFeatureLevel <= D3D_FEATURE_LEVEL_1_0_CORE) || + (feature_levels.MaxSupportedFeatureLevel >= D3D_FEATURE_LEVEL_12_0); + if (use_compute_command_list) { return D3D12_COMMAND_LIST_TYPE_COMPUTE;