|
5 | 5 | #include "core/providers/shared_library/provider_api.h" |
6 | 6 | #include "nv_provider_factory.h" |
7 | 7 | #include <atomic> |
| 8 | +#include <string> |
8 | 9 | #include "nv_execution_provider.h" |
9 | 10 | #include "nv_provider_factory_creator.h" |
10 | 11 | #include "nv_data_transfer.h" |
@@ -575,6 +576,7 @@ struct NvTensorRtRtxEpFactory : OrtEpFactory { |
575 | 576 | * @return True if the device is a supported NVIDIA GPU, false otherwise. |
576 | 577 | */ |
577 | 578 | bool IsOrtHardwareDeviceSupported(const OrtHardwareDevice& device) { |
| 579 | +#if _WIN32 |
578 | 580 | const auto& metadata_entries = device.metadata.Entries(); |
579 | 581 | const auto it = metadata_entries.find("LUID"); |
580 | 582 | if (it == metadata_entries.end()) { |
@@ -616,6 +618,25 @@ struct NvTensorRtRtxEpFactory : OrtEpFactory { |
616 | 618 | } |
617 | 619 |
|
618 | 620 | return false; |
| 621 | +#else |
| 622 | + const auto& metadata_entries = device.metadata.Entries(); |
| 623 | + const auto it = metadata_entries.find("bus_id"); |
| 624 | + if (it == metadata_entries.end()) { |
| 625 | + return false; |
| 626 | + } |
| 627 | + auto& target_id = it->second; |
| 628 | + int cuda_device_idx = 0; |
| 629 | + if (cudaDeviceGetByPCIBusId(&cuda_device_idx, target_id.c_str()) != cudaSuccess) { |
| 630 | + return false; |
| 631 | + } |
| 632 | + |
| 633 | + cudaDeviceProp prop; |
| 634 | + if (cudaGetDeviceProperties(&prop, cuda_device_idx) != cudaSuccess) { |
| 635 | + return false; |
| 636 | + } |
| 637 | + // Ampere architecture or newer is required. |
| 638 | + return prop.major >= 8; |
| 639 | +#endif |
619 | 640 | } |
620 | 641 |
|
621 | 642 | // Creates and returns OrtEpDevice instances for all OrtHardwareDevices that this factory supports. |
|
0 commit comments