Ship one binary with NPU + ROCm + CUDA support, fix CLI flag precedence
All checks were successful
Mirror to GitHub / mirror (push) Successful in 2s
release / build (push) Successful in 2m51s

Adds breadmill's `full` feature (npu + rocm + cuda together) and switches
the release workflow to build with it. All three backends are ort's
load-dynamic (dlopen) mode, so combining them doesn't require the NPU/ROCm/
CUDA toolkits on the build host -- which backend is actually available is
resolved at runtime via ORT_DYLIB_PATH / the dynamic linker, per whichever
backend is selected for that run.

Also fixes a real bug this surfaced: backend selection checked
`config.model.backend == "rocm"` unconditionally in an if/else-if chain, so
an explicit --cuda (or --npu) flag silently lost to an unrelated `backend`
value already sitting in config.toml. CLI flags now always take priority
over config.

Version bump: breadmill 0.2.0 -> 0.2.1.
This commit is contained in:
Breadway 2026-07-03 22:06:47 +08:00
parent 2618a33fd5
commit fdf596e58a
5 changed files with 56 additions and 14 deletions

View file

@ -24,6 +24,7 @@ Optional features:
| `npu` | AMD XDNA NPU via VitisAI ONNX Runtime EP (requires Ryzen AI SDK) |
| `rocm` | AMD iGPU via the MIGraphX ONNX Runtime EP (ROCm-backed) |
| `cuda` | NVIDIA GPU via the CUDA ONNX Runtime EP |
| `full` | All three of the above in one binary |
```
# NPU build
@ -34,6 +35,9 @@ cargo build --release -p breadmill --features rocm
# CUDA (NVIDIA GPU) build
cargo build --release -p breadmill --features cuda
# All backends in one binary (what the release build ships)
cargo build --release -p breadmill --features full
```
`rocm`/`cuda`/`npu` all use `ort`'s `load-dynamic` mode: at runtime, breadmill
@ -43,6 +47,15 @@ build actually has the matching execution provider compiled in — breadmill
logs a clear `Successfully registered` / `not enabled in this build` line for
this at startup (see [GPU backend notes](#gpu-backend-notes) below).
Because all three are dlopen-based, `full` doesn't require the NPU/ROCm/CUDA
toolkits to be installed at build time — only at run time, and only for
whichever single backend you actually select via `--npu`/`--rocm`/`--cuda`
or `backend` in config.toml. The **released binaries are built with
`full`**: same binary works CPU-only out of the box, and picks up NPU/ROCm/CUDA
acceleration on a machine that has the matching ONNX Runtime available,
without needing a different download. An explicit `--npu`/`--rocm`/`--cuda`
flag always overrides `backend` in config.toml, not the other way around.
## Setup
**1. Fetch the embedding model** (~550 MB, downloaded once from Hugging Face):