Repository navigation
Add onnxruntime_DISABLE_DEVICE_DISCOVERY to skip platform device probing - #32592
Merged
Edward Chen (edgchen1) merged 1 commit intoOct 5, 2026
Merged
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Linux test builds fail to link because platform-specific discovery tests remain enabled after their implementation is removed.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds an opt-out for platform hardware probing, using CPU-only device discovery instead.
Changes:
- Adds
onnxruntime_DISABLE_DEVICE_DISCOVERY. - Selects the default CPU-only discovery implementation when enabled.
File summaries
| File | Description |
|---|---|
cmake/CMakeLists.txt |
Declares the new CMake option. |
cmake/onnxruntime_common.cmake |
Selects the CPU-only discovery source. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Ryan VanderMeulen (rvandermeulen)
force-pushed
the
device-discovery-option
branch
from
September 14, 2026 19:07
346c4c5 to
23eed69
Compare
Ryan VanderMeulen (rvandermeulen)
force-pushed
the
device-discovery-option
branch
from
September 14, 2026 19:42
23eed69 to
dc9ac73
Compare
Ryan VanderMeulen (rvandermeulen)
force-pushed
the
device-discovery-option
branch
from
September 25, 2026 01:01
dc9ac73 to
59432fb
Compare
Contributor
Author
|
Edward Chen (@edgchen1) This is one of the related PRs from #32597, if you have a chance to take a look. |
Edward Chen (edgchen1)
pushed a commit
that referenced
this pull request
Sep 28, 2026
…-minimal build (#32597) ### Description Convert the raw `try`/`catch`/`throw` statements that a CPU-only, non-minimal build still compiles to the `ORT_TRY` / `ORT_CATCH` / `ORT_HANDLE_EXCEPTION` / `ORT_RETHROW` / `ORT_THROW` macros the rest of the code base uses: `graph_partitioner`, `attention_fusion`, `constant_folding`, `stft_decomposition`, `model_package_context`, `ep_library_plugin`, `provider_bridge_ort`, and the `ORT_ENABLE_STREAM` config reader/writer in `allocation_planner` (whose writer already used `ORT_CATCH` but read the exception outside `ORT_HANDLE_EXCEPTION`). `provider_bridge_ort.cc`'s 18 function-try-blocks have no macro equivalent, so each becomes an `ORT_TRY` over the body followed by a file-local `ORT_CATCH_LOG_RETURN_NULLPTR` that logs and returns `nullptr`, the tail they all shared. `ProviderLibrary::Load`/`Get` keep their unload-and-rethrow via `ORT_RETHROW`. The `allocation_planner` handler that used `EXIT_ON_ERR` is expanded inline so its `return` stays in the function rather than inside the handler lambda. With exceptions enabled this is a spelling change with identical control flow. With `onnxruntime_DISABLE_EXCEPTIONS` the result compiles and links on Linux x64/aarch64, Windows x64/x86/arm64, macOS x64/arm64 and Android arm/arm64/x64 (Firefox's CI, with #32591, #32592, #32593 and #32595 applied alongside). ### Motivation and Context Firefox builds ONNX Runtime with exceptions disabled and carries these conversions as local patches, together with a hack that disables `ORT_ENABLE_STREAM` only because of the `allocation_planner` sites. Together with the other open PRs this leaves the `onnxruntime_DISABLE_EXCEPTIONS` + `onnxruntime_MINIMAL_BUILD` coupling as the only remaining obstacle to a non-minimal no-exceptions build.
The platform device discovery on Windows opens DXGI/D3D12/DXCore and SetupDi, and Linux/macOS have their own probes. A CPU-only embedding (Firefox builds ONNX Runtime this way) gains nothing from them and would rather not load those system libraries, and Firefox's CI has hit crashes in the DXGI path on display-less Windows workers. With the option on, the common library compiles device_discovery_default.cc, which reports only the CPU device from CPUID, instead of the platform file. No source changes; the default implementation already exists for platforms without a probe. The Linux PCI/NPU discovery unit tests are skipped in that configuration since the helpers they test are in the platform file.
Ryan VanderMeulen (rvandermeulen)
force-pushed
the
device-discovery-option
branch
from
October 3, 2026 16:37
59432fb to
c32f9c5
Compare
Ryan VanderMeulen (rvandermeulen)
requested a review
from Edward Chen (edgchen1)
October 3, 2026 16:37
Edward Chen (edgchen1)
approved these changes
Oct 5, 2026
Edward Chen (edgchen1)
enabled auto-merge (squash)
October 5, 2026 13:53
This was referenced Oct 9, 2026
This was referenced Oct 13, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
New CMake option
onnxruntime_DISABLE_DEVICE_DISCOVERY(default OFF). When set,onnxruntime_commoncompilesdevice_discovery_default.cc, which reports only the CPU device from CPUID, instead of the platform-specific discovery file. No C++ changes; the default implementation already exists for platforms without a probe. The Linux PCI/NPU discovery unit tests are skipped in that configuration, since the helpers they exercise live in the platform file; the genericDeviceDiscoveryTeststill runs.Motivation and Context
The platform device discovery on Windows opens DXGI/D3D12/DXCore and SetupDi, and Linux/macOS have their own probes. A CPU-only embedding gains nothing from them and would rather not load those system libraries at all. Firefox builds ONNX Runtime this way and has hit crashes in the DXGI path on display-less Windows CI workers; it currently carries a local patch that disables the Windows probe.