diff --git a/src/backends/ort_provider.hpp b/src/backends/ort_provider.hpp index 7f27c26..a420435 100644 --- a/src/backends/ort_provider.hpp +++ b/src/backends/ort_provider.hpp @@ -23,12 +23,23 @@ enum class OrtProvider { CPU, CUDA, ROCm, TensorRT }; inline OrtProvider detect_ort_provider() { + // ORT returns these in its own preference order (TensorRT, CUDA, ..., CPU + // last), so the first recognised entry is the best available and the loop + // returns on it. auto available = Ort::GetAvailableProviders(); for (const auto& p : available) { + // Only the TensorRT *EP* is a build-time opt-in — it needs the headers + // and the profile plumbing below. CUDA is not: it is a plain ORT + // provider, and gating its detection on the TRT flag (as this did) made + // the CUDA branch unreachable in every build that did not also ask for + // TensorRT. The symptom is silent rather than loud — inference simply + // runs on the CPU and everything still returns correct answers — which + // is why it survived: a 300-actor VR-012 grid cell took 76 s on the CPU + // with the GPU idle at 212 MiB. #ifdef SAE_ORT_WITH_TRT_EP if (p == "TensorrtExecutionProvider") return OrtProvider::TensorRT; - if (p == "CUDAExecutionProvider") return OrtProvider::CUDA; #endif + if (p == "CUDAExecutionProvider") return OrtProvider::CUDA; if (p == "ROCMExecutionProvider") return OrtProvider::ROCm; } return OrtProvider::CPU;