AGENT SKILL

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

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

  1. Identify the target artifact and device.

    • ONNX inference on CPU/GPU: ONNXRuntime.
    • TensorRT engine on NVIDIA CUDA/Jetson: TensorRT.
    • .param/.bin mobile 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 .pt artifacts or LibTorch SDK backend: TorchScript.
    • Vendor accelerator artifacts: RKNN, Ascend, CoreML, TVM, VACC, or SNPE.
    • mmdeploy_runtime model directories and wrappers: SDK backend manager.
  2. 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 --json
    

    When the package is installed but custom ops are missing, read Custom ops before rebuilding anything.

  3. Inspect the deployment config shape. The relevant key is always backend_config.type; backend-specific details live under backend_config.common_config, backend_config.model_inputs, quantization fields, or Model Optimizer options. TensorRT dynamic profiles must include coherent min_shape, opt_shape, and max_shape values for every runtime input name.

  4. 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.

  5. 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 be False even 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 onnx2tensorrt may be absent even though is_available itself can still be imported.
  • SNPE manager availability is based on the onnx2dlc tool path; version reporting is not implemented by its manager.

Setup Sequence

  1. Read the row for the target backend in Backend matrix.
  2. Install the Python package(s) and make vendor libraries discoverable through the documented environment variables.
  3. Run python scripts/check_env.py --backend <name>.
  4. If the selected model/codebase needs custom ops, run python scripts/check_env.py --backend <name> --with-custom-ops and use Custom ops to build the backend plugin only for that backend.
  5. 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_runtime model 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

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351