From 492abde5301c1aea3df1c8e1b5b4273ef35dfa49 Mon Sep 17 00:00:00 2001 From: xiaodongye Date: Fri, 20 Nov 2026 10:40:48 +0800 Subject: [PATCH 1/5] Add a MUSA backend and the vllm_musa repository pack Introduce Moore Threads MUSA as a first-class backend: discovery and qualification through pymtml, a mask-binding rule shared with the dashboard signature, and fail-closed idleness so a binding that cannot report either processes or used memory is treated as busy instead of idle. Add the vllm_musa repository pack, the vllm-musa skill with its references, and three source-derived records covering device identity, the torchada dispatch boundary and the Omni image lane. The skill and records live in the unified skill_library layout; the pack keeps only its pack.json. Signed-off-by: xiaodongye --- CHANGELOG.md | 18 + docs/dsh-plugin.md | 6 +- docs/legacy-knowledge-manifest.json | 19 +- docs/musa.md | 82 +++ docs/operations.md | 21 + docs/quickstart.md | 2 +- plugins/inferrsi-dsh/client.cjs | 2 +- plugins/inferrsi-dsh/form.cjs | 6 +- src/inferrsi/apps/cli/arguments.py | 3 +- src/inferrsi/apps/host/environment.py | 5 + src/inferrsi/apps/host/inspection.py | 10 +- src/inferrsi/apps/host/platforms/__init__.py | 29 +- src/inferrsi/apps/host/platforms/cuda.py | 2 +- src/inferrsi/apps/host/platforms/mlx.py | 2 +- src/inferrsi/apps/host/platforms/musa.py | 321 ++++++++++++ src/inferrsi/apps/views/dashboard_data.py | 27 +- .../data/repo_packs/vllm_musa/pack.json | 24 + src/inferrsi/knowledge/_skill_selection.py | 8 +- src/inferrsi/knowledge/catalog.py | 2 +- .../knowledge/data/skill_library/README.md | 4 +- ...usa.musa.diffusion.omni_image_porting.json | 87 ++++ ...usa.musa.llm.physical_device_identity.json | 83 +++ ...a.musa.llm.torchada_dispatch_boundary.json | 81 +++ .../data/skill_library/skill-index.json | 4 + .../systems/engines/vllm-musa/SKILL.md | 58 +++ .../systems/engines/vllm-musa/metadata.json | 66 +++ .../vllm-musa/references/device-identity.md | 54 ++ .../engines/vllm-musa/references/dispatch.md | 46 ++ .../vllm-musa/references/measurement.md | 48 ++ .../engines/vllm-musa/references/omni.md | 53 ++ .../engines/vllm-musa/references/sources.md | 37 ++ src/inferrsi/knowledge/knowledge_find.py | 13 +- src/inferrsi/resources/repository_packs.py | 4 +- tests/check_dsh_form.cjs | 2 + tests/check_installed.py | 6 +- tests/test_cli_catalog.py | 1 + tests/test_dashboard_external.py | 77 +++ tests/test_inspection.py | 5 + tests/test_knowledge_compatibility_shells.py | 22 +- tests/test_knowledge_find.py | 2 +- tests/test_musa_platform.py | 482 ++++++++++++++++++ tests/test_repository_packs_facade.py | 21 +- tests/test_skill_index.py | 8 +- tests/test_skill_library.py | 2 +- 44 files changed, 1805 insertions(+), 50 deletions(-) create mode 100644 docs/musa.md create mode 100644 src/inferrsi/apps/host/platforms/musa.py create mode 100644 src/inferrsi/harness/data/repo_packs/vllm_musa/pack.json create mode 100644 src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.diffusion.omni_image_porting.json create mode 100644 src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.llm.physical_device_identity.json create mode 100644 src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.llm.torchada_dispatch_boundary.json create mode 100644 src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md create mode 100644 src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/metadata.json create mode 100644 src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/device-identity.md create mode 100644 src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/dispatch.md create mode 100644 src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/measurement.md create mode 100644 src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/omni.md create mode 100644 src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/sources.md create mode 100644 tests/test_musa_platform.py diff --git a/CHANGELOG.md b/CHANGELOG.md index fec80adce..1d1f7b0fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,24 @@ ## [Unreleased] +### Added + +- A `musa` platform backend and a `vllm_musa` repository pack cover Moore + Threads MUSA text-LLM and Omni serving. `doctor --backend musa` runs a + `pymtml` probe inside the target Python, because MUSA publishes no discovery + CLI to require, and records `MUSA_VISIBLE_DEVICES`, `torch_musa`, `torchada`, + `mate`, `mthreads-ml-py` and `vllm-musa` with the run. `--repo-type vllm_musa` + admits `llm.decode`, `llm.serving`, `diffusion.image_generation`, + `diffusion.video_generation` and `audio.tts`. Three source-derived records and + one skill state the device-identity boundary (MTML answers with physical ids + and is unaffected by `MUSA_VISIBLE_DEVICES` while `torch.musa` remaps), the + `torchada` dispatch boundary, and the Omni image's pinned dependency set. + Every descriptor stays unverified, the records carry + `locally_verified: false`, and this change claims no MUSA result. +- The DeepSeek Harness plugin's test-environment form offers `MUSA` beside GPU + and NPU, so a session can start a campaign on the backend the CLI now accepts + instead of only naming a generic GPU. + ### Changed - Apps workflow implementations now live in `apps/workflows/`: campaign capture, diff --git a/docs/dsh-plugin.md b/docs/dsh-plugin.md index 8b76b2a66..a07dbec68 100644 --- a/docs/dsh-plugin.md +++ b/docs/dsh-plugin.md @@ -49,7 +49,7 @@ In DSH Web, open a target repository and its conversation, then click 1. **Optimization target (优化对象).** Enter the repository, model, framework, SIAS plane and objective. The form fills the local repository path from the current session when available. -2. **Test environment (测试环境).** Choose GPU or NPU and local or remote +2. **Test environment (测试环境).** Choose GPU, NPU or MUSA and local or remote execution. After selecting remote execution, enter the remote repository path in the first section, then return here to test the SSH connection. Set the maximum optimization rounds and total time budget in minutes. The prepared @@ -119,7 +119,7 @@ Click **Test connection**. For a new server, compare the displayed SHA-256 host key fingerprint against a trusted value, then choose **Trust this fingerprint and test**. A supplied fingerprint must match exactly. Successful testing checks SSH authentication, Linux command execution and access to the selected repository. -GPU/NPU availability and benchmark readiness are checked by the Agent afterward. +GPU/NPU/MUSA availability and benchmark readiness are checked by the Agent afterward. After a successful test, **Start iteration** becomes available. Changing the host, authentication, repository, designated scripts or execution location @@ -201,7 +201,7 @@ flowchart LR | Owner | Responsibility | | --- | --- | -| Form and prompt builder | Collect GPU/NPU, execution location, goal, SIAS plane, user budgets and optional acceptance inputs | +| Form and prompt builder | Collect GPU/NPU/MUSA, execution location, goal, SIAS plane, user budgets and optional acceptance inputs | | DSH conversation | Deliver the prompt once to the selected session, preserving its model and permissions | | SSH connection bridge | Authenticate the owner request, verify host key and login, retain a session-bound connection and return an opaque ID | | `inferrsi_remote` | Carry explicit repository operations and cancellation through DSH tools without including authentication material | diff --git a/docs/legacy-knowledge-manifest.json b/docs/legacy-knowledge-manifest.json index c3407528d..18e1bba7f 100644 --- a/docs/legacy-knowledge-manifest.json +++ b/docs/legacy-knowledge-manifest.json @@ -338,10 +338,10 @@ "source": "REPO_TYPES = (\"vllm\", \"vllm_omni\", \"afd_plugin\", \"vllm_rlt\", \"strata\", \"sglang\", \"sglang_omni\")\n\n\ndef repository_pack(repo_type: str) -> dict[str, Any]:\n if repo_type not in REPO_TYPES:\n raise ValueError(f\"Unknown repository type: {repo_type}\")\n path = files(\"inferrsi\").joinpath(\"data\", \"repo_packs\", repo_type, \"pack.json\")\n return json.loads(path.read_text(encoding=\"utf-8\"))" }, "current_fragment": { - "description": "REPO_TYPES and repository_pack as they stand after the K02 resource-path revision", + "description": "REPO_TYPES and repository_pack as they stand after the MUSA registry revision", "hash_convention": "fragment_sha256 is the SHA-256 of source plus one trailing newline", - "fragment_sha256": "b6e49fdd67f7029e080e5e224cf3bf417c7dbc1e337644c3e1cb2b783cae2e4c", - "source": "REPO_TYPES = (\"vllm\", \"vllm_omni\", \"afd_plugin\", \"vllm_rlt\", \"strata\", \"sglang\", \"sglang_omni\")\n\n\ndef repository_pack(repo_type: str) -> dict[str, Any]:\n if repo_type not in REPO_TYPES:\n raise ValueError(f\"Unknown repository type: {repo_type}\")\n path = files(\"inferrsi\").joinpath(\"harness\", \"data\", \"repo_packs\", repo_type, \"pack.json\")\n return json.loads(path.read_text(encoding=\"utf-8\"))" + "fragment_sha256": "1a22a089a2707ac64b9e304807d397562d8c50ff14a25a8a77158182f17a703c", + "source": "REPO_TYPES tuple and pack.json reader, and imports no inferrsi module.\n# K02 moved pack.json to the Harness resource root (D007). The anchor stays the\n# root package and joins the physical path, so reading a Harness-owned resource\n# never imports inferrsi.harness and never gives infra an edge into Harness.\nfrom __future__ import annotations\n\nimport json\nfrom importlib.resources import files\nfrom typing import Any\n\nREPO_TYPES = (\n \"vllm\", \"vllm_omni\", \"vllm_musa\", \"afd_plugin\", \"vllm_rlt\", \"strata\", \"sglang\", \"sglang_omni\"\n)\n\n\ndef repository_pack(repo_type: str) -> dict[str, Any]:\n if repo_type not in REPO_TYPES:\n raise ValueError(f\"Unknown repository type: {repo_type}\")\n path = files(\"inferrsi\").joinpath(\"harness\", \"data\", \"repo_packs\", repo_type, \"pack.json\")\n return json.loads(path.read_text(encoding=\"utf-8\"))" }, "resource_path_revision": { "stage": "K02", @@ -392,6 +392,19 @@ "to": "inferrsi.apps.host.inspection", "review": "The move changes which module the rule names, so it requires the same formal architecture review as the rule itself. Passing tests are not that review." } + }, + "registry_revision": { + "stage": "MUSA-R1", + "issue": null, + "pull_request": "MUSA backend and vllm_musa repository pack", + "reason": "The vllm_musa repository pack needs a REPO_TYPES entry, so the leaf's registry grew while the reader body stayed byte-identical.", + "previous_file_sha256": "751d7bf663318962a2e73cf9d75369e0f8f8c2bda27964c56e44021b9f86c992", + "file_sha256": "bddf8d146d14db887fcbc81d650a2101785303b3ea6f398d7f63af1cbd9c9371", + "added_repo_types": [ + "vllm_musa" + ], + "unchanged": "repository_pack(), allowed_imports, two_symbols, top_level_shape and both permitted importers are untouched; the K02 path expression and the C2 relocation identity remain historical records of the bytes that existed then and are not rewritten by this revision.", + "review": "Reviewable as an additive registry entry; unlike the K02 path revision it changes no expression inside the reader and self-approves nothing." } }, "infra_inspection_rewrite": { diff --git a/docs/musa.md b/docs/musa.md new file mode 100644 index 000000000..97c215d0c --- /dev/null +++ b/docs/musa.md @@ -0,0 +1,82 @@ +# MUSA (Moore Threads) backend + +`--backend musa` targets the Moore Threads MUSA plugin +([`MooreThreads/vllm-musa`](https://github.com/MooreThreads/vllm-musa)). It is a +discovery and measurement lane, not a validation claim: the adapter reports what +the host says, and every number still has to come from your own benchmark and +quality commands. + +## What the adapter does + +- Probes devices through `pymtml` (the pynvml-compatible MTML binding shipped by + `mthreads-ml-py`), in the interpreter you pass with `--python`, in a bounded + read-only subprocess. There is no `nvidia-smi`/`npu-smi` equivalent to require + and no MUSA context is initialized by the probe. +- Records `index`, `uuid`, `name`, driver version and total memory per device, + plus `MUSA_VISIBLE_DEVICES` in the environment snapshot. +- Registers `torch_musa`, `vllm-musa`, `mthreads-ml-py`, `torchada` and `mate` in + the dependency fingerprint, so a run records the compat layer it measured. +- Qualifies a campaign selection (`inferrsi.apps.host.platforms.musa.qualify_devices`) + by device count, SKU substring and an already-running compute process. An empty + process list only counts as idle when the device's used memory agrees + (`IDLE_USED_MIB`), because a vendor binding can implement the query without + implementing process accounting. A binding that reports neither fails. + +## Device identity caveat + +`pymtml` answers with **physical** device ids and is documented by the plugin as +unaffected by `MUSA_VISIBLE_DEVICES`, while `torch.musa` applies the logical +remapping. `--device-ids` therefore means physical ids. + +```bash +# Devices as the plugin sees them, then pin the same physical ids. +inferrsi doctor --repo ~/ws/vllm-musa --repo-type vllm_musa --backend musa \ + --python /path/to/musa/python --device-ids 0,1 --device-model "S5000" +``` + +A declared id only names the card that produced the tokens when the inherited +mask pins logical index `L` to that id. An unset mask is the runtime's implicit +identity view, so it binds `--device-ids 0` but not `--device-ids 1`. Discovery +and the dashboard signature share `logical_binding()` +(`inferrsi.apps.host.platforms`): a selection whose mask does not bind is +reported unverified and gets no comparable device identity. `qualify_devices` +returns each record with the `logical_index` the trial will use, so evidence can +state "verified physical N == logical L" explicitly. + +## First experiment + +```bash +inferrsi plan \ + --repo ~/ws/vllm-musa --repo-type vllm_musa --backend musa \ + --python /path/to/musa/python --device-ids 0 --device-model "S5000" \ + --baseline-command "bash bench.sh baseline {result}" \ + --candidate-command "bash bench.sh candidate {result}" \ + --validation-command "bash check_outputs.sh" \ + --metric-key latency_ms --direction minimize --repetitions 3 \ + --min-improvement-pct 3 --output-dir ~/campaigns/musa-first +inferrsi run ... # same flags, then read report.html +``` + +Commands are executed as `argv` (no shell). Wrap pipelines in a script and pass +`{result}` as the path your script must write the metric JSON to. + +## Lanes + +- **Text LLM**: `--repo-type vllm_musa`, scenarios `llm.decode` and + `llm.serving`. +- **Omni (image/video/audio)**: same repo type; scenarios + `diffusion.image_generation`, `diffusion.video_generation`, `audio.tts`. Build + from the MUSA Omni image so the pinned dependency set is part of the record. + +Knowledge: `repo_packs/vllm_musa/knowledge/`. Operating procedure: +[`skill_library/repositories/vllm-musa/SKILL.md`](../src/inferrsi/knowledge/data/skill_library/repositories/vllm-musa/SKILL.md). + +## Bounds + +- The probe was written against the plugin's `pymtml` usage and tested with + fixtures; it has not been executed against MUSA hardware in this repository. +- A `musa` descriptor is deliberately `unverified` in `pack.json`; device + discovery is not a compatibility or performance certification. +- Records under `repo_packs/vllm_musa/knowledge/` are source-derived + (`locally_verified: false`). CUDA and Ascend records remain scoped to their own + hardware. diff --git a/docs/operations.md b/docs/operations.md index fffb9246c..5fb7905b4 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -112,6 +112,27 @@ are distinct from `knowledge search`, whose package catalog filters backend, engine or kernel path is compatible. compatibility stays unverified. - **Example:** inferrsi doctor --repo . --repo-type vllm_omni --backend ascend --device-ids 0 --device-model 910B3 +### Discover Moore Threads MUSA devices — `doctor --backend musa` + +- **Inputs:** a prepared Git checkout and its existing repo type, target Python + (`--python`), optional repeatable `--device-ids` and one case-insensitive + `--device-model`. +- **Effect:** read-only. The bounded command runner starts a probe in the target + Python, imports `pymtml` (the pynvml-compatible MTML binding) and reads the + index, UUID, name, driver version and total memory of every device. MUSA + publishes no discovery CLI to require, and the probe creates no MUSA context. +- **Output:** those device records, plus `MUSA_VISIBLE_DEVICES` and the + `torch_musa`, `vllm-musa`, `mthreads-ml-py`, `torchada` and `mate` versions in + the environment snapshot. A requested ID and the requested model must match the + same record. A reached probe whose selection or record list is unusable is + reported `unavailable`, not `tool_available`. +- **Boundary:** the probe answers with physical ids. MTML is unaffected by + `MUSA_VISIBLE_DEVICES` while `torch.musa` applies the logical remapping, so a + matched record does not prove which logical device a trial measured; record the + mapping with the evidence. Discovery is not compatibility or performance + qualification, and the descriptor stays unverified. +- **Example:** `inferrsi doctor --repo . --repo-type vllm_musa --backend musa --python /opt/musa/bin/python --device-ids 0 --device-model S5000` + ### Search packaged records — `knowledge search` / `knowledge show` Use `find` for ordinary discovery. With no query, `knowledge search` lists diff --git a/docs/quickstart.md b/docs/quickstart.md index 636a06320..785aa69df 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -181,7 +181,7 @@ inferrsi plan \ Replace `plan` with `run` using the same flags after the plan matches your intended experiment. Script paths are templates that you supply; InferRSI does not create them. Start with one-variable, same-quality configuration optimization. Quantization, TeaCache, generation-step changes and adaptive exit require a quality-changing protocol and an explicit validation script. -On ROCm use `--backend rocm`; on Ascend use `--backend ascend`. The doctor retains raw backend output but does not certify device selection, model support or full topology. Record the actual driver/runtime/communication versions and topology with your experiment evidence. +On ROCm use `--backend rocm`; on Ascend use `--backend ascend`; on Moore Threads MUSA use `--backend musa` with `--repo-type vllm_musa` and `--python` pointing at the interpreter that has `pymtml`, because the probe runs there. The doctor retains raw backend output but does not certify device selection, model support or full topology. Record the actual driver/runtime/communication versions and topology with your experiment evidence. ## Native vLLM-Omni benchmark inside a trial script diff --git a/plugins/inferrsi-dsh/client.cjs b/plugins/inferrsi-dsh/client.cjs index 4f2893bb3..5fabcb0fe 100644 --- a/plugins/inferrsi-dsh/client.cjs +++ b/plugins/inferrsi-dsh/client.cjs @@ -440,7 +440,7 @@ function IterationForm({ sessionId, useSession, useSessions, useAccess, submitPr h('fieldset', { className: 'irsi-section' }, h('legend', null, '测试环境'), h('div', { className: 'irsi-fields' }, - field('backend', '硬件后端 *', { required: true, options: [['', '请选择'], ['gpu', 'GPU'], ['npu', 'NPU']] }), + field('backend', '硬件后端 *', { required: true, options: [['', '请选择'], ['gpu', 'GPU'], ['npu', 'NPU'], ['musa', 'MUSA']] }), field('execution', '运行位置', { options: [['local', '本机运行'], ['remote', '远程机器']] }), field('device', '设备与运行环境', { wide: true, maxLength: 1024, placeholder: '设备型号、卡数或已准备好的环境' }), field('benchmark', '已有基准脚本', { maxLength: 1024, placeholder: '仓库中的脚本路径' }), diff --git a/plugins/inferrsi-dsh/form.cjs b/plugins/inferrsi-dsh/form.cjs index a8e3c85a9..8c664e43b 100644 --- a/plugins/inferrsi-dsh/form.cjs +++ b/plugins/inferrsi-dsh/form.cjs @@ -1,5 +1,5 @@ const frameworks = ['auto', 'vllm', 'vllm-omni', 'sglang', 'pytorch', 'other']; -const backends = ['gpu', 'npu']; +const backends = ['gpu', 'npu', 'musa']; const planes = ['harness', 'model', 'infra']; const executions = ['local', 'remote']; const { isMap, isScalar, parseDocument } = require('./vendor/yaml.cjs'); @@ -15,7 +15,7 @@ optimization: plane: null # harness | model | infra objective: null # Use | for a multiline goal. environment: - backend: null # gpu | npu + backend: null # gpu | npu | musa execution: local # local | remote device: null benchmark: null @@ -156,7 +156,7 @@ function buildPrompt(form, connection) { '', '执行要求', '1. 校验目标仓库和运行环境,读取仓库的 AGENTS.md,加载 InferRSI 技能并检查随包运行时。', - ' backend 表示 GPU 或 NPU 硬件类别。检查设备后再选择受支持的实际运行时后端。execution=remote 时,使用 inferrsi_remote 工具和 remote.connectionId,在已经测试的远程仓库内开展工作;通过 cli 操作运行随包 InferRSI,通过 dashboard 操作打开转发后的实时页面。', + ' backend 表示 GPU、NPU 或 MUSA 硬件类别。检查设备后再选择受支持的实际运行时后端。execution=remote 时,使用 inferrsi_remote 工具和 remote.connectionId,在已经测试的远程仓库内开展工作;通过 cli 操作运行随包 InferRSI,通过 dashboard 操作打开转发后的实时页面。', '2. 优先使用用户提供的验收标准,包括 constraints 和 acceptance 引用中的已有条件,不得用估计值替换或降低门槛。未提供验收标准时,使用仓库的 performance-ceiling-analysis 技能及其 acceptance-criteria.md 流程制定标准;部分提供时保留已有要求,只推导缺失项并标明来源。记录基线、校准依据、不确定性和已有冻结授权;理论上限不能直接当作可达目标或质量容差。条件冲突时先澄清,证据不足时列出缺口和补测计划。冻结 baseline、工作负载、验证器和数值门槛后再开始候选实验。', '3. 在用户选择的 plane 范围内逐轮提出假设、修改、比较和决策。使用 maxRounds 限制优化迭代轮数,使用 maxMinutes 限制总时间。每轮中的 A/B 重复测量次数由冻结计划确定。到达预算后停止新实验并汇报当前证据。', '4. 使用现有 InferRSI CLI 和目标仓库的基准、质量脚本。远程 run_script 必须传入 maxMinutes,远程长时间 cli 操作也传入该参数,按任务剩余总时间预算设置,不能为每次调用重新分配完整预算。保留现有用户改动,遵守已有资源和执行授权。复用已准备好的目标环境。', diff --git a/src/inferrsi/apps/cli/arguments.py b/src/inferrsi/apps/cli/arguments.py index 549694cb5..8085cadd4 100644 --- a/src/inferrsi/apps/cli/arguments.py +++ b/src/inferrsi/apps/cli/arguments.py @@ -59,7 +59,8 @@ def _common(parser: argparse.ArgumentParser) -> None: ) parser.add_argument( "--device-model", - help="Expected CUDA device model or Apple Silicon chip (case-insensitive match)", + help="Expected device model for the selected backend, e.g. a CUDA SKU, an " + "Apple Silicon chip or a MUSA SKU (case-insensitive match)", ) parser.add_argument( "--python", default=sys.executable, help="Python used for target package inspection" diff --git a/src/inferrsi/apps/host/environment.py b/src/inferrsi/apps/host/environment.py index 8d4145a27..1b0ad0f9f 100644 --- a/src/inferrsi/apps/host/environment.py +++ b/src/inferrsi/apps/host/environment.py @@ -40,6 +40,11 @@ def dependency_versions(): "nvidia-nccl-cu12", "nvidia-nccl-cu13", "flashinfer-python", + "torch_musa", + "vllm-musa", + "mthreads-ml-py", + "torchada", + "mate", ) code = ( "import importlib.metadata as metadata,json,sys\n" diff --git a/src/inferrsi/apps/host/inspection.py b/src/inferrsi/apps/host/inspection.py index 1726a355d..785189569 100644 --- a/src/inferrsi/apps/host/inspection.py +++ b/src/inferrsi/apps/host/inspection.py @@ -30,7 +30,8 @@ def inspect_environment( "import json,sys,importlib.metadata as m\n" "names=['torch','vllm','vllm-omni','vllm-afd-plugin','vllm-rlt','torch-npu'," "'nvidia-nccl-cu12','nvidia-nccl-cu13','nvidia-cuda-runtime-cu12'," - "'nvidia-cuda-runtime-cu13','mlx']\n" + "'nvidia-cuda-runtime-cu13','mlx','torch_musa','vllm-musa','mthreads-ml-py'," + "'torchada','mate']\n" "packages={}\n" "for name in names:\n" " try:\n" @@ -47,7 +48,11 @@ def inspect_environment( python_info["parse_error"] = "Target Python did not emit a JSON environment" device = inspect_device( - backend, device_ids=device_ids, device_model=device_model, command=command + backend, + device_ids=device_ids, + device_model=device_model, + command=command, + python=python, ) return { @@ -64,6 +69,7 @@ def inspect_environment( "HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES", "ASCEND_RT_VISIBLE_DEVICES", + "MUSA_VISIBLE_DEVICES", ) }, "target_python": python_info, diff --git a/src/inferrsi/apps/host/platforms/__init__.py b/src/inferrsi/apps/host/platforms/__init__.py index 6d712ef3d..ce23b243d 100644 --- a/src/inferrsi/apps/host/platforms/__init__.py +++ b/src/inferrsi/apps/host/platforms/__init__.py @@ -5,6 +5,27 @@ from .cuda import inspect_devices as inspect_cuda from .mlx import inspect_devices as inspect_mlx +from .musa import inspect_devices as inspect_musa + + +def logical_binding(declared, mask) -> bool: + """True when the inherited visibility mask pins logical index L to `declared[L]`. + + Accelerator runtimes map their visibility variable positionally: entry L is + the card the workload reaches as device ``L``. An unset (or empty) mask is + the runtime's implicit identity view, so a declared selection of ``[1]`` is + *not* bound -- the workload's device 0 is physical card 0 -- while ``[0]`` + is. Callers use this to decide whether a recorded card identity can be + compared across runs, never to guess. + """ + requested = [str(item).strip() for item in declared] + if not requested: + return False + if isinstance(mask, str) and mask.strip(): + entries = [item.strip() for item in mask.split(",") if item.strip()] + else: + entries = [str(index) for index in range(len(requested))] + return entries == requested def tool_facts(probe: dict) -> dict: @@ -112,7 +133,7 @@ def inspect_cpu(**kwargs): } -def inspect_rocm(*, command, device_ids=(), device_model=None, **kwargs): +def inspect_rocm(*, command, device_ids=(), device_model=None, python=None, **kwargs): return parsed_tool_facts( command(["rocminfo"]), device_ids=device_ids, @@ -122,7 +143,7 @@ def inspect_rocm(*, command, device_ids=(), device_model=None, **kwargs): ) -def inspect_ascend(*, command, device_ids=(), device_model=None, **kwargs): +def inspect_ascend(*, command, device_ids=(), device_model=None, python=None, **kwargs): return parsed_tool_facts( command(["npu-smi", "info"]), device_ids=device_ids, @@ -139,15 +160,17 @@ def inspect_ascend(*, command, device_ids=(), device_model=None, **kwargs): "cuda": inspect_cuda, "rocm": inspect_rocm, "ascend": inspect_ascend, + "musa": inspect_musa, "mlx": inspect_mlx, } -def inspect_device(backend, *, device_ids, device_model, command): +def inspect_device(backend, *, device_ids, device_model, command, python=None): if backend not in PLATFORM_PROBES: raise ValueError(f"Unknown backend: {backend}") return PLATFORM_PROBES[backend]( device_ids=device_ids, device_model=device_model, command=command, + python=python, ) diff --git a/src/inferrsi/apps/host/platforms/cuda.py b/src/inferrsi/apps/host/platforms/cuda.py index 300f09599..c4bd3a8aa 100644 --- a/src/inferrsi/apps/host/platforms/cuda.py +++ b/src/inferrsi/apps/host/platforms/cuda.py @@ -7,7 +7,7 @@ import subprocess -def inspect_devices(*, device_ids, device_model, command): +def inspect_devices(*, device_ids, device_model, command, python=None): from . import tool_facts device = tool_facts( diff --git a/src/inferrsi/apps/host/platforms/mlx.py b/src/inferrsi/apps/host/platforms/mlx.py index 2b77246d1..4efbcb1e3 100644 --- a/src/inferrsi/apps/host/platforms/mlx.py +++ b/src/inferrsi/apps/host/platforms/mlx.py @@ -21,7 +21,7 @@ def _model_names(chip: str) -> set[str]: return {name, name.removeprefix("apple ")} -def inspect_devices(*, device_ids, device_model, command): +def inspect_devices(*, device_ids, device_model, command, python=None): result = {"status": "unavailable", "tool": "sysctl", "selection_verified": False} if device_ids: result["reason"] = "MLX discovery does not support discrete device IDs (unified memory)" diff --git a/src/inferrsi/apps/host/platforms/musa.py b/src/inferrsi/apps/host/platforms/musa.py new file mode 100644 index 000000000..43ec33876 --- /dev/null +++ b/src/inferrsi/apps/host/platforms/musa.py @@ -0,0 +1,321 @@ +"""Moore Threads (MUSA) device reservation checks through the MTML bindings. + +`pymtml` is the pynvml-compatible shim shipped by mthreads-ml-py, and it is the +same binding vLLM-MUSA itself uses for platform queries, so no vendor CLI has to +exist on the target host. The probe is a bounded, read-only subprocess: it +imports pymtml only, never torch, and never initializes a MUSA context. +""" + +import json +import os +import subprocess +import sys +import textwrap + +PROBE_CODE = textwrap.dedent( + """ + import json + try: + import pymtml as pynvml + except Exception as exc: + print(json.dumps({"error": "pymtml unavailable: %s" % exc})) + raise SystemExit(3) + + def text(value): + return value.decode() if isinstance(value, bytes) else str(value) + + try: + pynvml.nvmlInit() + except Exception as exc: + print(json.dumps({"error": "nvmlInit failed: %s" % exc})) + raise SystemExit(4) + try: + try: + driver_version = text(pynvml.nvmlSystemGetDriverVersion()) + except Exception: + driver_version = None + devices = [] + for index in range(pynvml.nvmlDeviceGetCount()): + # One unreadable device must not hide the others: keep the identity + # fields above the failure and report the device-local error. + record = {"index": str(index)} + try: + handle = pynvml.nvmlDeviceGetHandleByIndex(index) + except Exception as exc: + record["error"] = "%s: %s" % (type(exc).__name__, exc) + devices.append(record) + continue + try: + record["uuid"] = text(pynvml.nvmlDeviceGetUUID(handle)) + record["name"] = text(pynvml.nvmlDeviceGetName(handle)) + except Exception as exc: + record["error"] = "%s: %s" % (type(exc).__name__, exc) + if driver_version: + record["driver_version"] = driver_version + try: + memory = pynvml.nvmlDeviceGetMemoryInfo(handle) + record["memory_total_mib"] = int(memory.total) >> 20 + except Exception: + pass + devices.append(record) + print(json.dumps({"devices": devices})) + finally: + try: + pynvml.nvmlShutdown() + except Exception: + pass + """ +) + +# MUSA has no nvidia-smi/npu-smi equivalent that is guaranteed to be installed, +# so process ownership is read through the same MTML bindings. A binding that +# cannot answer is *not* an idle device: the probe reports the failure and exits +# non-zero so qualification cannot mistake "unknown" for "free". A binding can +# also implement the query without implementing accounting and answer "no +# processes" on a card that is in use, so the reply carries the device's used +# memory as an independent signal and an empty list only counts as idle when the +# memory figure agrees. +IDLE_USED_MIB = 256 + +BUSY_CODE = textwrap.dedent( + """ + import json + import sys + + def fail(reason): + print(json.dumps({"error": reason})) + raise SystemExit(3) + + try: + import pymtml as pynvml + except Exception as exc: + fail("pymtml unavailable: %s" % exc) + try: + pynvml.nvmlInit() + except Exception as exc: + fail("nvmlInit failed: %s" % exc) + try: + query = getattr(pynvml, "nvmlDeviceGetComputeRunningProcesses", None) + if query is None: + fail("nvmlDeviceGetComputeRunningProcesses is unavailable") + memory_info = getattr(pynvml, "nvmlDeviceGetMemoryInfo", None) + busy = [] + usage = [] + for index in sys.argv[1].split(","): + handle = pynvml.nvmlDeviceGetHandleByIndex(int(index)) + for process in query(handle) or (): + busy.append({"device": index, "pid": int(process.pid)}) + used = None + if memory_info is not None: + try: + memory = memory_info(handle) + used = getattr(memory, "used", None) + if used is None: + used = int(memory.total) - int(memory.free) + used = int(used) >> 20 + except Exception: + used = None + usage.append({"device": index, "used_mib": used}) + print(json.dumps({"processes": busy, "usage": usage})) + except SystemExit: + raise + except Exception as exc: + fail("process query failed: %s" % exc) + finally: + try: + pynvml.nvmlShutdown() + except Exception: + pass + """ +) + + +def _records(stdout: str) -> list[dict]: + try: + document = json.loads(stdout) + except json.JSONDecodeError: + return [] + devices = document.get("devices") if isinstance(document, dict) else None + if not isinstance(devices, list): + return [] + records = [] + for device in devices: + # A device the probe could not identify keeps its error in the raw output + # but cannot qualify a selection, so it is not a record here. + if not isinstance(device, dict) or not device.get("index") or not device.get("name"): + continue + record = dict(device) + # parsed_tool_facts qualifies a selection on the tool-neutral `id` field. + record["id"] = device["index"] + records.append(record) + return records + + +def _visibility_ids() -> list[str]: + """Read the mask the trial process inherits, in its positional order.""" + return [ + item.strip() + for item in os.environ.get("MUSA_VISIBLE_DEVICES", "").split(",") + if item.strip() + ] + + +def inspect_devices(*, device_ids, device_model, command, python=None): + from . import parsed_tool_facts + + device = parsed_tool_facts( + command([python or sys.executable, "-c", PROBE_CODE]), + device_ids=device_ids, + device_model=device_model, + tokens="pymtml", + records=_records, + ) + # parsed_tool_facts keeps a reached tool at "tool_available" even when the + # selection or the device list is unusable; the run gate only admits + # "available", so fail loudly instead of reporting a misleading status. + if device["status"] == "tool_available" and device.get("reason"): + device["status"] = "unavailable" + # Discovery sees every physical card; the trial sees only the masked, + # positional view. When those disagree the verified physical device is not + # the device the run will use, so the selection stays unverified rather + # than borrowing a signature from a different card. + from . import logical_binding + + requested = [str(item) for item in (device_ids or ())] + mask = os.environ.get("MUSA_VISIBLE_DEVICES") + if device["selection_verified"] and requested and not logical_binding(requested, mask): + device["selection_verified"] = False + device["status"] = "unavailable" + device["reason"] = ( + "MUSA_VISIBLE_DEVICES does not bind the declared devices to the run's " + f"logical indices: declared {requested}, mask {mask or 'unset'}. Set " + "MUSA_VISIBLE_DEVICES to the declared ids in order, so musa:0 is the " + "first declared card" + ) + return device + + +def qualify_devices(*, count: int, device_model: str, python=None): + """Fail unless `count` caller-reserved MUSA devices are idle and all match. + + Mirrors :func:`inferrsi.apps.host.platforms.cuda.qualify_devices` for a prepared + MUSA host: the selection comes from MUSA_VISIBLE_DEVICES, the expected model + is matched against pymtml's device name, and an already-running compute + process on a selected device aborts the campaign. + + Identity contract: ``MUSA_VISIBLE_DEVICES`` is positional -- the runtime maps + its first entry to ``musa:0`` regardless of which physical card that entry + names -- so qualification accepts only physical integer ids and returns each + record with the ``logical_index`` the trial will use. Callers must keep both + numbers in the evidence; without them a verdict cannot distinguish the card + that was checked free from the card that produced the tokens. An unknown + process state (import failure, init failure, no query API, unreadable reply) + is a failure, never an idle device, and a UUID selection is rejected because + its positional mapping cannot be reconciled with the verified physical card. + + A caller that needs a non-identity selection declares the physical ids in + mask order -- logical index L is the L-th entry -- and must not pass a + physical id that the mask does not place at that position. Discovery + (``inspect_devices``) rejects such a mismatch outright. + """ + if isinstance(count, bool) or not isinstance(count, int) or count < 1 or not device_model: + raise ValueError("A positive device count and device model are required") + ids = [ + item.strip() + for item in os.environ.get("MUSA_VISIBLE_DEVICES", "").split(",") + if item.strip() + ] + if len(ids) != count or len(set(ids)) != count: + raise ValueError( + f"Set MUSA_VISIBLE_DEVICES to exactly {count} caller-reserved {device_model} IDs" + ) + # MUSA_VISIBLE_DEVICES is a positional namespace: the engine maps its first + # entry to `musa:0`, not the physical card the entry names. Accepting a UUID + # here would verify one card and let the trial run on another, so only + # physical integer ids are supported and the mapping is reported back. + if any(not item.isdigit() for item in ids): + raise ValueError( + "MUSA_VISIBLE_DEVICES must list physical integer device ids; UUID " + "selections are not supported because the runtime maps the variable " + "by position and would not run the verified physical card" + ) + result = subprocess.run( + [python or sys.executable, "-c", PROBE_CODE], + check=True, + capture_output=True, + text=True, + timeout=30, + ) + devices = _records(result.stdout) + selected = [device for device in devices if device["index"] in ids] + if len(selected) != count or any( + device_model.casefold() not in device["name"].casefold() for device in selected + ): + raise ValueError( + f"The {count} requested physical devices must all be {device_model}; " + "inspect the pymtml mapping" + ) + # Query the resolved physical indices, never the caller's raw entries: a raw + # entry can be a UUID that `int()` in the probe would reject before the + # process query ever runs. + busy = subprocess.run( + [python or sys.executable, "-c", BUSY_CODE, ",".join(ids)], + capture_output=True, + text=True, + timeout=30, + ) + if busy.returncode != 0: + reason = "unreadable reply" + try: + reason = json.loads(busy.stdout).get("error") or reason + except (json.JSONDecodeError, AttributeError): + pass + raise ValueError( + f"Cannot verify that the selected MUSA devices are idle: {reason}. " + "Qualification refuses an unknown device state" + ) + try: + report = json.loads(busy.stdout or "") + except json.JSONDecodeError as error: + raise ValueError( + "Cannot verify that the selected MUSA devices are idle: the process " + "query returned unreadable output" + ) from error + if not isinstance(report, dict) or "processes" not in report: + raise ValueError( + "Cannot verify that the selected MUSA devices are idle: the process " + "query did not report a process list" + ) + if report["processes"]: + raise ValueError( + "An allocated MUSA device already has a compute process; " + "do not overlap campaign trials" + ) + # An empty process list is only evidence when an independent signal agrees: + # a binding can answer "no processes" without implementing accounting. + usage = report.get("usage") + if not isinstance(usage, list) or len(usage) != len(ids): + raise ValueError( + "Cannot verify that the selected MUSA devices are idle: the process " + "query reported no per-device memory usage" + ) + for row in usage: + used = row.get("used_mib") if isinstance(row, dict) else None + if not isinstance(used, int) or isinstance(used, bool): + raise ValueError( + "Cannot verify that the selected MUSA devices are idle: the " + "binding reports no used memory, so an empty process list proves " + "nothing" + ) + if used > IDLE_USED_MIB: + raise ValueError( + f"MUSA device {row.get('device')} is using {used} MiB while the " + "process query reported no processes; that binding's process " + "accounting cannot be trusted" + ) + # Report the physical->logical mapping the trial will use, so evidence ties + # the measured device to the verified one. + order = {value: position for position, value in enumerate(ids)} + for device in selected: + device["logical_index"] = order[device["index"]] + return selected diff --git a/src/inferrsi/apps/views/dashboard_data.py b/src/inferrsi/apps/views/dashboard_data.py index 113832e99..d60d771f3 100644 --- a/src/inferrsi/apps/views/dashboard_data.py +++ b/src/inferrsi/apps/views/dashboard_data.py @@ -333,7 +333,7 @@ def _events(path: Path, root: Path, expected: dict | None = None, unique_candida def _environment_signature(environment: dict, devices: object, backend: object) -> tuple | None: """Compare verified device/runtime identity privately; never expose it in the view.""" - if backend not in ("cuda", "ascend") or not isinstance(devices, list) or not devices: + if backend not in ("cuda", "ascend", "musa") or not isinstance(devices, list) or not devices: return None device = environment.get("device") host = environment.get("host") @@ -363,6 +363,31 @@ def _environment_signature(environment: dict, devices: object, backend: object) for k in ("torch_npu", "vllm_ascend")): return None runtime_identity = (ascend["cann_version"], ascend["firmware_version"]) + elif backend == "musa": + # The plugin and the compat layer decide what a MUSA run measured. Their + # versions already ride in the package tuple, so nothing extra is + # appended here; a matching torch/vllm pair alone is not a MUSA run, and + # the per-device driver version is part of the selected device fields. + if not all(isinstance(packages.get(k), str) and packages[k] + for k in ("torch_musa", "vllm-musa")): + return None + # MUSA_VISIBLE_DEVICES is positional, so the same declared physical ids + # can drive different cards. Only an identity mask binds the verified + # card to the executed one; anything else stays unverified instead of + # joining a comparable group on a borrowed identity. + from inferrsi.apps.host.platforms import logical_binding + + visible = environment.get("visible_devices") + if not isinstance(visible, dict) or "MUSA_VISIBLE_DEVICES" not in visible: + return None + mask = visible["MUSA_VISIBLE_DEVICES"] + if mask is not None and not isinstance(mask, str): + return None + # Only a mask that pins logical index L to the declared card L proves + # which physical device produced the tokens; an unset mask is the + # runtime's implicit identity view, which binds [0] but not [1]. + if not logical_binding(devices, mask): + return None selected = [] for identity in devices: matches = [row for row in device["devices"] if isinstance(row, dict) diff --git a/src/inferrsi/harness/data/repo_packs/vllm_musa/pack.json b/src/inferrsi/harness/data/repo_packs/vllm_musa/pack.json new file mode 100644 index 000000000..e0ec8ddfa --- /dev/null +++ b/src/inferrsi/harness/data/repo_packs/vllm_musa/pack.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "id": "vllm_musa", + "source_repository": "MooreThreads/vllm-musa", + "execution_support": "caller_supplied_external_commands", + "scenarios": [ + "llm.decode", + "llm.serving", + "diffusion.image_generation", + "diffusion.video_generation", + "audio.tts" + ], + "backend_compatibility": { + "cuda": "unverified", + "rocm": "unverified", + "ascend": "unverified", + "musa": "unverified" + }, + "notes": [ + "This descriptor does not claim a built-in model launcher or a validated accelerator matrix.", + "The MUSA plugin runs CUDA-oriented source through torchada and dispatches tuned kernels through MATE, so a CUDA or Ascend result is not a MUSA result.", + "Freeze the plugin revision, the upstream vLLM version, the MUSA toolkit and the model checkpoint before measuring." + ] +} diff --git a/src/inferrsi/knowledge/_skill_selection.py b/src/inferrsi/knowledge/_skill_selection.py index 910b09623..dc096f8c5 100644 --- a/src/inferrsi/knowledge/_skill_selection.py +++ b/src/inferrsi/knowledge/_skill_selection.py @@ -12,8 +12,12 @@ TASK_STOP_WORDS = frozenset({"a", "an", "and", "for", "in", "of", "on", "the", "to", "with"}) _BACKEND_TERMS = { - "cuda": {"cuda", "nvidia"}, "rocm": {"rocm", "amd"}, - "ascend": {"ascend", "cann"}, "mlx": {"mlx"}, "cpu": {"cpu"}, + "cuda": {"cuda", "nvidia"}, + "rocm": {"rocm", "amd"}, + "ascend": {"ascend", "cann"}, + "musa": {"musa", "mthreads"}, + "mlx": {"mlx"}, + "cpu": {"cpu"}, } diff --git a/src/inferrsi/knowledge/catalog.py b/src/inferrsi/knowledge/catalog.py index 8972a3e11..c5328fc3f 100644 --- a/src/inferrsi/knowledge/catalog.py +++ b/src/inferrsi/knowledge/catalog.py @@ -31,7 +31,7 @@ KNOWLEDGE_REPOS = tuple( dict.fromkeys(repo for repos in KNOWLEDGE_SCOPES.values() for repo in repos) ) -BACKENDS = ("cpu", "cuda", "rocm", "ascend", "mlx") +BACKENDS = ("cpu", "cuda", "rocm", "ascend", "musa", "mlx") SCENARIO_ALIASES = { "diffusion.t2i": "diffusion.image_generation", "diffusion.t2v": "diffusion.video_generation", diff --git a/src/inferrsi/knowledge/data/skill_library/README.md b/src/inferrsi/knowledge/data/skill_library/README.md index be0c2b2a0..f49023b02 100644 --- a/src/inferrsi/knowledge/data/skill_library/README.md +++ b/src/inferrsi/knowledge/data/skill_library/README.md @@ -5,7 +5,7 @@ by the requested outcome, runs `inferrsi skills enter ` and reads the returned procedure before the first supporting evidence search. Use the actual model, device, engine version, script, gates and diagnosis to decide which supporting skill to load next. The [compatibility router](tasks/inference-task-router/SKILL.md) retains older route -resource paths. The library has 88 registered bundles and 151 English +resource paths. The library has 89 registered bundles and 152 English `SKILL.md` documents, including nested and unregistered entries. | Question | Directory | Choose a second-level category | @@ -27,7 +27,7 @@ existing resource directory. ## Read registered skills -[`skill-index.json`](skill-index.json) maps 88 stable skill IDs to their canonical +[`skill-index.json`](skill-index.json) maps 89 stable skill IDs to their canonical paths and backend scopes. Install the optional `skills` extra for these commands: ```bash diff --git a/src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.diffusion.omni_image_porting.json b/src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.diffusion.omni_image_porting.json new file mode 100644 index 000000000..51da6ae35 --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.diffusion.omni_image_porting.json @@ -0,0 +1,87 @@ +{ + "id": "vllm_musa.musa.diffusion.omni_image_porting", + "title": "The MUSA vLLM-Omni image pins the existing MUSA stack, so CUDA-only Omni kernels are excluded before any tuning starts", + "backend": "musa", + "scenario": "diffusion.image_generation", + "summary": "The vLLM-Omni MUSA image builds vllm-omni with VLLM_OMNI_TARGET_DEVICE=musa against the MUSA base image and constrains the install to the already-present torch/torch_musa/torchada/triton/mate/vllm/vllm-musa set, then fails the build if any of them changes. Omni optimizations that depend on CUDA-only distributions such as flash_attn_3 or flash_mla therefore cannot be the mechanism behind a MUSA gain; the reachable levers are the generic or MATE-backed paths and the engine-side scheduling, caching and batching decisions.", + "tags": [ + "vllm_omni", + "docker", + "dependency_pinning", + "flash_attn", + "flash_mla", + "mate", + "porting" + ], + "sources": [ + { + "url": "https://github.com/MooreThreads/vllm-musa/blob/666d6f96d6e6ccc5439821f3c3ca34d049e3f176/docker/vllm-omni.Dockerfile", + "type": "source_code", + "commit": "666d6f96d6e6ccc5439821f3c3ca34d049e3f176", + "accessed_at": "2026-11-18" + }, + { + "url": "https://github.com/MooreThreads/vllm-musa/commit/666d6f96d6e6ccc5439821f3c3ca34d049e3f176", + "type": "commit", + "commit": "666d6f96d6e6ccc5439821f3c3ca34d049e3f176", + "status": "merged", + "accessed_at": "2026-11-18" + } + ], + "applicability": { + "hardware": [ + "Moore Threads MUSA GPU; the image does not state a single SKU" + ], + "software": [ + "MooreThreads/vllm-musa at 666d6f96d6e6ccc5439821f3c3ca34d049e3f176", + "The MUSA base image that installs torch, torch_musa, torchada, triton, mate, vllm and vllm-musa", + "vllm-omni built from source inside that image with VLLM_OMNI_TARGET_DEVICE=musa" + ], + "models": [ + "vLLM-Omni image, video and audio models served by this image" + ], + "conditions": [ + "Applies to the Docker lane; a hand-built environment can still add CUDA-only wheels and is then out of scope", + "Does not claim that any particular Omni model serves correctly on MUSA" + ] + }, + "claims": [ + { + "kind": "source_code", + "description": "The Dockerfile sets VLLM_OMNI_TARGET_DEVICE=musa for the vllm-omni build so setup.py does not fall back to CPU when no GPU is visible during the build." + }, + { + "kind": "source_code", + "description": "It writes the installed versions of flash_attn_3, flash_mla, mate, torch, torch_musa, torchada, triton, vllm and vllm-musa to a constraints file, installs vllm-omni under that constraint, and fails the build if any constrained distribution changed." + }, + { + "kind": "source_code", + "description": "Its smoke step imports torchada, torch, torch_musa, vllm, vllm_musa and vllm_omni and asserts torch.version.musa is not None, so a broken compat layer fails the image build rather than the serving run." + } + ], + "recommendations": [ + "State the image tag, the pinned constraint set and the vllm-omni revision with every Omni measurement; the constraint check makes any drift an explicit build failure.", + "Exclude optimization ideas whose mechanism is a CUDA-only distribution; they cannot be the cause of a change inside this lane.", + "Prefer engine-level levers that survive the constraint set: request and conditioning reuse, per-step work shared across denoise steps, tile or batch geometry, and the attention path the build actually ships.", + "Treat a CUDA Omni result as a hypothesis to re-measure here, not as an expected effect size." + ], + "validation_plan": [ + "Record the built image digest and the printed constraint list before measuring.", + "Profile one denoise step and one VAE decode step on MUSA to see which kernels are actually resident.", + "Run an AB/BA pair on identical prompts and seeds, checking outputs pixel-identical where the change claims to be lossless.", + "Repeat the pair after restarting the service to separate warm-up effects from the candidate." + ], + "limitations": [ + "Source-derived from the Dockerfile; this record was not validated by building the image or serving a model.", + "The Dockerfile at this commit may have been revised later; re-read it at the revision you actually use.", + "Constraint pinning proves dependency identity, not numerical or performance equivalence." + ], + "schema_version": 1, + "repo": "vllm_musa", + "component": "diffusion", + "status": "imported", + "verification": { + "locally_verified": false, + "evidence_level": "guidance" + } +} diff --git a/src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.llm.physical_device_identity.json b/src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.llm.physical_device_identity.json new file mode 100644 index 000000000..f50de1ffc --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.llm.physical_device_identity.json @@ -0,0 +1,83 @@ +{ + "id": "vllm_musa.musa.llm.physical_device_identity", + "title": "MUSA device identity: pymtml reports physical ids, MUSA_VISIBLE_DEVICES remaps only torch", + "backend": "musa", + "scenario": "llm.serving", + "summary": "The plugin's MTML/pymtml path answers with physical device ids and is explicitly documented as unaffected by MUSA_VISIBLE_DEVICES, while torch.musa applies logical ids. A campaign that pins cards only through MUSA_VISIBLE_DEVICES can therefore measure a different physical device than the one it names, and two arms can land on different cards.", + "tags": [ + "device_selection", + "pymtml", + "mtml", + "musa_visible_devices", + "measurement_identity", + "trap" + ], + "sources": [ + { + "url": "https://github.com/MooreThreads/vllm-musa/blob/7d5371a5ecfd1e04ea303f847e75cf3747e92fcd/vllm_musa/platform.py", + "type": "source_code", + "commit": "7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", + "accessed_at": "2026-11-18" + }, + { + "url": "https://github.com/MooreThreads/vllm-musa/commit/7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", + "type": "commit", + "commit": "7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", + "status": "merged", + "accessed_at": "2026-11-18" + } + ], + "applicability": { + "hardware": [ + "Moore Threads MUSA GPU; the SKU and driver are not stated by the cited source" + ], + "software": [ + "MooreThreads/vllm-musa at 7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", + "torch_musa plus mthreads-ml-py (pymtml); torchada is imported by the plugin" + ], + "models": [ + "Any model served through the vllm-musa platform plugin" + ], + "conditions": [ + "Applies whenever MUSA_VISIBLE_DEVICES is set to a subset or a reordering", + "The cited commit also removed a baked MUSA_VISIBLE_DEVICES=all default from the image" + ] + }, + "claims": [ + { + "kind": "source_code", + "description": "platform.py states that MTML is not affected by MUSA_VISIBLE_DEVICES and that its functions work on real physical device ids." + }, + { + "kind": "source_code", + "description": "The MtmlMUSAPlatform device-capability path carries an explicit note that torch.musa uses logical ids while pymtml does not remap, so it queries the handle by the caller-supplied id." + }, + { + "kind": "review_finding", + "description": "Because only torch applies the remapping, an experiment that selects devices solely through MUSA_VISIBLE_DEVICES has no guarantee that a vendor-tool reading of card N and a torch reading of device N refer to the same physical card." + } + ], + "recommendations": [ + "Record the physical id, UUID and name read through pymtml for every campaign arm, not only the MUSA_VISIBLE_DEVICES string.", + "Prefer selecting devices by UUID when the harness supports it; otherwise pin both the physical ids and the env remapping and state the mapping in the evidence.", + "Before comparing arms, assert the same physical UUID set on both sides; a differing UUID set invalidates the comparison even when the env string is identical." + ], + "validation_plan": [ + "On the target host, print pymtml index/UUID/name and torch.musa device properties with and without MUSA_VISIBLE_DEVICES set, and record both.", + "Run one pair of arms with the identical physical UUID set and confirm the harness reports the same device identity for both.", + "Repeat with a reordered MUSA_VISIBLE_DEVICES to confirm the trap and to show the identity check catches it." + ], + "limitations": [ + "Source-derived reading of the plugin; it was not exercised on MUSA hardware while this record was written.", + "The exact remapping semantics belong to torch_musa and may change independently of the plugin.", + "A UUID check proves identity, not performance; it is a precondition for a valid A/B comparison only." + ], + "schema_version": 1, + "repo": "vllm_musa", + "component": "llm", + "status": "imported", + "verification": { + "locally_verified": false, + "evidence_level": "guidance" + } +} diff --git a/src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.llm.torchada_dispatch_boundary.json b/src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.llm.torchada_dispatch_boundary.json new file mode 100644 index 000000000..e281b0d28 --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/records/vllm_musa.musa.llm.torchada_dispatch_boundary.json @@ -0,0 +1,81 @@ +{ + "id": "vllm_musa.musa.llm.torchada_dispatch_boundary", + "title": "torchada makes CUDA source run on MUSA, so verify the dispatched kernel instead of assuming a CUDA tuning result carries over", + "backend": "musa", + "scenario": "llm.serving", + "summary": "The plugin imports torchada before torch so that torch.cuda/torch.device are redirected to MUSA, and the platform plugin treats torchada.is_musa_platform() as its primary signal. A CUDA-shaped fast path can therefore be present in the source and still be executed by a different implementation on MUSA; an optimization must be attributed to the kernel that actually ran.", + "tags": [ + "torchada", + "dispatch", + "porting", + "measurement", + "cuda_compat" + ], + "sources": [ + { + "url": "https://github.com/MooreThreads/vllm-musa/blob/7d5371a5ecfd1e04ea303f847e75cf3747e92fcd/vllm_musa/__init__.py", + "type": "source_code", + "commit": "7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", + "accessed_at": "2026-11-18" + }, + { + "url": "https://github.com/MooreThreads/vllm-musa/blob/7d5371a5ecfd1e04ea303f847e75cf3747e92fcd/vllm_musa/platform.py", + "type": "source_code", + "commit": "7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", + "accessed_at": "2026-11-18" + } + ], + "applicability": { + "hardware": [ + "Moore Threads MUSA GPU; no SKU-specific claim is made here" + ], + "software": [ + "MooreThreads/vllm-musa at 7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", + "torchada, torch_musa and the pinned MUSA toolchain of that revision" + ], + "models": [ + "Any model whose kernels were tuned on CUDA and then run unchanged on MUSA" + ], + "conditions": [ + "Relevant to any port of a CUDA-only optimization, including fused ops, graph capture and attention backends", + "Not a claim that a specific CUDA optimization is unavailable on MUSA" + ] + }, + "claims": [ + { + "kind": "source_code", + "description": "__init__.py imports torchada before torch, with a comment that this must happen before any torch.device(\"cuda:X\") call because it patches torch.cuda to redirect to MUSA." + }, + { + "kind": "source_code", + "description": "musa_platform_plugin() returns the MUSA platform when torchada.is_musa_platform() is true and otherwise falls back to importing torch_musa, so availability of the compat layer is itself part of the runtime identity." + }, + { + "kind": "review_finding", + "description": "A CUDA-specific optimization can compile and run through the compatibility layer without exercising the kernel its CUDA result was measured on; a gain measured on CUDA is therefore a hypothesis about MUSA, not evidence for it." + } + ], + "recommendations": [ + "Record torchada, torch_musa, torch and the MUSA toolkit versions next to every measurement; a different compat-layer revision is a different runtime.", + "Attribute a gain to a named kernel or graph from a profile, and keep the profile beside the engine-level number.", + "When porting a CUDA fast path, first prove the target backend is selected (dispatch check), then measure; a fallback path that silently wins is the common false positive." + ], + "validation_plan": [ + "Profile one steady-state step on MUSA and list the top kernels; confirm the intended kernel names appear rather than generic or fallback ones.", + "Compare against the same step with the candidate disabled, holding device, dtype, shapes and warmup identical.", + "Re-run the A/B after pinning the compat-layer versions to show the result is not version drift." + ], + "limitations": [ + "Source-derived reading; no MUSA hardware measurement backed this record.", + "Kernel names and dispatch rules depend on the exact torchada/torch_musa/plugin tuple.", + "This record does not name which CUDA optimizations do or do not exist on MUSA." + ], + "schema_version": 1, + "repo": "vllm_musa", + "component": "llm", + "status": "imported", + "verification": { + "locally_verified": false, + "evidence_level": "guidance" + } +} diff --git a/src/inferrsi/knowledge/data/skill_library/skill-index.json b/src/inferrsi/knowledge/data/skill_library/skill-index.json index a6f85207e..025f3c894 100644 --- a/src/inferrsi/knowledge/data/skill_library/skill-index.json +++ b/src/inferrsi/knowledge/data/skill_library/skill-index.json @@ -352,6 +352,10 @@ "weight-loading-optimization": { "path": "playbooks/optimization/weight-loading-optimization", "backend": "common" + }, + "vllm-musa": { + "path": "systems/engines/vllm-musa", + "backend": "musa" } } } diff --git a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md new file mode 100644 index 000000000..a4bd8a135 --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md @@ -0,0 +1,58 @@ +--- +name: vllm-musa +description: "Investigate text-LLM and Omni serving performance on Moore Threads MUSA through the vllm-musa plugin: device identity, torchada dispatch boundaries, the pinned Omni image, and measurement rules that keep a CUDA-derived result from being reported as a MUSA result." +license: Apache-2.0 +disable-model-invocation: true +metadata: + disco-role: operating +--- + +# vLLM-MUSA serving investigation + +Use this **source-derived candidate** for the Moore Threads plugin at +`MooreThreads/vllm-musa`, not for upstream vLLM or for vLLM-Omni on CUDA, +ROCm or Ascend. Every procedure here is pinned to a revision in +[references/sources.md](references/sources.md); nothing in it was measured on +MUSA hardware by this skill's author. + +Two model lanes share one plugin: + +| Lane | What runs | Where the risk is | +| --- | --- | --- | +| Text LLM | vLLM + `vllm_musa` platform plugin on MUSA | device identity, dispatch of CUDA-shaped fast paths | +| Omni (image/video/audio) | vLLM-Omni built into the MUSA image | CUDA-only kernels excluded by constraint; model-specific numerics | + +## Route by the question that can be answered + +| Question | Read | First discriminator | +| --- | --- | --- | +| Is the campaign even on the card it claims? | [device identity](references/device-identity.md) | pymtml physical id/UUID versus `MUSA_VISIBLE_DEVICES` | +| Did the CUDA optimization actually run here? | [dispatch boundary](references/dispatch.md) | kernel names in a steady-state profile | +| Can this Omni change apply in the MUSA image? | [Omni lane](references/omni.md) | the image's constraint list and the resident kernels | +| Is the measured delta real? | [measurement](references/measurement.md) | AB/BA on identical physical devices, identical pins | + +## Hard rules + +1. **A CUDA result is a hypothesis here, not an effect size.** The plugin runs + CUDA-oriented source through `torchada`, so presence of a fast path in the + source says nothing about which implementation executed. +2. **Pin five things together:** plugin revision, upstream vLLM version, MUSA + toolkit/driver, `torchada`/`torch_musa` revisions, and the model checkpoint. + Any one of them changing makes the comparison a different experiment. +3. **Report the physical device set.** `pymtml` (MTML) answers with physical ids + and is documented as unaffected by `MUSA_VISIBLE_DEVICES`, while `torch.musa` + applies the logical remapping. Two arms that share an env string can still + sit on different cards. +4. **Keep the Omni and LLM lanes apart.** An Omni image result does not describe + `vllm serve` throughput, and a text-LLM decode number does not describe + denoise or codec time. +5. **Missing evidence stays INCONCLUSIVE.** No profile, no physical-device + record, or no quality gate means the run is not a result. + +## What this skill does not give you + +- No MUSA kernel implementation, no MATE tuning recipe, no expected speedup. +- No claim that any CUDA or Ascend optimization in the wider knowledge base + transfers to MUSA; those records remain scoped to their own hardware. +- No authorization to execute a benchmark, restart a service or reserve devices. + Bring your own frozen commands and gates. diff --git a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/metadata.json b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/metadata.json new file mode 100644 index 000000000..94a50b81c --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/metadata.json @@ -0,0 +1,66 @@ +{ + "schema_version": 1, + "kind": "skill", + "origin": [ + "external" + ], + "status": "candidate", + "empirical_validation": "not_run", + "license": "Apache-2.0", + "tags": [ + "vllm-musa", + "musa", + "moore-threads", + "torchada", + "pymtml", + "mtml", + "musa-visible-devices", + "vllm-omni", + "dispatch", + "measurement" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/MooreThreads/vllm-musa", + "commit": "7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", + "license": "Apache-2.0", + "paths": [ + "LICENSE", + "docker/vllm-omni.Dockerfile", + "vllm_musa/__init__.py", + "vllm_musa/platform.py" + ], + "readset": "references/sources.md" + } + ], + "provenance_readsets": [ + "references/sources.md" + ], + "consumption_mode": "packaged", + "applicability": { + "scope": "Device identity, compat-layer dispatch and pinned-image constraints for text-LLM and Omni serving on the vllm-musa plugin, plus the measurement rules that keep a CUDA-derived result separate from a MUSA one.", + "prerequisites": "A prepared MUSA host or the vllm-omni MUSA image, the plugin and compat-layer revisions, and a frozen benchmark plus quality command.", + "input_contract": "Plugin revision, upstream vLLM version, MUSA toolkit and driver, torchada/torch_musa revisions, model checkpoint, physical device UUID set and the workload.", + "produced_artifact": "An identity/dispatch/measurement report: physical device mapping, the named mechanism and its kernel evidence, and an AB/BA pair with its quality verdict.", + "refusal_point": "Report an evidence gap when the physical device set, the compat-layer revisions or the image constraint list cannot be established." + }, + "recommendations": [ + "Resolve the pymtml-physical versus torch-logical device mapping before any A/B.", + "Prove the mechanism is selected on MUSA from a profile instead of assuming a CUDA fast path ran.", + "Treat the Omni image's constraint list as the boundary of what can cause a change.", + "Keep the text-LLM and Omni lanes as separate claims." + ], + "limitations": [ + "Authored from source reading only: no MUSA hardware run, no quality or performance measurement.", + "Covers the plugin's contract at one revision; MATE, torchada and MUSA toolkit tuning are out of scope.", + "Contains no expected speedup and no statement that any CUDA or Ascend record transfers to MUSA." + ], + "construction": { + "anchor_kind": "source", + "distillation_form": "repository-operating-graph", + "method": "Source-read authoring against the plugin revision recorded in references/sources.md. No MUSA host was available, so no native import, build, service start or measurement was performed.", + "native_import": "not-run", + "status": "candidate" + } +} diff --git a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/device-identity.md b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/device-identity.md new file mode 100644 index 000000000..61d6237b9 --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/device-identity.md @@ -0,0 +1,54 @@ +# Device identity on MUSA + +Pinned to `vllm_musa/platform.py` and `vllm_musa/__init__.py` at the revision in +[sources.md](sources.md). Read this before every campaign, not just the first. + +## The contract + +- The plugin declares `device_control_env_var = "MUSA_VISIBLE_DEVICES"` and + `dist_backend = "mccl"`. +- `MtmlMUSAPlatform` is the MTML path. Its docstring states that MTML is **not** + affected by `MUSA_VISIBLE_DEVICES` and that its functions work on **real + physical device ids**. +- The same class carries a note that CUDA maps a logical `device_id` to a + physical one, but `torch.musa` uses logical ids when the env var is set, while + `pymtml` does not remap. The plugin therefore queries the handle by the id it + was given. +- Commit `7d5371a5ec…` is titled "fix: stop baking MUSA_VISIBLE_DEVICES=all into + the image" — the image no longer decides visibility for you. + +## Why an A/B can be invalid while looking healthy + +``` +MUSA_VISIBLE_DEVICES=2,3 # torch logical 0,1 -> physical 2,3 +pymtml index 0,1 # physical 0,1 (a different pair) +``` + +An arm launched with that env and a harness that pins "device 0,1" through +`pymtml` can end up measuring card 2 while recording card 0. If the two arms +disagree on the mapping, the delta includes the hardware difference. + +## Check, in this order + +1. Start the target interpreter and print `pymtml` device count, plus + `index`/`UUID`/`name` for each device. +2. Print `torch.musa.device_count()` and the per-device properties with the env + var set and unset. +3. Tabulate env entry → physical index. Only an identity mapping lets a single + integer name one card in both worlds. +4. Put the UUID set and the mapping in the run record, not just the env string. + +## Rules + +- Select by UUID when the harness accepts it; keep the integer only as a label. +- Two arms must show the **same physical UUID set**. Different sets invalidate + the comparison regardless of identical flags. +- Do not reuse a "device 0" claim across hosts; re-read identity per host, per + driver, and after any container restart. +- When `pymtml` is missing or `nvmlInit` fails, report the tool gap. Do not fall + back to a logical index and call it physical. + +The InferRSI adapter for this backend (`inferrsi --backend musa`) probes through +`pymtml` in the target Python and reports physical `index`/`uuid`/`name`; its +`qualify_devices` helper reads `MUSA_VISIBLE_DEVICES`, so it is only sound under +the identity mapping this page asks you to verify first. diff --git a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/dispatch.md b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/dispatch.md new file mode 100644 index 000000000..f6e32dd81 --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/dispatch.md @@ -0,0 +1,46 @@ +# The torchada dispatch boundary + +Pinned to `vllm_musa/__init__.py` and `vllm_musa/platform.py` at the revision in +[sources.md](sources.md). + +## What the plugin guarantees, and what it does not + +- `vllm_musa/__init__.py` imports `torchada` before `torch` with an explicit + comment: this must happen before any `torch.device("cuda:X")` call because it + patches `torch.cuda` to redirect to MUSA. +- `musa_platform_plugin()` answers `vllm_musa.platform.MUSAPlatform` when + `torchada.is_musa_platform()` is true, and otherwise falls back to importing + `torch_musa`. Availability of the compat layer is part of runtime identity. +- The import block is wrapped in `try/except ImportError` and only sets + `_torchada_available`, so an environment can reach the fallback path silently. + +What this does **not** guarantee: that any given CUDA-shaped kernel, fused op, +graph pass or attention backend exists, is selected, or is fast. A source-level +fast path can compile and run through the compatibility layer while the work is +done by a different implementation. + +## Porting checklist for one CUDA optimization + +1. **Name the mechanism.** "Fewer kernels", "one fewer round trip", "smaller + activation" — one sentence, tied to a named kernel or graph node. +2. **Prove the mechanism exists on MUSA.** Search the plugin and the built + wheel for the symbol; a CUDA-only distribution that the MUSA image excludes + cannot be the mechanism (see [omni.md](omni.md) for the constraint list). +3. **Prove it is selected.** Profile one steady-state step and look for the + kernel names. Generic or fallback names mean the fast path did not win. +4. **Then measure** with the pair rules in [measurement.md](measurement.md). +5. **Record the compat layer.** `torchada`, `torch_musa`, `torch` and the MUSA + toolkit versions go next to the number; a different `torchada` revision is a + different runtime. + +## False positives to expect + +- The candidate "improves" because it changed warmup length, batch shape or + graph capture state rather than the kernel. +- The candidate is inert on MUSA (guarded by a CUDA-only check) and the delta is + run-to-run noise. +- Both arms execute the fallback, so the comparison is really fallback versus + fallback with different bookkeeping. + +Each of these is decided by a profile plus an identical-pair rerun, not by the +engine-level number alone. diff --git a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/measurement.md b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/measurement.md new file mode 100644 index 000000000..da3419bb1 --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/measurement.md @@ -0,0 +1,48 @@ +# Measuring a pair on MUSA + +Applies to both lanes. These rules exist because the MUSA stack has three +independent sources of drift: device remapping, the compat layer, and the pinned +Omni image. + +## Before the first trial + +- One repository revision, one installed stack, one model checkpoint, one + workload; write them down. +- Print the physical device set through `pymtml` (UUIDs) and confirm both arms + will use the same set; see [device-identity.md](device-identity.md). +- Decide the metric and direction **before** running: engine E2E latency, + requests/s, TTFT, RTF, frames/s — one of them, not whichever improves. +- Freeze the quality gate: a command that exits non-zero on a bad output, or an + explicit numeric comparison against a stored reference. + +## Running + +- Alternate arms (AB/BA), not AA then BB. Sequential blocks absorb thermal and + neighbour drift into the comparison. +- Discard the first trial per arm; state how many warmups you discarded. +- Restart the service between arms when the change touches compilation, graph + capture, allocator settings or the model loader. Otherwise the second arm + inherits the first arm's caches. +- Keep the same process count, port, batch/concurrency and request mix. A + concurrency change is a different experiment, not a second repetition. +- If a trial fails or times out, keep the failure and stop attributing the rest: + a partially failed pair is INCONCLUSIVE, not a smaller sample. + +## Reporting + +- Report median and range per arm plus the raw trials; a single mean hides the + bimodality that a wrong device or a recompilation produces. +- Report the physical UUID set, the plugin/compat/toolkit versions and the image + digest beside the numbers. +- Keep profiled and unprofiled numbers separate; a profiled wall time is not an + engine E2E measurement. +- If the quality gate did not run, say so. Silence is not a pass. + +## Minimum evidence for a claim + +| Claim | Required | +| --- | --- | +| "X is faster on MUSA by N%" | AB/BA pair, same UUID set, same pins, range reported | +| "This kernel/graph got faster" | profile of both arms naming the kernel or step | +| "Output is unchanged" | a byte/numeric comparison against the same-seed baseline | +| "This CUDA optimization transfers" | all three above, on MUSA, at the pinned revisions | diff --git a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/omni.md b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/omni.md new file mode 100644 index 000000000..9b14042d4 --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/omni.md @@ -0,0 +1,53 @@ +# The Omni lane on MUSA + +Pinned to `docker/vllm-omni.Dockerfile` at commit `666d6f96d6…` (see +[sources.md](sources.md)). That file is the only Omni-specific artifact in the +cited revision; re-read it at the revision you actually build. + +## What the image does + +- Inherits the MUSA base image (torch, `torch_musa`, `torchada`, `triton`, + `mate`, `vllm`, `vllm-musa` already installed). +- Sets `VLLM_OMNI_TARGET_DEVICE=musa` so the vllm-omni build does not fall back + to CPU when no GPU is visible during `docker build`. +- Records the installed versions of `flash_attn_3`, `flash_mla`, `mate`, + `torch`, `torch_musa`, `torchada`, `triton`, `vllm`, `vllm-musa`; installs + vllm-omni under that constraint file; then fails the build if any constrained + distribution changed. +- Smoke-imports `torchada`, `torch`, `torch_musa`, `vllm`, `vllm_musa`, + `vllm_omni` and asserts `torch.version.musa is not None`. + +## Consequences for optimization work + +- **CUDA-only accelerators are out of scope by construction.** If a CUDA Omni + optimization's mechanism is `flash_attn_3` or `flash_mla`, it cannot be the + cause of a change inside this image. +- **The MUSA stack is the fixed point.** Upgrading one pinned distribution to + chase a CUDA-side patch breaks the image's own invariant check; treat that as + a deliberate, separately funded experiment. +- **Reachable levers** are engine-side and model-side: reuse of conditioning or + text embeddings across requests, work shared across denoise steps, tile and + batch geometry for VAE decode, scheduler/batching decisions, and whatever + attention path vllm-omni actually registers for `musa`. + +## Procedure for one Omni candidate + +1. Build or pull the image; capture the printed constraint list and the image + digest. If you cannot produce them, stop — the runtime identity is unknown. +2. Establish the baseline inside that image: one model, one resolution, one + frame/duration setting, fixed seed and prompt set, service warm before timing. +3. Check the quality gate first, on the baseline, so a later failure can be + attributed: pixel-identical decode where the change claims losslessness; + otherwise an explicit tolerance with the reference it was measured against. +4. Apply one candidate. Profile one denoise step and one decode step to confirm + the mechanism moved (see [dispatch.md](dispatch.md)). +5. Run the pair with [measurement.md](measurement.md): both arms in the same + image, same device UUIDs, AB/BA order, restart between arms. +6. Record latency **and** the quality verdict. An image/video gain with an + unqualified quality comparison stays INCONCLUSIVE. + +## Do not carry over + +CUDA numbers from the vllm-omni knowledge records are scoped to their hardware +and revision. They are useful as a list of *candidate mechanisms*, never as an +expected percentage on MUSA. diff --git a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/sources.md b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/sources.md new file mode 100644 index 000000000..2d36d6168 --- /dev/null +++ b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/references/sources.md @@ -0,0 +1,37 @@ +# Sources and revision pin + +This skill is a source-derived candidate. It was written by reading the files +below; it was **not** validated by running a model on MUSA hardware. + +| Identity | Value | +| --- | --- | +| Repository | `https://github.com/MooreThreads/vllm-musa` | +| Revision read | `7d5371a5ecfd1e04ea303f847e75cf3747e92fcd` | +| Omni image revision | `666d6f96d6e6ccc5439821f3c3ca34d049e3f176` | +| License | Apache-2.0 | + +## Files read + +- `vllm_musa/__init__.py` — `torchada` import order, `_torchada_available`, + `musa_platform_plugin()` and the `torch_musa` fallback. +- `vllm_musa/platform.py` — `device_control_env_var`, `dist_backend = "mccl"`, + `MtmlMUSAPlatform` and the MTML-versus-logical-id note. +- `docker/vllm-omni.Dockerfile` (at the Omni image revision) — + `VLLM_OMNI_TARGET_DEVICE=musa`, the constraint list, the drift check and the + smoke imports. +- `vllm_musa` commit `7d5371a5ecfd1e04ea303f847e75cf3747e92fcd` — removes a + baked `MUSA_VISIBLE_DEVICES=all` from the image. + +## Knowledge records that carry the same facts + +- `vllm_musa.musa.llm.physical_device_identity` +- `vllm_musa.musa.llm.torchada_dispatch_boundary` +- `vllm_musa.musa.diffusion.omni_image_porting` + +## Bounds + +- No hardware, driver or SKU benchmark is included; no speedup is claimed. +- The plugin moves quickly; re-read the cited files at the revision you use and + treat a changed file as a changed procedure. +- MATE, `torchada`, MUSA toolkit and Mooncake behaviour is out of scope for this + pin: this skill describes the plugin's contract, not those libraries' tuning. diff --git a/src/inferrsi/knowledge/knowledge_find.py b/src/inferrsi/knowledge/knowledge_find.py index dce4793bc..ec5557159 100644 --- a/src/inferrsi/knowledge/knowledge_find.py +++ b/src/inferrsi/knowledge/knowledge_find.py @@ -82,7 +82,7 @@ "how", "what", "why", "which", "where", "who", "can", "could", "should", "would", "i", "you", "we", "do", "does", "did", "is", "are", "was", "were", } -_BACKEND_NAME_ALIASES = {"昇腾": "ascend"} +_BACKEND_NAME_ALIASES = {"昇腾": "ascend", "摩尔线程": "musa"} _MAX_SNIPPET = 400 _MAX_LIMITATION_BYTES = 400 _MAX_SHOWN_LIMITATIONS = 3 @@ -794,6 +794,7 @@ def rank(query: str, corpus: Corpus) -> tuple[ """Score matches without opening a Bundle or formatting a delivery.""" # A topic alias can add backend terms for matching, as 图模式 adds cuda graph. explicit_terms = {_BACKEND_NAME_ALIASES.get(term, term) for term in tokens(query)} + explicit_terms |= _vendor_backends(query) backends = named_backends(explicit_terms) query_backend = next(iter(backends)) if len(backends) == 1 else None query_tokens, applied = expand(query) @@ -808,6 +809,16 @@ def rank(query: str, corpus: Corpus) -> tuple[ return query_tokens, applied, scored +def _vendor_backends(query: str) -> set[str]: + """Name a backend from a vendor name the tokenizer would cut into bigrams. + + 昇腾 survives tokenization as one token, so the term map alone reaches it; + 摩尔线程 splits into 摩尔/尔线/线程 and would never match a map key. Test the + raw query for the alias so both vendor names resolve. + """ + return {backend for name, backend in _BACKEND_NAME_ALIASES.items() if name in query} + + def find( query: str, corpus: Corpus, diff --git a/src/inferrsi/resources/repository_packs.py b/src/inferrsi/resources/repository_packs.py index e75f89269..ed1cc8d27 100644 --- a/src/inferrsi/resources/repository_packs.py +++ b/src/inferrsi/resources/repository_packs.py @@ -9,7 +9,9 @@ from importlib.resources import files from typing import Any -REPO_TYPES = ("vllm", "vllm_omni", "afd_plugin", "vllm_rlt", "strata", "sglang", "sglang_omni") +REPO_TYPES = ( + "vllm", "vllm_omni", "vllm_musa", "afd_plugin", "vllm_rlt", "strata", "sglang", "sglang_omni" +) def repository_pack(repo_type: str) -> dict[str, Any]: diff --git a/tests/check_dsh_form.cjs b/tests/check_dsh_form.cjs index 9961a330e..329d61a26 100644 --- a/tests/check_dsh_form.cjs +++ b/tests/check_dsh_form.cjs @@ -91,6 +91,8 @@ async function main() { assert.equal(task.maxMinutes, 20); assert.equal(task.acceptance, null); assert.equal(task.execution, 'local'); + const musa = taskFromForm({ ...form, backend: 'musa' }); + assert.equal(musa.backend, 'musa'); const remote = { ...form, backend: 'npu', execution: 'remote', host: '192.0.2.1', password: 'fake-test-password', privateKey: 'fake-test-key' }; assert.throws(() => buildPrompt(remote)); diff --git a/tests/check_installed.py b/tests/check_installed.py index e124a04c1..7920bb518 100644 --- a/tests/check_installed.py +++ b/tests/check_installed.py @@ -61,7 +61,7 @@ def resource(logical): for resource_name in ("task.json", "TASK.md", "benchmark.py", "LICENSE"): assert root.joinpath(resource_name).is_file(), (benchmark_name, resource_name) records = knowledge_records() -assert len(records) == 136, "Knowledge is missing from the installation" +assert len(records) == 139, "Knowledge is missing from the installation" assert resource("data/skill_library/records/README.md").is_file() assert repository_pack("vllm_rlt")["id"] == "vllm_rlt" assert search_knowledge(repo="vllm_omni", backend="ascend") @@ -82,7 +82,7 @@ def resource(logical): "package:" + record["id"], mlx_document, revision=bundle.revision ) == resource(mlx_document).read_bytes() skill_index = search_knowledge(repo="inferrsi", limit=100) -assert len(skill_index) == 88, "Missing installed skill abstracts" +assert len(skill_index) == 89, "Missing installed skill abstracts" assert all(record["index_type"] == "packaged-skill" for record in skill_index) ascend_rc = KnowledgeReader().read("inferrsi.ascend.skills.vllm_ascend") for note in ("plugin-registration", "minimax-cache", "dspark-pd", "sources", @@ -269,7 +269,7 @@ def resource(logical): digest = hashlib.sha256(data.replace(b"\r\n", b"\n")).hexdigest() assert digest == expected_hash, relative registry = json.loads(library.joinpath("skill-index.json").read_text(encoding="utf-8"))["skills"] -assert len(registry) == 88 +assert len(registry) == 89 for entry in registry.values(): assert library.joinpath(*entry["path"].split("/"), "SKILL.md").is_file() # The default wheel opens every primary procedure before an agent searches for evidence. diff --git a/tests/test_cli_catalog.py b/tests/test_cli_catalog.py index 36eb59672..fa442bdfa 100644 --- a/tests/test_cli_catalog.py +++ b/tests/test_cli_catalog.py @@ -26,6 +26,7 @@ "sglang": "sgl-project/sglang", "sglang_omni": "sgl-project/sglang-omni", "vllm_omni": "vllm-project/vllm-omni", + "vllm_musa": "MooreThreads/vllm-musa", } diff --git a/tests/test_dashboard_external.py b/tests/test_dashboard_external.py index 7521b716d..b69c06541 100644 --- a/tests/test_dashboard_external.py +++ b/tests/test_dashboard_external.py @@ -142,6 +142,48 @@ def test_ascend_identity_requires_runtime_and_firmware(): assert _environment_signature(env, ["0"], "ascend") != first +def test_musa_identity_requires_a_mask_that_binds_the_selected_card(): + def environment(mask, index="0"): + return { + "host": {"platform": "synthetic"}, + "visible_devices": {"MUSA_VISIBLE_DEVICES": mask}, + "target_python": { + "environment": { + "python": "3.11", + "packages": { + "torch": "example", + "vllm": "example", + "torch_musa": "example", + "vllm-musa": "example", + }, + } + }, + "device": { + "status": "available", + "selection_verified": True, + "devices": [ + {"index": index, "uuid": "example", "name": "MTT S5000", + "driver_version": "example"} + ], + }, + } + + # Card 0 is the runtime's implicit device 0, so an unset mask still binds it. + assert _environment_signature(environment(None), ["0"], "musa") is not None + # Card 1 with no mask: logical musa:0 is card 0, so the recorded UUID would + # name a card the workload never had to use. + assert _environment_signature(environment(None, "1"), ["1"], "musa") is None + # The explicit mask creates the binding, and it must still be an identity. + assert _environment_signature(environment("1", "1"), ["1"], "musa") is not None + assert _environment_signature(environment("1,0", "1"), ["1"], "musa") is None + # A record that never captured the key cannot prove the binding either. + missing = environment(None) + del missing["visible_devices"]["MUSA_VISIBLE_DEVICES"] + assert _environment_signature(missing, ["0"], "musa") is None + del missing["visible_devices"] + assert _environment_signature(missing, ["0"], "musa") is None + + @pytest.mark.parametrize("change", ["missing_source", "changed_source", "wrong_candidate", "bad_quality", "too_many_samples", "negative_metric"]) def test_external_contract_rejects_invalid_provenance_or_values(tmp_path, change): @@ -276,3 +318,38 @@ def test_empty_campaign_snapshot_has_no_gain_or_plot(tmp_path): assert snapshot['chart'] == '' assert snapshot['data']['chart_note'] == 'No measured candidate results recorded.' assert snapshot['temporal'] == '' + + +def test_musa_identity_requires_the_compat_layer_and_plugin(): + env = { + "host": {"platform": "synthetic"}, + # The recorded mask is what binds the verified card to the executed one. + "visible_devices": {"MUSA_VISIBLE_DEVICES": "0"}, + "target_python": { + "environment": { + "python": "3.10", + "packages": {"torch": "example", "vllm": "example"}, + } + }, + "device": { + "status": "available", + "selection_verified": True, + "devices": [ + { + "index": "0", + "uuid": "GPU-example", + "name": "MTT example", + "driver_version": "example", + } + ], + }, + } + # torch/vllm alone cannot identify a MUSA runtime. + assert _environment_signature(env, ["0"], "musa") is None + env["target_python"]["environment"]["packages"].update( + {"torch_musa": "example", "vllm-musa": "example"} + ) + first = _environment_signature(env, ["0"], "musa") + assert first is not None and first[0] == "musa" + env["target_python"]["environment"]["packages"]["vllm-musa"] = "changed" + assert _environment_signature(env, ["0"], "musa") != first diff --git a/tests/test_inspection.py b/tests/test_inspection.py index a24746227..b3118bb84 100644 --- a/tests/test_inspection.py +++ b/tests/test_inspection.py @@ -205,6 +205,11 @@ def test_real_python_reports_requested_versions(self): "nvidia-cuda-runtime-cu12", "nvidia-cuda-runtime-cu13", "mlx", + "torch_musa", + "vllm-musa", + "mthreads-ml-py", + "torchada", + "mate", ) self.assertEqual(set(environment["packages"]), set(names)) for name in names: diff --git a/tests/test_knowledge_compatibility_shells.py b/tests/test_knowledge_compatibility_shells.py index 099f311c7..65063ba23 100644 --- a/tests/test_knowledge_compatibility_shells.py +++ b/tests/test_knowledge_compatibility_shells.py @@ -110,7 +110,12 @@ def test_data_leaf_holds_the_recorded_fragment_and_locked_hash(): assert LEAF["file"] == "src/inferrsi/resources/repository_packs.py" data = (REPO / LEAF["file"]).read_bytes() assert data == (ROOT / "resources" / "repository_packs.py").read_bytes() - assert hashlib.sha256(data).hexdigest() == LEAF["file_sha256"] + # K02 and C2 are historical pins: they describe the bytes that existed at + # those revisions and are not relocked when the registry grows. The current + # leaf is recorded by its own revision, which names the hash it superseded. + registry = LEAF["registry_revision"] + assert registry["previous_file_sha256"] == LEAF["file_sha256"] + assert hashlib.sha256(data).hexdigest() == registry["file_sha256"] # The body in the file today, and the P0b provenance text it came from. current = LEAF["current_fragment"] assert current["source"] + "\n" in data.decode("utf-8") @@ -119,7 +124,14 @@ def test_data_leaf_holds_the_recorded_fragment_and_locked_hash(): ) revision = LEAF["resource_path_revision"] original = LEAF["original_fragment"]["source"] - assert original.replace(revision["old_line"], revision["new_line"]) == current["source"] + # K02 moved one path expression. The registry above the reader grows as packs + # are added, so the reader body is what the revision must still reproduce. + def reader_body(text: str) -> str: + return text[text.index("def repository_pack("):] + + assert reader_body(original).replace(revision["old_line"], revision["new_line"]) == ( + reader_body(current["source"]) + ) assert revision["new_file_sha256"] == LEAF["file_sha256"] @@ -136,9 +148,9 @@ def test_c2_relock_moves_the_leaf_without_changing_a_byte(): assert moved["old_file_sha256"] == LEAF["resource_path_revision"]["new_file_sha256"] assert moved["old_file_sha256"] == moved["new_file_sha256"] == LEAF["file_sha256"] assert not (REPO / moved["old_file"]).exists() - assert hashlib.sha256((REPO / moved["new_file"]).read_bytes()).hexdigest() == ( - moved["new_file_sha256"] - ) + # The relocation identity is a statement about the C2 bytes, so it is checked + # against the hash C2 recorded, not against today's registry-edited file. + assert moved["new_file_sha256"] == LEAF["registry_revision"]["previous_file_sha256"] # The review requirement is recorded, never an approval. assert "requires formal architecture review" in moved["review"] assert "does not self-approve" in moved["review"] diff --git a/tests/test_knowledge_find.py b/tests/test_knowledge_find.py index 3b769cf4e..1efdb3258 100644 --- a/tests/test_knowledge_find.py +++ b/tests/test_knowledge_find.py @@ -70,7 +70,7 @@ def test_corpus_covers_all_three_kinds_without_double_counting(corpus): kinds = {} for document in corpus.documents: kinds[document.kind] = kinds.get(document.kind, 0) + 1 - assert kinds["skill"] == 80 + assert kinds["skill"] == 81 # All task procedures resolve by exact ID, outside the evidence corpus and its IDF. navigation = {path.parent.name for path in (ROOT / "tasks").glob("*/SKILL.md")} assert len(navigation) == 8 diff --git a/tests/test_musa_platform.py b/tests/test_musa_platform.py new file mode 100644 index 000000000..dd5680bac --- /dev/null +++ b/tests/test_musa_platform.py @@ -0,0 +1,482 @@ +"""MUSA platform discovery, registry wiring and the vllm-musa repository pack. + +The probe contract is exercised through injected command callables, so these +tests never need MUSA hardware, pymtml or a MUSA toolkit; the numbers they use +are contract fixtures, not accelerator measurements. +""" + +import json +import subprocess +from unittest.mock import patch + +import pytest + +from inferrsi.apps.host.inspection import inspect_environment +from inferrsi.apps.host.platforms import PLATFORM_PROBES, inspect_device +from inferrsi.apps.host.platforms.musa import PROBE_CODE, qualify_devices +from inferrsi.knowledge.catalog import BACKENDS +from inferrsi.resources.repository_packs import REPO_TYPES, repository_pack + +DEVICES = { + "devices": [ + { + "index": "0", + "uuid": "GPU-1111", + "name": "MTT S5000", + "driver_version": "6.1.0", + "memory_total_mib": 49152, + }, + { + "index": "1", + "uuid": "GPU-2222", + "name": "MTT S5000", + "driver_version": "6.1.0", + "memory_total_mib": 49152, + }, + ] +} + + +def probe(stdout="", returncode=0, stderr=""): + return {"argv": ["python", "-c", PROBE_CODE], "returncode": returncode, + "stdout": stdout, "stderr": stderr} + + +def test_musa_probe_selects_requested_devices(): + device = inspect_device( + "musa", + device_ids=("0",), + device_model="S5000", + command=lambda argv: probe(json.dumps(DEVICES)), + python="/opt/musa/bin/python", + ) + assert device["status"] == "available" + assert device["selection_verified"] is True + assert [row["uuid"] for row in device["devices"]] == ["GPU-1111", "GPU-2222"] + + +def test_musa_probe_reports_absent_device_id(): + device = inspect_device( + "musa", + device_ids=("7",), + device_model=None, + command=lambda argv: probe(json.dumps(DEVICES)), + ) + assert device["status"] == "unavailable" + assert device["selection_verified"] is False + assert "Requested device IDs absent" in device["reason"] + + +def test_musa_probe_reports_model_mismatch(): + device = inspect_device( + "musa", + device_ids=(), + device_model="S4000", + command=lambda argv: probe(json.dumps(DEVICES)), + ) + assert device["status"] == "device_model_mismatch" + assert "S4000" in device["reason"] + + +def test_musa_probe_reports_missing_bindings(): + device = inspect_device( + "musa", device_ids=(), device_model=None, + command=lambda argv: probe('{"error": "pymtml unavailable"}', returncode=3), + ) + assert device["status"] == "unavailable" + assert device["probe"]["returncode"] == 3 + + +def test_musa_probe_rejects_unparsable_output(): + device = inspect_device( + "musa", device_ids=(), device_model=None, command=lambda argv: probe("no json here"), + ) + assert device["status"] == "unavailable" + assert device["devices"] == [] + assert "No device records parsed from pymtml output" in device["reason"] + + +def test_registry_exposes_musa_backend_and_target_python(): + assert PLATFORM_PROBES["musa"].__name__ == "inspect_devices" + assert "musa" in BACKENDS + seen = [] + + def command(argv): + seen.append(argv) + return probe(json.dumps(DEVICES)) + + inspect_device( + "musa", device_ids=(), device_model=None, command=command, python="/opt/musa/bin/python" + ) + assert seen[0][0] == "/opt/musa/bin/python" + assert seen[0][1:] == ["-c", PROBE_CODE] + + +def test_cuda_probe_accepts_the_target_python_argument(): + csv = "0, GPU-fixture, NVIDIA H100 SXM, 550.54\n" + device = inspect_device( + "cuda", device_ids=("0",), device_model="H100", + command=lambda argv: {"argv": argv, "returncode": 0, "stdout": csv, "stderr": ""}, + python="/usr/bin/python3", + ) + assert device["status"] == "available" + assert device["selection_verified"] is True + + +def test_inspection_records_musa_visibility_and_packages(monkeypatch): + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "0,1") + seen = [] + + def command(argv): + seen.append(argv) + if "importlib.metadata" in argv[-1]: + return {"argv": argv, "returncode": 0, "stderr": "", "stdout": json.dumps( + {"python": "3.10", "packages": {"torch": "2.7.0", "vllm": "0.10.0"}} + )} + return probe(json.dumps(DEVICES)) + + environment = inspect_environment( + ".", "vllm_musa", "musa", python="/opt/musa/bin/python", + command=command, snapshot=lambda path: {"path": str(path), "head": "0" * 40}, + ) + assert environment["visible_devices"]["MUSA_VISIBLE_DEVICES"] == "0,1" + assert environment["device"]["status"] == "available" + package_code = seen[0][-1] + for name in ("torch_musa", "vllm-musa", "mthreads-ml-py", "torchada", "mate"): + assert name in package_code + + +def test_vllm_musa_pack_is_registered_and_covers_both_model_lanes(): + assert "vllm_musa" in REPO_TYPES + pack = repository_pack("vllm_musa") + assert pack["source_repository"] == "MooreThreads/vllm-musa" + assert pack["execution_support"] == "caller_supplied_external_commands" + assert {"llm.decode", "llm.serving", "diffusion.image_generation"} <= set(pack["scenarios"]) + assert set(pack["backend_compatibility"].values()) == {"unverified"} + + +def test_musa_qualification_accepts_idle_reserved_devices(monkeypatch): + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "0,1") + idle = subprocess.CompletedProcess([], 0, json.dumps(DEVICES), "") + empty = subprocess.CompletedProcess( + [], 0, json.dumps({"processes": [], "usage": [{"device": "0", "used_mib": 0}, + {"device": "1", "used_mib": 0}]}), "" + ) + with patch("inferrsi.apps.host.platforms.musa.subprocess.run", side_effect=[idle, empty]): + selected = qualify_devices(count=2, device_model="S5000") + assert [row["index"] for row in selected] == ["0", "1"] + # The trial maps this variable by position; record which physical card each + # logical index actually is so the evidence cannot drift from the check. + assert [row["logical_index"] for row in selected] == [0, 1] + + +def test_musa_qualification_rejects_wrong_count_and_busy_device(monkeypatch): + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "0") + with pytest.raises(ValueError, match="exactly 2 caller-reserved"): + qualify_devices(count=2, device_model="S5000") + idle = subprocess.CompletedProcess([], 0, json.dumps(DEVICES), "") + busy = subprocess.CompletedProcess( + [], 0, json.dumps({"processes": [{"device": "0", "pid": 4242}], + "usage": [{"device": "0", "used_mib": 4096}]}), "" + ) + with patch("inferrsi.apps.host.platforms.musa.subprocess.run", side_effect=[idle, busy]): + with pytest.raises(ValueError, match="already has a compute process"): + qualify_devices(count=1, device_model="S5000") + + +def test_musa_qualification_fails_closed_when_the_process_query_cannot_answer(monkeypatch): + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "0") + idle = subprocess.CompletedProcess([], 0, json.dumps(DEVICES), "") + unknown = subprocess.CompletedProcess( + [], 3, json.dumps({"error": "pymtml unavailable: no module named pymtml"}), "" + ) + with patch("inferrsi.apps.host.platforms.musa.subprocess.run", side_effect=[idle, unknown]): + with pytest.raises(ValueError, match="Cannot verify that the selected MUSA devices"): + qualify_devices(count=1, device_model="S5000") + # A query that answers without a process list is equally unknown, not idle. + silent = subprocess.CompletedProcess([], 0, "[]", "") + with patch("inferrsi.apps.host.platforms.musa.subprocess.run", side_effect=[idle, silent]): + with pytest.raises(ValueError, match="did not report a process list"): + qualify_devices(count=1, device_model="S5000") + + +def test_musa_qualification_rejects_a_process_binding_that_cannot_account(monkeypatch): + # A vendor binding can implement the query and still always answer "none". + # The used-memory figure is the independent signal that catches it. + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "0") + idle = subprocess.CompletedProcess([], 0, json.dumps(DEVICES), "") + blind = subprocess.CompletedProcess( + [], 0, json.dumps({"processes": [], "usage": [{"device": "0", "used_mib": 4096}]}), "" + ) + with patch("inferrsi.apps.host.platforms.musa.subprocess.run", side_effect=[idle, blind]): + with pytest.raises(ValueError, match="process accounting cannot be trusted"): + qualify_devices(count=1, device_model="S5000") + # No memory figure at all is unknown, not idle. + anonymous = subprocess.CompletedProcess( + [], 0, json.dumps({"processes": [], "usage": [{"device": "0", "used_mib": None}]}), "" + ) + with patch("inferrsi.apps.host.platforms.musa.subprocess.run", side_effect=[idle, anonymous]): + with pytest.raises(ValueError, match="no used memory"): + qualify_devices(count=1, device_model="S5000") + # A reply without the usage list is equally unusable. + truncated = subprocess.CompletedProcess([], 0, json.dumps({"processes": []}), "") + with patch("inferrsi.apps.host.platforms.musa.subprocess.run", side_effect=[idle, truncated]): + with pytest.raises(ValueError, match="no per-device memory usage"): + qualify_devices(count=1, device_model="S5000") + + +def test_musa_qualification_rejects_uuid_selections(monkeypatch): + # A UUID would pass discovery but the runtime maps MUSA_VISIBLE_DEVICES by + # position, so the verified card and the executed card could differ. + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "GPU-aaaa1111") + with pytest.raises(ValueError, match="physical integer device ids"): + qualify_devices(count=1, device_model="S5000") + + +def test_musa_qualification_rejects_other_sku(monkeypatch): + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "0") + idle = subprocess.CompletedProcess([], 0, json.dumps(DEVICES), "") + with patch("inferrsi.apps.host.platforms.musa.subprocess.run", return_value=idle): + with pytest.raises(ValueError, match="must all be S4000"): + qualify_devices(count=1, device_model="S4000") + + +def test_probe_code_compiles_and_reads_a_pynvml_compatible_binding(monkeypatch, capsys): + import sys + import types + + from inferrsi.apps.host.platforms.musa import BUSY_CODE + + compile(PROBE_CODE, "musa-probe", "exec") + compile(BUSY_CODE, "musa-busy", "exec") + + class Memory: + total = 8 * 1024 * 1024 * 1024 + + class Stub: + initialized = 0 + shut = 0 + + @staticmethod + def nvmlInit(): + Stub.initialized += 1 + + @staticmethod + def nvmlShutdown(): + Stub.shut += 1 + + @staticmethod + def nvmlSystemGetDriverVersion(): + return b"6.1.0" + + @staticmethod + def nvmlDeviceGetCount(): + return 1 + + @staticmethod + def nvmlDeviceGetHandleByIndex(index): + assert index == 0 + return "handle-0" + + @staticmethod + def nvmlDeviceGetUUID(handle): + assert handle == "handle-0" + return b"GPU-cccc3333" + + @staticmethod + def nvmlDeviceGetName(handle): + return b"MTT S5000" + + @staticmethod + def nvmlDeviceGetMemoryInfo(handle): + return Memory() + + module = types.ModuleType("pymtml") + for name in ("nvmlInit", "nvmlShutdown", "nvmlSystemGetDriverVersion", + "nvmlDeviceGetCount", "nvmlDeviceGetHandleByIndex", "nvmlDeviceGetUUID", + "nvmlDeviceGetName", "nvmlDeviceGetMemoryInfo"): + setattr(module, name, getattr(Stub, name)) + monkeypatch.setitem(sys.modules, "pymtml", module) + + exec(compile(PROBE_CODE, "musa-probe", "exec"), {"__name__": "musa_probe"}) + document = json.loads(capsys.readouterr().out) + assert document["devices"] == [ + { + "index": "0", + "uuid": "GPU-cccc3333", + "name": "MTT S5000", + "driver_version": "6.1.0", + "memory_total_mib": 8192, + } + ] + assert Stub.initialized == 1 and Stub.shut == 1 + + +def test_busy_probe_executes_fail_closed_when_the_binding_cannot_answer(monkeypatch, capsys): + import sys + import types + + from inferrsi.apps.host.platforms.musa import BUSY_CODE + + class Broken: + @staticmethod + def nvmlInit(): + raise RuntimeError("MTML init failed") + + module = types.ModuleType("pymtml") + module.nvmlInit = Broken.nvmlInit + monkeypatch.setitem(sys.modules, "pymtml", module) + monkeypatch.setattr(sys, "argv", ["musa-busy", "0"]) + with pytest.raises(SystemExit) as failure: + exec(compile(BUSY_CODE, "musa-busy", "exec"), {"__name__": "musa_busy"}) + assert failure.value.code == 3 + assert "nvmlInit failed" in json.loads(capsys.readouterr().out)["error"] + + # A binding without the process query is unknown, not an idle device. + class Quiet: + calls = 0 + + @staticmethod + def nvmlInit(): + Quiet.calls += 1 + + @staticmethod + def nvmlShutdown(): + Quiet.calls += 1 + + module = types.ModuleType("pymtml") + module.nvmlInit = Quiet.nvmlInit + module.nvmlShutdown = Quiet.nvmlShutdown + monkeypatch.setitem(sys.modules, "pymtml", module) + with pytest.raises(SystemExit) as failure: + exec(compile(BUSY_CODE, "musa-busy", "exec"), {"__name__": "musa_busy"}) + assert failure.value.code == 3 + assert "is unavailable" in json.loads(capsys.readouterr().out)["error"] + + +def test_musa_inspection_requires_the_mask_to_bind_a_nonzero_card(monkeypatch): + # --device-ids 1 with no mask: the runtime's device 0 is card 0, so the + # trial's logical index does not name the card that was verified. + monkeypatch.delenv("MUSA_VISIBLE_DEVICES", raising=False) + stdout = json.dumps({"devices": [{"index": "0", "uuid": "GPU-aaaa1111", + "name": "MTT S5000", "driver_version": "6.1.0"}, + {"index": "1", "uuid": "GPU-bbbb2222", + "name": "MTT S5000", "driver_version": "6.1.0"}]}) + device = inspect_device( + "musa", device_ids=("1",), device_model=None, command=lambda argv: probe(stdout) + ) + assert device["status"] == "unavailable" + assert "does not bind the declared devices" in device["reason"] + # Declaring the mask makes the binding explicit. + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "1") + bound = inspect_device( + "musa", device_ids=("1",), device_model=None, command=lambda argv: probe(stdout) + ) + assert bound["status"] == "available" + assert bound["selection_verified"] is True + # Card 0 needs no mask: it is the implicit device 0. + monkeypatch.delenv("MUSA_VISIBLE_DEVICES", raising=False) + zero = inspect_device( + "musa", device_ids=("0",), device_model=None, command=lambda argv: probe(stdout) + ) + assert zero["status"] == "available" + + +def test_musa_inspection_refuses_a_mask_that_remaps_the_selection(monkeypatch): + # --device-ids 0 with MUSA_VISIBLE_DEVICES=1: the probe can reach physical + # card 0, but the trial's logical musa:0 is physical card 1. Reporting that + # as verified would let a run claim a card it never used. + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "1") + stdout = json.dumps({"devices": [{"index": "0", "uuid": "GPU-aaaa1111", + "name": "MTT S5000", "driver_version": "6.1.0", + "memory_total_mib": 8192}, + {"index": "1", "uuid": "GPU-bbbb2222", + "name": "MTT S5000", "driver_version": "6.1.0", + "memory_total_mib": 8192}]}) + device = inspect_device( + "musa", device_ids=("0",), device_model=None, command=lambda argv: probe(stdout) + ) + assert device["status"] == "unavailable" + assert device["selection_verified"] is False + assert "does not bind the declared devices" in device["reason"] + # An identity mask keeps the selection verified: the declared id is the card + # the trial's logical index resolves to. + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "0") + kept = inspect_device( + "musa", device_ids=("0",), device_model=None, command=lambda argv: probe(stdout) + ) + assert kept["status"] == "available" + assert kept["selection_verified"] is True + + +def test_busy_probe_reports_usage_alongside_an_empty_process_list(monkeypatch, capsys): + import sys + import types + + from inferrsi.apps.host.platforms.musa import BUSY_CODE + + class Memory: + used = 0 + total = 24 * 1024 * 1024 * 1024 + free = 24 * 1024 * 1024 * 1024 + + class Quiet: + @staticmethod + def nvmlInit(): + return None + + @staticmethod + def nvmlShutdown(): + return None + + @staticmethod + def nvmlDeviceGetHandleByIndex(index): + return "handle-%s" % index + + @staticmethod + def nvmlDeviceGetComputeRunningProcesses(handle): + return [] + + @staticmethod + def nvmlDeviceGetMemoryInfo(handle): + return Memory() + + module = types.ModuleType("pymtml") + for name in ("nvmlInit", "nvmlShutdown", "nvmlDeviceGetHandleByIndex", + "nvmlDeviceGetComputeRunningProcesses", "nvmlDeviceGetMemoryInfo"): + setattr(module, name, getattr(Quiet, name)) + monkeypatch.setitem(sys.modules, "pymtml", module) + monkeypatch.setattr(sys, "argv", ["musa-busy", "0"]) + exec(compile(BUSY_CODE, "musa-busy", "exec"), {"__name__": "musa_busy"}) + document = json.loads(capsys.readouterr().out) + assert document["processes"] == [] + assert document["usage"] == [{"device": "0", "used_mib": 0}] + + +def test_musa_probe_drops_only_the_unreadable_device(monkeypatch): + monkeypatch.setenv("MUSA_VISIBLE_DEVICES", "1") + stdout = json.dumps( + { + "devices": [ + {"index": "0", "error": "NVMLError: no permission"}, + { + "index": "1", + "uuid": "GPU-dddd4444", + "name": "MTT S5000", + "driver_version": "6.1.0", + "memory_total_mib": 49152, + }, + ] + } + ) + device = inspect_device( + "musa", device_ids=("1",), device_model=None, command=lambda argv: probe(stdout) + ) + assert device["status"] == "available" + assert [row["id"] for row in device["devices"]] == ["1"] + # Naming the unreadable device stays a failure rather than a silent pass. + missing = inspect_device( + "musa", device_ids=("0",), device_model=None, command=lambda argv: probe(stdout) + ) + assert missing["status"] == "unavailable" + assert "absent" in missing["reason"] diff --git a/tests/test_repository_packs_facade.py b/tests/test_repository_packs_facade.py index 70ff5c054..7adeeacd7 100644 --- a/tests/test_repository_packs_facade.py +++ b/tests/test_repository_packs_facade.py @@ -32,7 +32,10 @@ SRC = Path(__file__).resolve().parents[1] / "src" ROOT = SRC / "inferrsi" PACKS = ROOT / "harness" / "data" / "repo_packs" -SEVEN = ("vllm", "vllm_omni", "afd_plugin", "vllm_rlt", "strata", "sglang", "sglang_omni") +EIGHT = ( + "vllm", "vllm_omni", "vllm_musa", "afd_plugin", "vllm_rlt", "strata", + "sglang", "sglang_omni", +) RETIRED = "inferrsi._repo_pack_data" FACADE_CLOSURE = {"inferrsi", "inferrsi.resources", "inferrsi.resources.repository_packs"} # The facade needs none of these. #412 R1 retired root catalog, so the CLI parser that @@ -109,7 +112,7 @@ def _without_version(names) -> set[str]: def test_one_repo_types_object_reaches_every_consumer() -> None: canonical = repository_packs.REPO_TYPES - assert canonical == SEVEN and type(canonical) is tuple and len(canonical) == 7 + assert canonical == EIGHT and type(canonical) is tuple and len(canonical) == 8 assert knowledge_catalog.REPO_TYPES is canonical # #412 R1: root catalog is retired, so the parser binds the tuple from the facade # itself. It is the same object, read directly and never copied. @@ -152,7 +155,7 @@ def test_only_the_facade_defines_the_tuple_and_the_reader() -> None: assert readers == ["resources/repository_packs.py"] -@pytest.mark.parametrize("repo_type", SEVEN) +@pytest.mark.parametrize("repo_type", EIGHT) def test_each_pack_parses_to_its_packaged_bytes(repo_type: str) -> None: data = (PACKS / repo_type / "pack.json").read_bytes() anchored = files("inferrsi").joinpath("harness", "data", "repo_packs", repo_type, "pack.json") @@ -166,11 +169,11 @@ def test_each_pack_parses_to_its_packaged_bytes(repo_type: str) -> None: assert inspection.repository_pack(repo_type) == pack -def test_the_seven_packs_are_the_whole_harness_resource_root() -> None: +def test_the_eight_packs_are_the_whole_harness_resource_root() -> None: found = sorted( path.relative_to(PACKS).as_posix() for path in PACKS.rglob("*") if path.is_file() ) - assert found == sorted(f"{name}/pack.json" for name in SEVEN) + assert found == sorted(f"{name}/pack.json" for name in EIGHT) @pytest.mark.parametrize( @@ -191,10 +194,10 @@ def test_facade_and_parent_load_under_a_hook_that_blocks_every_other_inferrsi_im # The initializer alone loads nothing and binds no public name. assert _without_version(result["parent_only"]) == {"inferrsi", "inferrsi.resources"} assert result["parent_public"] == [] - # All seven packs were read with only the facade and its parent loaded. + # All eight packs were read with only the facade and its parent loaded. assert _without_version(result["loaded"]) == FACADE_CLOSURE - assert tuple(result["types"]) == SEVEN - for name in SEVEN: + assert tuple(result["types"]) == EIGHT + for name in EIGHT: expected = json.loads((PACKS / name / "pack.json").read_bytes().decode("utf-8")) assert result["packs"][name] == expected, name # Positive control: the hook is live and refuses every core, Harness included. @@ -216,7 +219,7 @@ def test_module_bodies_do_no_io_on_import() -> None: ] -@pytest.mark.parametrize("repo_type", SEVEN) +@pytest.mark.parametrize("repo_type", EIGHT) def test_a_read_opens_only_the_requested_pack_and_loads_no_module(repo_type: str) -> None: result = _fresh(READ, repo_type) package = os.path.normcase(str(ROOT)) diff --git a/tests/test_skill_index.py b/tests/test_skill_index.py index 0793cb099..49c507f69 100644 --- a/tests/test_skill_index.py +++ b/tests/test_skill_index.py @@ -48,7 +48,7 @@ def test_complete_index_retains_metadata_states_and_unknown_license(): records = search_knowledge(repo="inferrsi", limit=100) names = {record["name"] for record in skill_records(ROOT)} registry = json.loads((ROOT / "skill-index.json").read_text(encoding="utf-8"))["skills"] - assert len(records) == len(names) == 88 + assert len(records) == len(names) == 89 assert {record["skill_metadata"]["name"] for record in records} == names states = [] for record in records: @@ -66,7 +66,7 @@ def test_complete_index_retains_metadata_states_and_unknown_license(): } assert set(record["source_files"]) == set(record["sources"][0]["paths"]) states.append(metadata.get("status")) - assert states.count("candidate") == 88 + assert states.count("candidate") == 89 profiling = next(r for r in records if r["title"] == "ascend-operator-profiling") assert profiling["skill_metadata"]["license"] == "UNKNOWN" assert profiling["skill_metadata"]["synced-commit"] == ( @@ -271,7 +271,7 @@ def test_package_index_and_checkout_skill_have_distinct_read_boundaries(): assert reader.resolve("claim-contract") == "checkout:claim-contract" assert reader.read("claim-contract").metadata["kind"] == "skill" collected = reader.collect(repo="inferrsi", kind="knowledge", limit=100, material=True) - assert len(collected["items"]) == 88 + assert len(collected["items"]) == 89 assert not collected["collisions"] and not collected["omissions"] assert all(item["authority"] == "package" for item in collected["items"]) assert all("record.json" in item["resources"] for item in collected["items"]) @@ -306,4 +306,4 @@ def test_hardware_filters_include_only_matching_and_shared_skills(): assert len(records) == count assert all(record["backend"] in (backend, "common") for record in records) assert not (PROJECT / "skills").exists() - assert len(list(ROOT.rglob("SKILL.md"))) == 151 + assert len(list(ROOT.rglob("SKILL.md"))) == 152 diff --git a/tests/test_skill_library.py b/tests/test_skill_library.py index 966370938..7ca2bf8dc 100644 --- a/tests/test_skill_library.py +++ b/tests/test_skill_library.py @@ -171,7 +171,7 @@ def test_library_root_exposes_task_routing_and_supporting_categories(): assert {path.name for path in LIBRARY.iterdir() if path.is_dir()} == { "tasks", "systems", "playbooks", "workflows", "casebooks", "records", "config", "_compiled", } - assert len(list(LIBRARY.rglob("SKILL.md"))) == 151 + assert len(list(LIBRARY.rglob("SKILL.md"))) == 152 assert not any(path.name == "zh-CN" for path in LIBRARY.rglob("*") if path.is_dir()) references = LIBRARY / "workflows/research/inference-engine-research/references" assert (references / "import.md").is_file() From 0ca6ecfb4e9e5ca2078501443ee45d05ce0423cf Mon Sep 17 00:00:00 2001 From: xiaodongye Date: Fri, 20 Nov 2026 11:01:09 +0800 Subject: [PATCH 2/5] Regenerate the skill catalog for the unified library layout The skill moved to systems/engines/vllm-musa and its three records now live in skill_library/records, so the compiled inputs, the registry pin and the coverage table are regenerated together. Expected counts follow the library: 89 registered skills, 152 SKILL.md documents, 140 records. Signed-off-by: xiaodongye --- docs/legacy-knowledge-manifest.json | 4 ++-- docs/skill-coverage.md | 21 ++++++++++--------- .../skill_library/_compiled/_provenance.json | 4 ++-- .../data/skill_library/_compiled/inputs.json | 20 ++++++++++++++++++ tests/check_installed.py | 2 +- tests/test_cli_catalog.py | 2 +- tests/test_knowledge_find.py | 4 ++-- tests/test_source_snapshot.py | 2 +- 8 files changed, 40 insertions(+), 19 deletions(-) diff --git a/docs/legacy-knowledge-manifest.json b/docs/legacy-knowledge-manifest.json index 18e1bba7f..d06cfd437 100644 --- a/docs/legacy-knowledge-manifest.json +++ b/docs/legacy-knowledge-manifest.json @@ -340,8 +340,8 @@ "current_fragment": { "description": "REPO_TYPES and repository_pack as they stand after the MUSA registry revision", "hash_convention": "fragment_sha256 is the SHA-256 of source plus one trailing newline", - "fragment_sha256": "1a22a089a2707ac64b9e304807d397562d8c50ff14a25a8a77158182f17a703c", - "source": "REPO_TYPES tuple and pack.json reader, and imports no inferrsi module.\n# K02 moved pack.json to the Harness resource root (D007). The anchor stays the\n# root package and joins the physical path, so reading a Harness-owned resource\n# never imports inferrsi.harness and never gives infra an edge into Harness.\nfrom __future__ import annotations\n\nimport json\nfrom importlib.resources import files\nfrom typing import Any\n\nREPO_TYPES = (\n \"vllm\", \"vllm_omni\", \"vllm_musa\", \"afd_plugin\", \"vllm_rlt\", \"strata\", \"sglang\", \"sglang_omni\"\n)\n\n\ndef repository_pack(repo_type: str) -> dict[str, Any]:\n if repo_type not in REPO_TYPES:\n raise ValueError(f\"Unknown repository type: {repo_type}\")\n path = files(\"inferrsi\").joinpath(\"harness\", \"data\", \"repo_packs\", repo_type, \"pack.json\")\n return json.loads(path.read_text(encoding=\"utf-8\"))" + "fragment_sha256": "bddf8d146d14db887fcbc81d650a2101785303b3ea6f398d7f63af1cbd9c9371", + "source": "# Neutral raw repository-pack data leaf (D020). It holds only the original\n# REPO_TYPES tuple and pack.json reader, and imports no inferrsi module.\n# K02 moved pack.json to the Harness resource root (D007). The anchor stays the\n# root package and joins the physical path, so reading a Harness-owned resource\n# never imports inferrsi.harness and never gives infra an edge into Harness.\nfrom __future__ import annotations\n\nimport json\nfrom importlib.resources import files\nfrom typing import Any\n\nREPO_TYPES = (\n \"vllm\", \"vllm_omni\", \"vllm_musa\", \"afd_plugin\", \"vllm_rlt\", \"strata\", \"sglang\", \"sglang_omni\"\n)\n\n\ndef repository_pack(repo_type: str) -> dict[str, Any]:\n if repo_type not in REPO_TYPES:\n raise ValueError(f\"Unknown repository type: {repo_type}\")\n path = files(\"inferrsi\").joinpath(\"harness\", \"data\", \"repo_packs\", repo_type, \"pack.json\")\n return json.loads(path.read_text(encoding=\"utf-8\"))" }, "resource_path_revision": { "stage": "K02", diff --git a/docs/skill-coverage.md b/docs/skill-coverage.md index ad1b8b1ca..0d25c4468 100644 --- a/docs/skill-coverage.md +++ b/docs/skill-coverage.md @@ -4,7 +4,7 @@ Generated from the registry, SKILL.md frontmatter and the two maintained matrices. **Do not edit by hand**; regenerate after any registry, skill, matrix or frozen-plan change. -- Input digest: `sha256:93ad79f2b36af340d3c1c819dcb2f9b651d0f6078913aa726bd9ee1f01e9df54` +- Input digest: `sha256:a418dc94741cfa20a4feab44764c1e99e135308a2611a322851a17dca26e8e2f` - Regenerate: `python tools/build_skill_coverage.py` - Verify without writing: `python tools/build_skill_coverage.py --check` @@ -33,9 +33,9 @@ matrix: every field is copied from an owner that already maintains it. | Measure | Value | |---|---| -| Registered skill ids | 88 | -| By category | casebooks 2, playbooks 17, systems 53, tasks 8, workflows 8 | -| By backend | ascend 16, common 67, cuda 5 | +| Registered skill ids | 89 | +| By category | casebooks 2, playbooks 17, systems 54, tasks 8, workflows 8 | +| By backend | ascend 16, common 67, cuda 5, musa 1 | | Recorded on a numbered SearchSpace resource layer | 51 | | Recorded only in a supplementary guidance table (†) | 21 | | Resource layers explicitly not applicable | 15 | @@ -43,7 +43,7 @@ matrix: every field is copied from an owner that already maintains it. | Recorded on two or more resource layers | 24 | | Recorded in the Reference Matrix | 72 | | Selected by a frozen evaluation plan | 2 | -| `SKILL.md` documents in the library | 151 | +| `SKILL.md` documents in the library | 152 | | Unregistered documents (excluded from every count above) | 63 | A complete inventory is not a coverage claim. Every registered row below @@ -79,7 +79,7 @@ optimization is fully covered or that any procedure has measured benefit. | [video-diffusion-optimization](../src/inferrsi/knowledge/data/skill_library/playbooks/optimization/video-diffusion-optimization/SKILL.md) | common | Run and verify goal-driven video diffusion optimization, backend-agnostic. Use when the user asks for latency, RTF ... | Backend-agnostic video diffusion inference and serving optimization | — | 1 Accelerator † guidance: Video diffusion campaign guidance (unvalidated) | — | candidate · not_run · 0 readset(s) | no-Reference-Matrix-row, no-eval | | [weight-loading-optimization](../src/inferrsi/knowledge/data/skill_library/playbooks/optimization/weight-loading-optimization/SKILL.md) | common | Optimize the serving-level weight load path from storage to device: judge the load path on four dimensions (source ... | Diagnosing the serving-level weight load path from storage to device and choosing changes ... | failure_modes, input_contract, produced_artifact, refusal_point
6 advice | 1 Accelerator † guidance: Flare preparation and complete-session source contracts
2 RAM/Host † guidance: Flare preparation and complete-session source contracts; DeepSeek streamed expert-cache verification
3 SSD · Observe / Profile / Diagnose / Optimize / Verify † guidance: Flare preparation and complete-session source contracts; DeepSeek streamed expert-cache verification
4 Network · Configure / Optimize / Verify | 1 · Systems sources (Ascend/MindIE-SD @ 8481d39)
1 · Systems sources (NVIDIA/TensorRT-LLM @ f33e0e5fd)
1 · Systems sources (ascend-ai-coding/awesome-ascend-skills @ 75ec89c)
1 · Systems sources (foundation-model-stack/fastsafetensors @ 219e256)
1 · Systems sources (ggml-org/llama.cpp @ `3e390af18de1131dda27913c00511725b4274c8a` (MIT ...)
1 · Systems sources (mindie-agent/mindie-agent @ 6a81b41)
DeepSeek streamed expert-cache oracle contracts ([ronak-create/deepseek-v4-in-c](https://github.com/ronak-create/deepse ...) | candidate · not_run · 5 readset(s) | no-eval | -## Registered: Systems and implementations (53) +## Registered: Systems and implementations (54) | Skill | Backend | Declared task | Applicability | Conditions | SearchSpace layer / stage | Reference Matrix | State | Gaps | |---|---|---|---|---|---|---|---|---| @@ -136,6 +136,7 @@ optimization is fully covered or that any procedure has measured benefit. | [torchnpu-pinned-host-memory-lifecycle](../src/inferrsi/knowledge/data/skill_library/systems/platforms/ascend/torchnpu-pinned-host-memory-lifecycle/SKILL.md) | ascend | Diagnose TorchNPU pinned-host RAM allocation, asynchronous-copy lifetime, reuse and cache controls, then propose ... | Diagnose TorchNPU pinned-host RAM allocation, asynchronous-copy ownership/readiness ... | input_contract, produced_artifact, refusal_point
3 advice | 2 RAM/Host · Diagnose / Configure / Optimize / Verify | 1 · Systems sources (Ascend/pytorch (TorchNPU) @ `67511c53cd4c88014f6123de7097677e60e85faa` ...) | candidate · not_run · 1 readset(s) | no-eval | | [vllm-ascend](../src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-ascend/SKILL.md) | ascend | Analyze vLLM Ascend v0.27.1rc1 performance and commit evolution for DeepSeek-V4, Kimi K3, MiniMax-M3 and GLM5+, fused ... | Release-pinned performance diagnosis and historical optimization analysis for ... | input_contract, produced_artifact, refusal_point
5 advice | 1 Accelerator † guidance: vLLM Ascend v0.27.1rc1 serving diagnosis
2 RAM/Host † guidance: vLLM Ascend v0.27.1rc1 serving diagnosis | vLLM Ascend v0.27.1rc1 serving scope (vllm-project/vllm-ascend at `3b31886237ed65c435e0965b10e8002ff5769766`) | candidate · not_run · 3 readset(s) | no-eval | | [vllm-metal](../src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-metal/SKILL.md) | common | Investigate vllm-metal Apple inference through platform and native-ABI selection, paged KV/offload ownership ... | Selected plugin preparation, KV/offload ownership and speculative/deferred/dispatch ... | failure_modes, input_contract, produced_artifact
3 advice | 1 Accelerator † guidance: vLLM Metal selected source contracts
2 RAM/Host † guidance: vLLM Metal selected source contracts
3 SSD † guidance: vLLM Metal selected source contracts | vLLM Metal portable AREX source and CPU extraction (vllm-project/vllm-metal @ `e7df7a6ff215f99c7842552d230fdbc709835934` ...) | candidate · partial_cpu_only · 2 readset(s) | no-eval | +| [vllm-musa](../src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md) | musa | Investigate text-LLM and Omni serving performance on Moore Threads MUSA through the vllm-musa plugin: device identity ... | Device identity, compat-layer dispatch and pinned-image constraints for text-LLM and Omni ... | input_contract, produced_artifact, refusal_point
4 advice | **unknown** | — | candidate · not_run · 1 readset(s) | no-SearchSpace-layer, no-Reference-Matrix-row, no-eval | ## Registered: Task routing (8) @@ -238,7 +239,7 @@ an entrypoint routes to procedures below it rather than adding one. ## Integrity checks -- Registered ids resolve to an existing `SKILL.md`: 88 of 88. +- Registered ids resolve to an existing `SKILL.md`: 89 of 89. - Duplicate ids or paths: none; `skill_catalog` rejects them before this view is built. - Skill links in the two matrices that do not resolve: 0. @@ -246,11 +247,11 @@ an entrypoint routes to procedures below it rather than adding one. | Gap | Skills | |---|---| -| `no-SearchSpace-layer` | 1: husky | +| `no-SearchSpace-layer` | 2: husky, vllm-musa | | `conflicting-SearchSpace-layer` | 0: — | -| `no-Reference-Matrix-row` | 16: ascend-video-diffusion-optimization, audit-fixed-workload-claim, cite-check-downstream-pr, claim-contract, competitor-scan, draft-acceptance-issue, inference-task-router, rsi-evidence, task-accuracy, task-day-0, task-debug, task-derived-engine, task-independent-engine, task-performance, task-version-alignment, video-diffusion-optimization | +| `no-Reference-Matrix-row` | 17: ascend-video-diffusion-optimization, audit-fixed-workload-claim, cite-check-downstream-pr, claim-contract, competitor-scan, draft-acceptance-issue, inference-task-router, rsi-evidence, task-accuracy, task-day-0, task-debug, task-derived-engine, task-independent-engine, task-performance, task-version-alignment, video-diffusion-optimization, vllm-musa | | `no-applicability` | 0: — | -| `no-eval` | 86: as listed in the Gaps column above | +| `no-eval` | 87: as listed in the Gaps column above | These are inventory gaps, not efficacy results. Missing layer mappings stay unknown unless the owner records a reasoned N/A. N/A is not coverage; diff --git a/src/inferrsi/knowledge/data/skill_library/_compiled/_provenance.json b/src/inferrsi/knowledge/data/skill_library/_compiled/_provenance.json index e9c6505a5..8a7e45257 100644 --- a/src/inferrsi/knowledge/data/skill_library/_compiled/_provenance.json +++ b/src/inferrsi/knowledge/data/skill_library/_compiled/_provenance.json @@ -1,9 +1,9 @@ { "schema_version": 1, "repository": "https://github.com/InferMatrixLab/InferRSI", - "source_revision": "217d0b386d9c8d53bc06fc0d485f2e99722d5847", + "source_revision": "492abde5301c1aea3df1c8e1b5b4273ef35dfa49", "registry": { "path": "src/inferrsi/knowledge/data/skill_library/skill-index.json", - "sha256": "c6c235483034dfce3c0a4ec3bf7d68046ea2cf8c933f069833ecaef65cdf2d70" + "sha256": "d1b034bf9a3087186cdca935adfa7cf419f355e5e7a4195a330ba13547608bdb" } } diff --git a/src/inferrsi/knowledge/data/skill_library/_compiled/inputs.json b/src/inferrsi/knowledge/data/skill_library/_compiled/inputs.json index 8fbac40d7..9f8b3fc35 100644 --- a/src/inferrsi/knowledge/data/skill_library/_compiled/inputs.json +++ b/src/inferrsi/knowledge/data/skill_library/_compiled/inputs.json @@ -1379,5 +1379,25 @@ "references/flare-preparation-boundary.md": "c0d787522451f5b69a6d20b188d573183fa6d67de30f695ea668ca1ab7108929", "references/llama-loading-readset.md": "6c640f28ee3f0253a17b81461c865cb9f947367002cb75bf72550c4572d02e97" } + }, + "vllm-musa": { + "header": { + "name": "vllm-musa", + "description": "Investigate text-LLM and Omni serving performance on Moore Threads MUSA through the vllm-musa plugin: device identity, torchada dispatch boundaries, the pinned Omni image, and measurement rules that keep a CUDA-derived result from being reported as a MUSA result.", + "license": "Apache-2.0", + "disable-model-invocation": true, + "metadata": { + "disco-role": "operating" + } + }, + "files": { + "SKILL.md": "97fdd670fb4f18e7814c0e119fadbd508ac1d1d0a7ed622e2ed75d4e9cbe3340", + "metadata.json": "e01090d15044c54012f6a036ec73ca734239ba5fb4c84097fa55de64898fb62d", + "references/device-identity.md": "f525f40717f51e34b2e89721c8e5208c37d7e1237dc04247bc779b775bb79904", + "references/dispatch.md": "3c2eff36d76e9feedac5d9c54390391bffc191a23f853e00098c13df2f67a0b4", + "references/measurement.md": "980a9054fe5a80944f2cd698d31970ea8bf90eb4ab3b6eee8e591a68907bc031", + "references/omni.md": "639e5210662552e0d183744ba5940a7e52b32f6d58565d5a51dfbcd2d086df5d", + "references/sources.md": "3525e743e33e924f511e7c665e12be2d41b931ee3ac5e2cc419d63b50dd25bf4" + } } } diff --git a/tests/check_installed.py b/tests/check_installed.py index 7920bb518..66cbfebb0 100644 --- a/tests/check_installed.py +++ b/tests/check_installed.py @@ -61,7 +61,7 @@ def resource(logical): for resource_name in ("task.json", "TASK.md", "benchmark.py", "LICENSE"): assert root.joinpath(resource_name).is_file(), (benchmark_name, resource_name) records = knowledge_records() -assert len(records) == 139, "Knowledge is missing from the installation" +assert len(records) == 140, "Knowledge is missing from the installation" assert resource("data/skill_library/records/README.md").is_file() assert repository_pack("vllm_rlt")["id"] == "vllm_rlt" assert search_knowledge(repo="vllm_omni", backend="ascend") diff --git a/tests/test_cli_catalog.py b/tests/test_cli_catalog.py index fa442bdfa..ac954fec7 100644 --- a/tests/test_cli_catalog.py +++ b/tests/test_cli_catalog.py @@ -183,7 +183,7 @@ def test_knowledge_has_one_canonical_record_and_complete_navigation(): path.stem for path in root.glob("*.json") if json.loads(path.read_bytes()).get("tier", "contribution") == "contribution" } - assert sum(r.get("index_type") == "packaged-skill" for r in records) == 88 + assert sum(r.get("index_type") == "packaged-skill" for r in records) == 89 for record in records: assert "/pull/" not in json.dumps(record) assert record["verification"]["evidence_level"] in ("guidance", "upstream_reported") diff --git a/tests/test_knowledge_find.py b/tests/test_knowledge_find.py index 1efdb3258..ab2a784f7 100644 --- a/tests/test_knowledge_find.py +++ b/tests/test_knowledge_find.py @@ -63,7 +63,7 @@ def unexpected_view(*args, **kwargs): monkeypatch.setattr(catalog, "skill_views", unexpected_view) corpus = load_corpus(ROOT) - assert len(corpus.documents) == len({doc.identity for doc in corpus.documents}) == 135 + assert len(corpus.documents) == len({doc.identity for doc in corpus.documents}) == 139 def test_corpus_covers_all_three_kinds_without_double_counting(corpus): @@ -78,7 +78,7 @@ def test_corpus_covers_all_three_kinds_without_double_counting(corpus): day0 = find("day-0 model integration on Ascend", corpus, limit=3) assert day0["items"] and _ranked(day0, "inference-task-router") is None assert kinds["case"] == 7 - assert kinds["record"] == 48 + assert kinds["record"] == 51 # Packaged-skill projections are excluded so one owner is not ranked twice. assert all( document.kind != "record" or "skills." not in document.identity diff --git a/tests/test_source_snapshot.py b/tests/test_source_snapshot.py index e6116df4b..5f7f09e1f 100644 --- a/tests/test_source_snapshot.py +++ b/tests/test_source_snapshot.py @@ -84,7 +84,7 @@ def test_compiled_inputs_expand_to_public_records(): records = list(skill_views(root)) manifest = json.loads((GENERATED / snapshot.MANIFEST).read_bytes()) assert {p.name for p in GENERATED.iterdir()} == {INPUTS, snapshot.MANIFEST} - assert len(records) == len(inputs) == 88 + assert len(records) == len(inputs) == 89 public = search_knowledge(repo="inferrsi", limit=100) assert {r["id"] for r in records} == {r["id"] for r in public} for record in records: From dd76c988f0faa1ba54c64432fcd2df50587b72e0 Mon Sep 17 00:00:00 2001 From: xiaodongye Date: Fri, 20 Nov 2026 11:02:12 +0800 Subject: [PATCH 3/5] Embed the vllm-musa skill metadata in its frontmatter The unified library keeps skill metadata in SKILL.md instead of a sidecar metadata.json, and the docs point at the new systems/engines path. Signed-off-by: xiaodongye --- docs/musa.md | 7 +- .../systems/engines/vllm-musa/SKILL.md | 71 ++++++++++++++++++- .../systems/engines/vllm-musa/metadata.json | 66 ----------------- 3 files changed, 72 insertions(+), 72 deletions(-) delete mode 100644 src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/metadata.json diff --git a/docs/musa.md b/docs/musa.md index 97c215d0c..683c75860 100644 --- a/docs/musa.md +++ b/docs/musa.md @@ -68,8 +68,9 @@ Commands are executed as `argv` (no shell). Wrap pipelines in a script and pass `diffusion.image_generation`, `diffusion.video_generation`, `audio.tts`. Build from the MUSA Omni image so the pinned dependency set is part of the record. -Knowledge: `repo_packs/vllm_musa/knowledge/`. Operating procedure: -[`skill_library/repositories/vllm-musa/SKILL.md`](../src/inferrsi/knowledge/data/skill_library/repositories/vllm-musa/SKILL.md). +Knowledge: `skill_library/records/` for the three `vllm_musa.*` records and +`systems/engines/vllm-musa/` for the operating procedure +([`SKILL.md`](../src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md)). ## Bounds @@ -77,6 +78,6 @@ Knowledge: `repo_packs/vllm_musa/knowledge/`. Operating procedure: fixtures; it has not been executed against MUSA hardware in this repository. - A `musa` descriptor is deliberately `unverified` in `pack.json`; device discovery is not a compatibility or performance certification. -- Records under `repo_packs/vllm_musa/knowledge/` are source-derived +- Records under `skill_library/records/` are source-derived (`locally_verified: false`). CUDA and Ascend records remain scoped to their own hardware. diff --git a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md index a4bd8a135..e8729d6ab 100644 --- a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md +++ b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/SKILL.md @@ -1,10 +1,75 @@ --- name: vllm-musa description: "Investigate text-LLM and Omni serving performance on Moore Threads MUSA through the vllm-musa plugin: device identity, torchada dispatch boundaries, the pinned Omni image, and measurement rules that keep a CUDA-derived result from being reported as a MUSA result." -license: Apache-2.0 -disable-model-invocation: true metadata: - disco-role: operating + inferrsi: | + { + "profile": "local-skill-v1", + "schema_version": 1, + "kind": "skill", + "origin": [ + "external" + ], + "status": "candidate", + "empirical_validation": "not_run", + "license": "Apache-2.0", + "tags": [ + "vllm-musa", + "musa", + "moore-threads", + "torchada", + "pymtml", + "mtml", + "musa-visible-devices", + "vllm-omni", + "dispatch", + "measurement" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/MooreThreads/vllm-musa", + "commit": "7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", + "license": "Apache-2.0", + "paths": [ + "LICENSE", + "docker/vllm-omni.Dockerfile", + "vllm_musa/__init__.py", + "vllm_musa/platform.py" + ], + "readset": "references/sources.md" + } + ], + "provenance_readsets": [ + "references/sources.md" + ], + "consumption_mode": "packaged", + "applicability": { + "scope": "Device identity, compat-layer dispatch and pinned-image constraints for text-LLM and Omni serving on the vllm-musa plugin, plus the measurement rules that keep a CUDA-derived result separate from a MUSA one.", + "prerequisites": "A prepared MUSA host or the vllm-omni MUSA image, the plugin and compat-layer revisions, and a frozen benchmark plus quality command.", + "input_contract": "Plugin revision, upstream vLLM version, MUSA toolkit and driver, torchada/torch_musa revisions, model checkpoint, physical device UUID set and the workload.", + "produced_artifact": "An identity/dispatch/measurement report: physical device mapping, the named mechanism and its kernel evidence, and an AB/BA pair with its quality verdict.", + "refusal_point": "Report an evidence gap when the physical device set, the compat-layer revisions or the image constraint list cannot be established." + }, + "recommendations": [ + "Resolve the pymtml-physical versus torch-logical device mapping before any A/B.", + "Prove the mechanism is selected on MUSA from a profile instead of assuming a CUDA fast path ran.", + "Treat the Omni image's constraint list as the boundary of what can cause a change.", + "Keep the text-LLM and Omni lanes as separate claims." + ], + "limitations": [ + "Authored from source reading only: no MUSA hardware run, no quality or performance measurement.", + "Covers the plugin's contract at one revision; MATE, torchada and MUSA toolkit tuning are out of scope.", + "Contains no expected speedup and no statement that any CUDA or Ascend record transfers to MUSA." + ], + "construction": { + "anchor_kind": "source", + "distillation_form": "repository-operating-graph", + "method": "Source-read authoring against the plugin revision recorded in references/sources.md. No MUSA host was available, so no native import, build, service start or measurement was performed.", + "native_import": "not-run", + "status": "candidate" + } + } --- # vLLM-MUSA serving investigation diff --git a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/metadata.json b/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/metadata.json deleted file mode 100644 index 94a50b81c..000000000 --- a/src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-musa/metadata.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "schema_version": 1, - "kind": "skill", - "origin": [ - "external" - ], - "status": "candidate", - "empirical_validation": "not_run", - "license": "Apache-2.0", - "tags": [ - "vllm-musa", - "musa", - "moore-threads", - "torchada", - "pymtml", - "mtml", - "musa-visible-devices", - "vllm-omni", - "dispatch", - "measurement" - ], - "sources": [ - { - "type": "git", - "url": "https://github.com/MooreThreads/vllm-musa", - "commit": "7d5371a5ecfd1e04ea303f847e75cf3747e92fcd", - "license": "Apache-2.0", - "paths": [ - "LICENSE", - "docker/vllm-omni.Dockerfile", - "vllm_musa/__init__.py", - "vllm_musa/platform.py" - ], - "readset": "references/sources.md" - } - ], - "provenance_readsets": [ - "references/sources.md" - ], - "consumption_mode": "packaged", - "applicability": { - "scope": "Device identity, compat-layer dispatch and pinned-image constraints for text-LLM and Omni serving on the vllm-musa plugin, plus the measurement rules that keep a CUDA-derived result separate from a MUSA one.", - "prerequisites": "A prepared MUSA host or the vllm-omni MUSA image, the plugin and compat-layer revisions, and a frozen benchmark plus quality command.", - "input_contract": "Plugin revision, upstream vLLM version, MUSA toolkit and driver, torchada/torch_musa revisions, model checkpoint, physical device UUID set and the workload.", - "produced_artifact": "An identity/dispatch/measurement report: physical device mapping, the named mechanism and its kernel evidence, and an AB/BA pair with its quality verdict.", - "refusal_point": "Report an evidence gap when the physical device set, the compat-layer revisions or the image constraint list cannot be established." - }, - "recommendations": [ - "Resolve the pymtml-physical versus torch-logical device mapping before any A/B.", - "Prove the mechanism is selected on MUSA from a profile instead of assuming a CUDA fast path ran.", - "Treat the Omni image's constraint list as the boundary of what can cause a change.", - "Keep the text-LLM and Omni lanes as separate claims." - ], - "limitations": [ - "Authored from source reading only: no MUSA hardware run, no quality or performance measurement.", - "Covers the plugin's contract at one revision; MATE, torchada and MUSA toolkit tuning are out of scope.", - "Contains no expected speedup and no statement that any CUDA or Ascend record transfers to MUSA." - ], - "construction": { - "anchor_kind": "source", - "distillation_form": "repository-operating-graph", - "method": "Source-read authoring against the plugin revision recorded in references/sources.md. No MUSA host was available, so no native import, build, service start or measurement was performed.", - "native_import": "not-run", - "status": "candidate" - } -} From c3586b1e0de9703ae7f3ce06ca410c9720a2ff1e Mon Sep 17 00:00:00 2001 From: xiaodongye Date: Fri, 20 Nov 2026 11:02:41 +0800 Subject: [PATCH 4/5] Regenerate compiled inputs for the embedded skill metadata Signed-off-by: xiaodongye --- .../data/skill_library/_compiled/_provenance.json | 2 +- .../knowledge/data/skill_library/_compiled/inputs.json | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/inferrsi/knowledge/data/skill_library/_compiled/_provenance.json b/src/inferrsi/knowledge/data/skill_library/_compiled/_provenance.json index 8a7e45257..1478204a5 100644 --- a/src/inferrsi/knowledge/data/skill_library/_compiled/_provenance.json +++ b/src/inferrsi/knowledge/data/skill_library/_compiled/_provenance.json @@ -1,7 +1,7 @@ { "schema_version": 1, "repository": "https://github.com/InferMatrixLab/InferRSI", - "source_revision": "492abde5301c1aea3df1c8e1b5b4273ef35dfa49", + "source_revision": "dd76c988f0faa1ba54c64432fcd2df50587b72e0", "registry": { "path": "src/inferrsi/knowledge/data/skill_library/skill-index.json", "sha256": "d1b034bf9a3087186cdca935adfa7cf419f355e5e7a4195a330ba13547608bdb" diff --git a/src/inferrsi/knowledge/data/skill_library/_compiled/inputs.json b/src/inferrsi/knowledge/data/skill_library/_compiled/inputs.json index 9f8b3fc35..eade4940d 100644 --- a/src/inferrsi/knowledge/data/skill_library/_compiled/inputs.json +++ b/src/inferrsi/knowledge/data/skill_library/_compiled/inputs.json @@ -1383,16 +1383,10 @@ "vllm-musa": { "header": { "name": "vllm-musa", - "description": "Investigate text-LLM and Omni serving performance on Moore Threads MUSA through the vllm-musa plugin: device identity, torchada dispatch boundaries, the pinned Omni image, and measurement rules that keep a CUDA-derived result from being reported as a MUSA result.", - "license": "Apache-2.0", - "disable-model-invocation": true, - "metadata": { - "disco-role": "operating" - } + "description": "Investigate text-LLM and Omni serving performance on Moore Threads MUSA through the vllm-musa plugin: device identity, torchada dispatch boundaries, the pinned Omni image, and measurement rules that keep a CUDA-derived result from being reported as a MUSA result." }, "files": { - "SKILL.md": "97fdd670fb4f18e7814c0e119fadbd508ac1d1d0a7ed622e2ed75d4e9cbe3340", - "metadata.json": "e01090d15044c54012f6a036ec73ca734239ba5fb4c84097fa55de64898fb62d", + "SKILL.md": "ab657e8255e4ceedd105c3ee0f511878ade03d685f869075d38de7e5606dca00", "references/device-identity.md": "f525f40717f51e34b2e89721c8e5208c37d7e1237dc04247bc779b775bb79904", "references/dispatch.md": "3c2eff36d76e9feedac5d9c54390391bffc191a23f853e00098c13df2f67a0b4", "references/measurement.md": "980a9054fe5a80944f2cd698d31970ea8bf90eb4ab3b6eee8e591a68907bc031", From e78d0dd9e41c67ad93951116d7193266514936e8 Mon Sep 17 00:00:00 2001 From: xiaodongye Date: Fri, 20 Nov 2026 11:03:41 +0800 Subject: [PATCH 5/5] Update counts for the MUSA skill and record and refresh the coverage table The library now registers 89 skills, 152 SKILL.md documents and 140 records; a campaign search therefore considers 132 documents. Signed-off-by: xiaodongye --- docs/skill-coverage.md | 2 +- tests/test_campaign_task_selection.py | 2 +- tests/test_knowledge_contract.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/skill-coverage.md b/docs/skill-coverage.md index 0d25c4468..323286d36 100644 --- a/docs/skill-coverage.md +++ b/docs/skill-coverage.md @@ -4,7 +4,7 @@ Generated from the registry, SKILL.md frontmatter and the two maintained matrices. **Do not edit by hand**; regenerate after any registry, skill, matrix or frozen-plan change. -- Input digest: `sha256:a418dc94741cfa20a4feab44764c1e99e135308a2611a322851a17dca26e8e2f` +- Input digest: `sha256:e4ab7ddc989d9922cca4fd5b8a562cea3a88264918ffe156dfc2456f8eb8c960` - Regenerate: `python tools/build_skill_coverage.py` - Verify without writing: `python tools/build_skill_coverage.py --check` diff --git a/tests/test_campaign_task_selection.py b/tests/test_campaign_task_selection.py index cc92a2b3e..cee54d810 100644 --- a/tests/test_campaign_task_selection.py +++ b/tests/test_campaign_task_selection.py @@ -191,7 +191,7 @@ def test_task_skills_are_explicitly_readable_but_never_ranked_into_campaign(tmp_ relevance=cue, **options) ranked, state = verify_capture(path.read_bytes()) assert state == "verified" and ranked["items"] - assert ranked["retrieval"]["counts"]["considered"] == 128 + assert ranked["retrieval"]["counts"]["considered"] == 132 for group in ("items", "contexts", "context_omissions"): assert task_refs.isdisjoint(item.get("ref") for item in ranked[group]) refs = sorted(task_refs) diff --git a/tests/test_knowledge_contract.py b/tests/test_knowledge_contract.py index ba9cda2a1..359749541 100644 --- a/tests/test_knowledge_contract.py +++ b/tests/test_knowledge_contract.py @@ -32,7 +32,7 @@ def test_local_profiles_preserve_core_and_structured_ownership(): assert metadata["kind"] == "skill" for readset in metadata["provenance_readsets"]: assert (directory / readset).is_file() - assert len(normalized) == 77 + assert len(normalized) == 78 def test_local_profiles_omit_fields_that_equal_reader_defaults():