From fdd3d7317aa7ec9f74f359ba862f89c179e6f1f3 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Thu, 2 Apr 2026 18:53:16 -0500 Subject: [PATCH 1/4] Fix EP progress display: use \n on EP transition instead of at 100% The previous logic printed \n when percent >= 100, which caused duplicate lines when the core sends multiple 100% callbacks, and double newlines between EPs. Instead, print \n only when a new EP name appears, and a final \n after the call completes. This is simpler and handles the case where an EP fails before reaching 100%. Updated in both samples (JS, C#) and all 4 SDK READMEs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/cs/native-chat-completions/Program.cs | 5 +---- samples/js/native-chat-completions/app.js | 4 +--- sdk/cs/README.md | 5 +---- sdk/js/README.md | 4 +--- sdk/python/README.md | 3 +-- sdk/rust/README.md | 4 +--- 6 files changed, 6 insertions(+), 19 deletions(-) diff --git a/samples/cs/native-chat-completions/Program.cs b/samples/cs/native-chat-completions/Program.cs index d1527503..b2281cd3 100644 --- a/samples/cs/native-chat-completions/Program.cs +++ b/samples/cs/native-chat-completions/Program.cs @@ -46,11 +46,8 @@ await mgr.DownloadAndRegisterEpsAsync((epName, percent) => currentEp = epName; } Console.Write($"\r {epName.PadRight(maxNameLen)} {percent,6:F1}%"); - if (percent >= 100) - { - Console.WriteLine(); - } }); + Console.WriteLine(); } else { diff --git a/samples/js/native-chat-completions/app.js b/samples/js/native-chat-completions/app.js index 4246f64f..049c01d1 100644 --- a/samples/js/native-chat-completions/app.js +++ b/samples/js/native-chat-completions/app.js @@ -35,10 +35,8 @@ if (eps.length > 0) { currentEp = epName; } process.stdout.write(`\r ${epName.padEnd(maxNameLen)} ${percent.toFixed(1).padStart(5)}%`); - if (percent >= 100) { - process.stdout.write('\n'); - } }); + process.stdout.write('\n'); } else { console.log('No execution providers to download.'); } diff --git a/sdk/cs/README.md b/sdk/cs/README.md index 26287217..3efdc242 100644 --- a/sdk/cs/README.md +++ b/sdk/cs/README.md @@ -94,11 +94,8 @@ await mgr.DownloadAndRegisterEpsAsync((epName, percent) => currentEp = epName; } Console.Write($"\r {epName} {percent,6:F1}%"); - if (percent >= 100) - { - Console.WriteLine(); - } }); +Console.WriteLine(); ``` Catalog access no longer blocks on EP downloads. Call `DownloadAndRegisterEpsAsync` explicitly when you need hardware-accelerated execution providers. diff --git a/sdk/js/README.md b/sdk/js/README.md index 5590ab12..c197e80e 100644 --- a/sdk/js/README.md +++ b/sdk/js/README.md @@ -67,10 +67,8 @@ await manager.downloadAndRegisterEps((epName, percent) => { currentEp = epName; } process.stdout.write(`\r ${epName} ${percent.toFixed(1)}%`); - if (percent >= 100) { - process.stdout.write('\n'); - } }); +process.stdout.write('\n'); ``` Catalog access does not block on EP downloads. Call `downloadAndRegisterEps()` when you need hardware-accelerated execution providers. diff --git a/sdk/python/README.md b/sdk/python/README.md index 4ee1f9cc..3ff677d2 100644 --- a/sdk/python/README.md +++ b/sdk/python/README.md @@ -102,10 +102,9 @@ def on_progress(ep_name: str, percent: float) -> None: print() current_ep = ep_name print(f"\r {ep_name} {percent:5.1f}%", end="", flush=True) - if percent >= 100: - print() manager.download_and_register_eps(progress_callback=on_progress) +print() ``` Catalog access does not block on EP downloads. Call `download_and_register_eps()` when you need hardware-accelerated execution providers. diff --git a/sdk/rust/README.md b/sdk/rust/README.md index 6bcb9884..d3983430 100644 --- a/sdk/rust/README.md +++ b/sdk/rust/README.md @@ -102,10 +102,8 @@ manager.download_and_register_eps_with_progress(None, move |ep_name: &str, perce *current = ep_name.to_string(); } print!("\r {} {:5.1}%", ep_name, percent); - if percent >= 100.0 { - println!(); - } }).await?; +println!(); ``` Catalog access does not block on EP downloads. Call `download_and_register_eps` when you need hardware-accelerated execution providers. From f16c8e9a9408dcd31a28ddde6d3bcd7608a55cdd Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Thu, 2 Apr 2026 19:00:29 -0500 Subject: [PATCH 2/4] Format EP discovery output as a table Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/cs/native-chat-completions/Program.cs | 6 ++++-- samples/js/native-chat-completions/app.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/samples/cs/native-chat-completions/Program.cs b/samples/cs/native-chat-completions/Program.cs index b2281cd3..3c4f1d1c 100644 --- a/samples/cs/native-chat-completions/Program.cs +++ b/samples/cs/native-chat-completions/Program.cs @@ -21,10 +21,13 @@ // Discover available execution providers and their registration status. var eps = mgr.DiscoverEps(); +int maxNameLen = eps.Max(e => e.Name.Length); Console.WriteLine("Available execution providers:"); +Console.WriteLine($" {"Name".PadRight(maxNameLen)} Registered"); +Console.WriteLine($" {new string('─', maxNameLen)} {"──────────"}"); foreach (var ep in eps) { - Console.WriteLine($" {ep.Name} (registered: {ep.IsRegistered})"); + Console.WriteLine($" {ep.Name.PadRight(maxNameLen)} {ep.IsRegistered}"); } // Download and register all execution providers with per-EP progress. @@ -33,7 +36,6 @@ // For cross platform builds there is no dynamic EP download and this will return immediately. if (eps.Length > 0) { - int maxNameLen = eps.Max(e => e.Name.Length); string currentEp = ""; await mgr.DownloadAndRegisterEpsAsync((epName, percent) => { diff --git a/samples/js/native-chat-completions/app.js b/samples/js/native-chat-completions/app.js index 049c01d1..83b77ae0 100644 --- a/samples/js/native-chat-completions/app.js +++ b/samples/js/native-chat-completions/app.js @@ -16,16 +16,18 @@ console.log('✓ SDK initialized successfully'); // Discover available execution providers and their registration status. const eps = manager.discoverEps(); +const maxNameLen = Math.max(...eps.map(e => e.name.length)); console.log('\nAvailable execution providers:'); +console.log(` ${'Name'.padEnd(maxNameLen)} Registered`); +console.log(` ${'─'.repeat(maxNameLen)} ──────────`); for (const ep of eps) { - console.log(` ${ep.name} (registered: ${ep.isRegistered})`); + console.log(` ${ep.name.padEnd(maxNameLen)} ${ep.isRegistered}`); } // Download and register all execution providers with per-EP progress. // EP packages include dependencies and may be large. // Download is only required again if a new version of the EP is released. if (eps.length > 0) { - const maxNameLen = Math.max(...eps.map(e => e.name.length)); let currentEp = ''; await manager.downloadAndRegisterEps((epName, percent) => { if (epName !== currentEp) { From 71f6431cb6ca4240f5ed09715d1adbb7250b0642 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Thu, 2 Apr 2026 20:07:46 -0500 Subject: [PATCH 3/4] Hardcode EP name column width to 30 Avoids empty-array crash when no EPs are discovered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/cs/native-chat-completions/Program.cs | 2 +- samples/js/native-chat-completions/app.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/cs/native-chat-completions/Program.cs b/samples/cs/native-chat-completions/Program.cs index 3c4f1d1c..c2fbd7e3 100644 --- a/samples/cs/native-chat-completions/Program.cs +++ b/samples/cs/native-chat-completions/Program.cs @@ -21,7 +21,7 @@ // Discover available execution providers and their registration status. var eps = mgr.DiscoverEps(); -int maxNameLen = eps.Max(e => e.Name.Length); +int maxNameLen = 30; Console.WriteLine("Available execution providers:"); Console.WriteLine($" {"Name".PadRight(maxNameLen)} Registered"); Console.WriteLine($" {new string('─', maxNameLen)} {"──────────"}"); diff --git a/samples/js/native-chat-completions/app.js b/samples/js/native-chat-completions/app.js index 83b77ae0..f532e828 100644 --- a/samples/js/native-chat-completions/app.js +++ b/samples/js/native-chat-completions/app.js @@ -16,7 +16,7 @@ console.log('✓ SDK initialized successfully'); // Discover available execution providers and their registration status. const eps = manager.discoverEps(); -const maxNameLen = Math.max(...eps.map(e => e.name.length)); +const maxNameLen = 30; console.log('\nAvailable execution providers:'); console.log(` ${'Name'.padEnd(maxNameLen)} Registered`); console.log(` ${'─'.repeat(maxNameLen)} ──────────`); From 83d99cd616b02962ea267185d291102894f3dd3e Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Thu, 2 Apr 2026 20:26:06 -0500 Subject: [PATCH 4/4] Add blank line and header between EP table and downloads Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- samples/cs/native-chat-completions/Program.cs | 1 + samples/js/native-chat-completions/app.js | 1 + 2 files changed, 2 insertions(+) diff --git a/samples/cs/native-chat-completions/Program.cs b/samples/cs/native-chat-completions/Program.cs index c2fbd7e3..033786b1 100644 --- a/samples/cs/native-chat-completions/Program.cs +++ b/samples/cs/native-chat-completions/Program.cs @@ -34,6 +34,7 @@ // EP packages include dependencies and may be large. // Download is only required again if a new version of the EP is released. // For cross platform builds there is no dynamic EP download and this will return immediately. +Console.WriteLine("\nDownloading execution providers:"); if (eps.Length > 0) { string currentEp = ""; diff --git a/samples/js/native-chat-completions/app.js b/samples/js/native-chat-completions/app.js index f532e828..9e34c90f 100644 --- a/samples/js/native-chat-completions/app.js +++ b/samples/js/native-chat-completions/app.js @@ -27,6 +27,7 @@ for (const ep of eps) { // Download and register all execution providers with per-EP progress. // EP packages include dependencies and may be large. // Download is only required again if a new version of the EP is released. +console.log('\nDownloading execution providers:'); if (eps.length > 0) { let currentEp = ''; await manager.downloadAndRegisterEps((epName, percent) => {