backends
Select, install, check, and troubleshoot MMDeploy inference backends, custom ops, and backend manager availability.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- backends
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Select, install, check, and troubleshoot MMDeploy inference backends, custom ops, and backend manager availability.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/backend-matrix.md10.7 KB
- 参考文档references/custom-ops.md8.5 KB
- 参考文档references/troubleshooting.md14.9 KB
- 脚本scripts/check_env.py8.9 KB
03 SKILL.md 正文
MMDeploy Backends Router
Use this sub-skill when a task is about choosing an MMDeploy backend, installing
backend packages or vendor toolkits, checking BackendManager availability,
building backend custom ops, or recovering from backend-specific failures.
Do not use this sub-skill to orchestrate full model conversion, SDK demo usage, or regression benchmarking. For those workflows, keep this sub-skill responsible only for backend readiness and failure diagnosis, then route the actual conversion, SDK runtime, or validation flow to the owning route.
Read These First
- Backend matrix — backend role, device/platform fit, CPU substitute status, required packages, tools, environment variables, and backend manager checks.
- Custom ops — ONNXRuntime, TensorRT, NCNN, and TorchScript custom-op build expectations and symptoms.
- Troubleshooting — symptom-driven recovery for
missing packages, missing converter tools, TensorRT profiles, OpenVINO
libpython, TorchScript ABI/cuDNN, vendor toolkits, SDK runtime, config, and API misuse. - Backend environment checker — safe read-only helper adapted from MMDeploy's environment checker.
Route The User Request
-
Identify the target artifact and device.
- ONNX inference on CPU/GPU: ONNXRuntime.
- TensorRT engine on NVIDIA CUDA/Jetson: TensorRT.
.param/.binmobile or embedded CPU artifacts: NCNN.- OpenVINO IR (
.xml/.bin) on Intel CPU-oriented deployments: OpenVINO. - PPL.NN artifacts, usually CUDA-oriented in MMDeploy examples: PPLNN.
- TorchScript
.ptartifacts or LibTorch SDK backend: TorchScript. - Vendor accelerator artifacts: RKNN, Ascend, CoreML, TVM, VACC, or SNPE.
mmdeploy_runtimemodel directories and wrappers: SDK backend manager.
-
Check backend availability before trying conversion. Run the bundled checker from this sub-skill:
python scripts/check_env.py --backend tensorrt --with-custom-ops python scripts/check_env.py --backend onnxruntime --backend ncnn --jsonWhen the package is installed but custom ops are missing, read Custom ops before rebuilding anything.
-
Inspect the deployment config shape. The relevant key is always
backend_config.type; backend-specific details live underbackend_config.common_config,backend_config.model_inputs, quantization fields, or Model Optimizer options. TensorRT dynamic profiles must include coherentmin_shape,opt_shape, andmax_shapevalues for every runtime input name. -
Install only the backend stack required by the selected target. Do not install all optional backends. Prefer Python package/import checks first, then vendor toolkit and CMake/build checks only when SDK runtime or custom ops are required.
-
Stop instead of guessing when a proprietary toolkit, hardware device, driver, cross-compiler, service URI, or SDK runtime is absent and no CPU substitute is available.
Backend Manager Checks
Use manager checks when diagnosing availability or conditional API exports:
from mmdeploy.backend.base import get_backend_manager
manager = get_backend_manager('tensorrt')
print(manager is not None)
print(manager.is_available())
print(manager.is_available(with_custom_ops=True))
print(manager.get_version())
Important interpretation rules:
is_available()usually means the Python package or required converter tool can be found; it does not prove custom ops, SDK runtime, or accelerator hardware work.is_available(with_custom_ops=True)is stricter for ONNXRuntime, TensorRT, NCNN, and TorchScript. It can beFalseeven when the backend package itself is available.- Backend API modules may export converter functions conditionally. If a backend
package is unavailable, imports such as
from mmdeploy.apis.tensorrt import onnx2tensorrtmay be absent even thoughis_availableitself can still be imported. - SNPE manager availability is based on the
onnx2dlctool path; version reporting is not implemented by its manager.
Setup Sequence
- Read the row for the target backend in Backend matrix.
- Install the Python package(s) and make vendor libraries discoverable through the documented environment variables.
- Run
python scripts/check_env.py --backend <name>. - If the selected model/codebase needs custom ops, run
python scripts/check_env.py --backend <name> --with-custom-opsand use Custom ops to build the backend plugin only for that backend. - Re-run the checker. Continue only when the required manager and custom-op state match the target workflow, or record the backend as unavailable with a clear stop reason.
Boundaries And Handoffs
- Backend conversion should be called through the package API or the generated
conversion route, not through standalone backend converter scripts bundled
here. This sub-skill intentionally provides no standalone
onnx2*converter wrappers. - Runtime SDK demos, package layout, and
mmdeploy_runtimemodel execution are owned by the SDK route. This sub-skill only checks SDK backend-manager availability and explains missing runtime symptoms. - Validation, profiling, and regression matrix execution are owned by the validation route. This sub-skill only explains backend readiness failures that block those tasks.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).