fix: skip ROCm EP registration when not available in ORT build
Some checks failed
release / build (push) Failing after 3s
Some checks failed
release / build (push) Failing after 3s
Eliminates the spurious ERROR log from ORT when ROCm isn't compiled in. Checks is_available() before attempting registration so the session correctly falls back to CPU without noise.
This commit is contained in:
parent
708eb8f3b4
commit
478d06a5d5
3 changed files with 16 additions and 10 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
|
@ -314,7 +314,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "breadman"
|
name = "breadman"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"breadpad-shared",
|
"breadpad-shared",
|
||||||
|
|
@ -331,7 +331,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "breadpad"
|
name = "breadpad"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"breadpad-shared",
|
"breadpad-shared",
|
||||||
|
|
@ -350,7 +350,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "breadpad-shared"
|
name = "breadpad-shared"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bread-theme",
|
"bread-theme",
|
||||||
|
|
@ -376,7 +376,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "breadpad-test"
|
name = "breadpad-test"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"breadpad-shared",
|
"breadpad-shared",
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ members = [
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Breadway"]
|
authors = ["Breadway"]
|
||||||
|
|
|
||||||
|
|
@ -247,12 +247,18 @@ fn try_load_session(
|
||||||
path: &std::path::Path,
|
path: &std::path::Path,
|
||||||
) -> (Option<ort::session::Session>, ExecutionProvider) {
|
) -> (Option<ort::session::Session>, ExecutionProvider) {
|
||||||
// Try ROCm (iGPU) first, fall back to CPU.
|
// Try ROCm (iGPU) first, fall back to CPU.
|
||||||
match build_onnx_session(path, ort::ep::ROCm::default().build()) {
|
let rocm_available = {
|
||||||
Ok(s) => {
|
use ort::execution_providers::ExecutionProvider as _;
|
||||||
tracing::info!("ONNX session loaded (ROCm iGPU)");
|
ort::ep::ROCm::default().is_available().unwrap_or(false)
|
||||||
return (Some(s), ExecutionProvider::Gpu);
|
};
|
||||||
|
if rocm_available {
|
||||||
|
match build_onnx_session(path, ort::ep::ROCm::default().build()) {
|
||||||
|
Ok(s) => {
|
||||||
|
tracing::info!("ONNX session loaded (ROCm iGPU)");
|
||||||
|
return (Some(s), ExecutionProvider::Gpu);
|
||||||
|
}
|
||||||
|
Err(e) => tracing::debug!("ROCm EP unavailable: {}; trying CPU", e),
|
||||||
}
|
}
|
||||||
Err(e) => tracing::debug!("ROCm EP unavailable: {}; trying CPU", e),
|
|
||||||
}
|
}
|
||||||
match build_onnx_session(path, ort::ep::CPU::default().build()) {
|
match build_onnx_session(path, ort::ep::CPU::default().build()) {
|
||||||
Ok(s) => {
|
Ok(s) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue