Skip to content

Conversation

@xhan65
Copy link

@xhan65 xhan65 commented Jan 6, 2026

Description

This PR adds new C API for querying hardware device and execution provider (EP) compatibility/incompatibility reasons. The API allows applications to determine why a specific EP may not be compatible with a given hardware device before attempting to use it. The EP implementor decides how device compatibility is defined for their stack and communicates this via the possible states in the OrtDeviceEpIncompatibilityDetails struct.

New API Functions

  • GetHardwareDeviceEPIncompatibilityReasons - Query incompatibility reasons between an EP and a hardware device
  • DeviceEpIncompatibilityDetails_GetReasonsBitmask - Get a bitmask of incompatibility reasons
  • DeviceEpIncompatibilityDetails_GetErrorCode - Get an EP-specific error code
  • DeviceEpIncompatibilityDetails_GetNotes - Get optional human-readable notes about incompatibility
  • ReleaseDeviceEpIncompatibilityDetails - Release the details object

New Types

  • OrtDeviceEpIncompatibilityDetails - Opaque type holding incompatibility information
  • OrtDeviceEpIncompatibilityReason - Enum defining standard incompatibility reason flags

Testing

  • Added unit tests in hardware_device_compatibility_test.cc for the new C API functions
  • Added plugin EP compatibility tests in test_execution.cc
    . Tests verify both compatible (CPU device with CPU-supporting EP) and incompatible (GPU device with CPU-only EP) scenarios
  • Updated example plugin EP to implement the compatibility checking interface

Motivation and Context

Applications using ONNX Runtime need a way to understand why an execution provider cannot run on a particular hardware device. This is especially important for:

  • User feedback - Providing meaningful error messages when hardware is incompatible
  • EP selection - Choosing the best available EP based on compatibility
  • Diagnostics - Understanding driver/dependency requirements

Previously, there was no standardized way to query this information. EPs would simply fail at session creation/model load/inference time without providing actionable feedback.

@xhan65 xhan65 force-pushed the user/xiha/compat_api branch from fd14e95 to 4155e77 Compare January 6, 2026 22:58
@xhan65 xhan65 force-pushed the user/xiha/compat_api branch from ad78f56 to 80f9953 Compare January 7, 2026 02:05
@adrianlizarraga
Copy link
Contributor

/azp run Linux QNN CI Pipeline, Win_TRT_Minimal_CUDA_Test_CI, Windows ARM64 QNN CI Pipeline, Windows GPU Doc Gen CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@xhan65 xhan65 marked this pull request as ready for review January 12, 2026 04:26
@adrianlizarraga
Copy link
Contributor

/azp run Linux QNN CI Pipeline, Win_TRT_Minimal_CUDA_Test_CI, Windows ARM64 QNN CI Pipeline, Windows GPU Doc Gen CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants