From 8a5007cc5dc4672a28df6083b2ed40e3ab4b98b9 Mon Sep 17 00:00:00 2001 From: "Gordon Lam (SH)" Date: Mon, 13 Apr 2026 16:03:54 +0800 Subject: [PATCH] Fix TensorRT RTX EP name to match catalog JSON The catalog uses NvTensorRTRTXExecutionProvider but the switch only matched TensorRtRtxExecutionProvider. Added the Nv-prefixed form. Fixes ADO #61791041 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Shared/cs/PerformanceConfigurator.cs | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Samples/WindowsML/Shared/cs/PerformanceConfigurator.cs b/Samples/WindowsML/Shared/cs/PerformanceConfigurator.cs index cd7901e9b..f1c6ca499 100644 --- a/Samples/WindowsML/Shared/cs/PerformanceConfigurator.cs +++ b/Samples/WindowsML/Shared/cs/PerformanceConfigurator.cs @@ -8,16 +8,32 @@ namespace WindowsML.Shared { public static class PerformanceConfigurator { + /// + /// Returns EP-specific session options for the given execution provider name. + /// + /// The string literals below come from two sources that may use different names + /// for the same provider: + /// 1. ORT runtime — OrtEpDevice.EpName returned by ExecutionProviderCatalog.FindAllProviders() + /// 2. Model catalog JSON — the "executionProviders[].name" field in files like + /// Resources/SqueezeNetModelCatalog.json + /// + /// When a provider appears under different names in these two sources, both forms + /// must be listed here so the lookup succeeds regardless of which name is passed in. + /// If a new EP is added to the ORT runtime or the catalog introduces an alias, + /// a corresponding entry should be added below. + /// public static Dictionary GetEpOptions(string epName, PerformanceMode mode) { string normalized = (epName ?? string.Empty).Trim().ToUpperInvariant(); return normalized switch { - "OPENVINOEXECUTIONPROVIDER" => GetOpenVinoOptions(mode), - "QNNEXECUTIONPROVIDER" => GetQnnOptions(mode), - "VITISAIEXECUTIONPROVIDER" => GetVitisAiOptions(mode), - "MIGRAPHXEXECUTIONPROVIDER" => GetMiGraphxOptions(mode), - "TENSORRTRTXEXECUTIONPROVIDER" => GetTensorRtRtxOptions(mode), + "OPENVINOEXECUTIONPROVIDER" => GetOpenVinoOptions(mode), // ORT runtime name + "QNNEXECUTIONPROVIDER" => GetQnnOptions(mode), // ORT runtime name + "VITISAIEXECUTIONPROVIDER" => GetVitisAiOptions(mode), // ORT runtime name + "MIGRAPHXEXECUTIONPROVIDER" => GetMiGraphxOptions(mode), // ORT runtime name + "TENSORRTRTXEXECUTIONPROVIDER" // ORT runtime name + or "NVTENSORRTRTXEXECUTIONPROVIDER" // catalog JSON name (SqueezeNetModelCatalog.json) + => GetTensorRtRtxOptions(mode), _ => new Dictionary(StringComparer.OrdinalIgnoreCase) }; }