[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115418":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":12,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":15,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":18,"hasPages":18,"topics":20,"createdAt":9,"pushedAt":9,"updatedAt":21,"readmeContent":22,"aiSummary":23,"trendingCount":14,"starSnapshotCount":14,"syncStatus":24,"lastSyncTime":25,"discoverSource":26},115418,"numpilot","DEGger21\u002Fnumpilot","DEGger21","面向科学智能的昇腾NPU代码自动迁移智能体",null,"Python",51,5,60,0,36,63.93,"Apache License 2.0",false,"main",[],"2026-11-24 04:01:36","\u003Cdiv align=\"center\">\n\n\u003Ch1>\u003Cimg src=\"docs\u002Fassets\u002Fbrand\u002Fnumpilot-wordmark.png\" alt=\"NumPilot\" width=\"560\">\u003C\u002Fh1>\n\n### End-to-end NumPy → AsNumpy migration for Ascend NPUs\n\n\u003Cp>\n  \u003Ca href=\"README.zh-CN.md\">简体中文\u003C\u002Fa> ·\n  \u003Ca href=\"#quick-start\">Quick start\u003C\u002Fa> ·\n  \u003Ca href=\"#architecture\">Architecture\u003C\u002Fa> ·\n  \u003Ca href=\"#results\">Results\u003C\u002Fa> ·\n  \u003Ca href=\"#contributing--license\">Contributing\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp>\n  \u003Cimg alt=\"Version\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fversion-0.3.0a1.dev0-6D5CE7?style=flat-square\">\n  \u003Cimg alt=\"Release stage\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fstatus-alpha-F59E0B?style=flat-square\">\n  \u003Cimg alt=\"Python\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPython-as%20supported%20by%20AsNumpy-3776AB?style=flat-square&amp;logo=python&amp;logoColor=white\">\n  \u003Cimg alt=\"NPU\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNPU-Ascend%20(runtime--detected)-008AA3?style=flat-square\">\n  \u003Cimg alt=\"License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache--2.0-2EA44F?style=flat-square\">\n\u003C\u002Fp>\n\n\u003C\u002Fdiv>\n\n## Overview\n\nNumPilot migrates complete NumPy programs to complete AsNumpy programs for Ascend NPUs.\nIt combines a six-role migration workflow with deterministic gates for parsing, capability\nresolution, builds, numerical comparison, and evidence. A model may propose code; only a\nverified receipt can mark a migration as passed.\n\n[AsNumpy](https:\u002F\u002Fgithub.com\u002Fasnumpy\u002Fasnumpy) is the NumPy-compatible tensor library for\nAscend NPUs, developed by the AISS team at Harbin Institute of Technology led by\nProf. Tonghua Su.\n\n## Quick start\n\nNumPilot supports two installation lanes. Use the frozen component lane on an Ascend host\nto reproduce the published demo. Use the CPU\u002Fshim lane for source development without CANN.\n\n### Ascend lane\n\nRequirements: Linux AArch64, CPython 3.12, an Ascend device, CANN 9.0 or newer, and a\nuser-owned virtual-environment directory. The published result uses the audited\nCANN 9.2.0-beta.2 profile.\n\n~~~bash\ngit clone --branch develop --depth 1 https:\u002F\u002Fgithub.com\u002FDEGger21\u002Fnumpilot.git\ncd numpilot\nmkdir -p \"$HOME\u002F.local\u002Fvenvs\"\n.\u002Finstall.sh --allow-network \\\n  --python \"$(command -v python3.12)\" \\\n  --asnumpy-component \"$PWD\u002Fcomponents\u002Fasnumpy\" \\\n  --cann-env \u002Fusr\u002Flocal\u002FAscend\u002Fcann-9.2.0-beta.2\u002Fset_env.sh \\\n  --venv \"$HOME\u002F.local\u002Fvenvs\u002Fnumpilot\" \\\n  --persistent-root \"$HOME\u002F.local\u002Fshare\u002Fnumpilot\"\n. \"$HOME\u002F.local\u002Fshare\u002Fnumpilot\u002Factivate-numpilot.sh\"\npython -m numpilot bootstrap --verify --json\npython -m numpilot doctor --backend npu --json\n~~~\n\nThe installer uses the exact wheel shipped in `components\u002Fasnumpy`, writes a hash-bound\nbootstrap receipt, and checks the CANN\u002FNPU runtime. It never downloads a floating AsNumpy\nversion. Do not copy an existing virtual environment between machines.\n\n### CPU\u002Fshim lane\n\n~~~bash\npython3 -m venv .venv\n. .venv\u002Fbin\u002Factivate\npython -m pip install -e '.[dev]'\npython -m numpilot doctor --backend shim\npython -m pytest -q -p no:cacheprovider tests\u002Ftest_install_script.py tests\u002Ftest_bootstrap.py\n~~~\n\n### Configure a model\n\nOnly the configured-model lane makes remote model requests. Create the private template\nand fill in your own service information:\n\n~~~bash\npython -m numpilot configure-llm --init\n# edit the private path printed above: base_url, auth_token, model\npython -m numpilot configure-llm --check\n~~~\n\nDo not reuse another user's token or endpoint. See [model contract](docs\u002Fmodel-contract.md)\nfor the request, receipt, privacy, and failure boundaries.\n\n### Terminal workbench\n\nStart the product shell from the activated environment:\n\n~~~bash\nnumpilot\n~~~\n\nThe startup page shows the NumPilot logo, a model status bar, and five choices: new\nmigration, load migration memory, check model, environment self-check, and exit. The\nmodel status starts as `未检查`; `\u002Fmodelcheck` sends one real lightweight probe to\n`llm.json` and then updates the bar. Startup never calls the model.\n\n| Command | Purpose |\n| --- | --- |\n| `\u002Fhelp` | Interaction help, status phases, and artifact layout |\n| `\u002Fnew` | Prompt for an absolute NumPy path and create a fresh session |\n| `\u002Fresume` | Load a previous migration memory |\n| `\u002Freadreport` | Render the latest `migration-report.md` in the terminal |\n| `\u002Fmodelcheck` | Manually probe the configured model |\n| `\u002Fdoctor` | Check CANN, NPU, Python, and AsNumpy |\n| `\u002Fstatus` | Show the current model status |\n| `\u002Fmigrate \u002Fabs\u002Fx.py` | Start migration with a known absolute path |\n| `\u002Fexit` | Leave NumPilot |\n\nEach migration writes a complete session under `runs\u002Fdemo-\u003Ctimestamp>\u002F`: a copy of the\nsource, the migration plan, the Markdown\u002FJSON report, verification and benchmark receipts,\nand the migrated program. A source without NumPy imports or calls is rejected before any\nmodel request. Agent status is monotonic; a completed role never returns to running.\n\n### One-shot CLI\n\n~~~bash\nnumpilot analyze program.py\nnumpilot migrate program.py --out runs\u002Fdemo\nnumpilot verify program.py \\\n  --migration-report runs\u002Fdemo\u002Fmigration\u002Fscript-migration-report.json \\\n  --output result --out runs\u002Fdemo\u002Fverification.json\n~~~\n\n`migrate` uses the configured-model lane; `verify` compares the original and migrated\nprograms under isolated workers. See the installation guide for the complete gate sequence.\n\n### Run the demo\n\nWith the environment active and `llm.json` configured, run:\n\n~~~bash\nnumpilot\n~~~\n\nInside the shell:\n\n~~~text\n\u002Fmodelcheck\n\u002Fnew\n\u002Fpath\u002Fto\u002Fnumpilot\u002Fexamples\u002Fdemo\u002Fscientific_feature_contraction.py\ny\n\u002Freadreport\n~~~\n\nThe non-interactive entry point is equivalent:\n\n~~~bash\npython -m numpilot interactive-migrate \\\n  \"$PWD\u002Fexamples\u002Fdemo\u002Fscientific_feature_contraction.py\" \\\n  --backend npu --benchmark --warmup 3 --samples 20 \\\n  --out \"runs\u002Fdemo-$(date +%Y%m%d-%H%M%S)\" \\\n  --yes --execute-source\n~~~\n\nThe demo program is a 1024 × 1024 FP32 scientific feature-contraction chain with five\nmatrix projections and bounded trigonometric transforms. Its 14 NumPy call sites are\nrewritten to AsNumpy while the original program remains the numerical oracle.\n\n### Optional H5 workbench\n\nThe terminal workbench remains the default. The optional H5 layer reuses the same\n`interactive-migrate` backend and the same private `llm.json`:\n\n~~~bash\n. \"$HOME\u002F.local\u002Fshare\u002Fnumpilot\u002Factivate-numpilot.sh\"\nnumpilot web --host 127.0.0.1 --port 7860\n~~~\n\n`.\u002Frun_web_demo.sh` is a source-checkout convenience wrapper for the same command. Open\n`http:\u002F\u002F127.0.0.1:7860` on the Ascend host, or forward it over SSH:\n\n~~~bash\nssh -N -L 7860:127.0.0.1:7860 \u003Cuser>@\u003Cascend-host>\n~~~\n\nThe server binds to loopback by default because uploaded Python is executed by the real\nworkflow. Do not expose it to an untrusted network without an authenticated proxy. The H5\ncommand bar supports `\u002Fhelp`, `\u002Fmodelcheck`, `\u002Fnew`, `\u002Freadreport`, and `\u002Fresume`. See\n[numpilot\u002Fweb\u002FREADME.md](numpilot\u002Fweb\u002FREADME.md) for the backend contract and security\nboundary.\n\n## Architecture\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fassets\u002Farchitecture\u002Fnumpilot-architecture-en.png\" alt=\"NumPilot architecture\" width=\"100%\">\n\u003C\u002Fp>\n\nThe pipeline runs six roles — Analyzer, Planner, API Gap Filler, Code Migrator,\nDiagnostics, and Migration Reporter — across three stages: analyze, migrate, and verify.\nDeterministic gates own parsing, capability resolution, builds, numerical comparison, and\nreceipts. A model may propose code, but it cannot upgrade an unverified claim.\n\n## Results\n\n### Verified migration demo\n\nThe demo source is `examples\u002Fdemo\u002Fscientific_feature_contraction.py`, a 1024 × 1024 FP32\nprogram with 14 NumPy call sites. The measured run used one CPU core and one Ascend 910B3\ncard, with 3 warmup iterations and 20 resident samples:\n\n| Metric | Result |\n| --- | ---: |\n| End-to-end migration time | 94.4 s |\n| CPU median | 429.809 ms |\n| NPU median | 10.283 ms |\n| Speedup | **41.80x** |\n| Numerical max absolute difference | 0 |\n\nEnd-to-end time covers the six-role model workflow, AST migration, numerical verification,\nand CPU\u002FNPU benchmarking. It does not include manual reading or idle time. The speedup is\nfor the steady device-resident region; input preparation and final device-to-host transfer\nare recorded separately in the benchmark receipt. Timing varies with the configured model\nservice.\n\n### Vitamin C: quantum-chemistry grid-density chain\n\nThe example uses a real Vitamin C molecule (20 atoms, 92 electrons, 208 basis functions,\n81,936 DFT grid points) and runs `dm.T @ AO → rho → weighted → electron_count`.\n\n| Scope | CPU single core | NPU resident | NPU warm end-to-end |\n| --- | ---: | ---: | ---: |\n| Full grid-density chain | 341.750 ms | 13.157 ms (**25.98x**) | 17.419 ms (**19.62x**) |\n\nThe SCF (~294.7 s) stays on CPU; the speedup covers the grid-density sub-stage only. Inputs\nare float32, `projected` max absolute error is 9.54e-6, `rho` is 1.83e-4, and the electron\ncount matches the CPU same-form result exactly. This example is a hand-written migration\nusing NumPilot's audit runtime (`model_called=false`), not a model-generated operator.\n\nDetails: [Vitamin C example](examples\u002Fscientific\u002Fgpu4pyscf_vitamin_c\u002FREADME.md) ·\n[evidence bundle](examples\u002Fscientific\u002Fgpu4pyscf_vitamin_c\u002Fevidence\u002FREADME.md).\n\n### Programs without API gaps\n\n71 complete NumPy programs use only APIs already covered by AsNumpy; 66 have CPU\u002FNPU\nmeasurements, with a median speedup of 11.06x. The four fastest by speedup:\n\n| Program | Workload | CPU \u002F NPU (ms) | Speedup |\n| --- | --- | ---: | ---: |\n| `A009_matrix_chain_2048` | two 2048 × 2048 float32 matmuls; 34.4 GFLOP | 1225.11 \u002F 2.00 | **612.41x** |\n| `A007_matrix_product_2048` | 2048 × 2048 float32 matmul; 17.2 GFLOP | 608.88 \u002F 1.68 | **361.58x** |\n| `B015_fortran_matmul_2048` | 2048 × 2048 Fortran-ordered float32 matmul | 634.30 \u002F 1.79 | **355.01x** |\n| `H015_real_vecdot_16384x256` | 16,384 × 256 float32; vecdot over both axes | 91.98 \u002F 0.56 | **164.79x** |\n\nFull table: [71-case migration benchmark](examples\u002Fscaled_benchmark_20261112\u002FBENCHMARK_TABLE.md).\n\nFor the 150-case benchmark corpus, `benchmark\u002Fclassification.json` records the API-surface\nsplit: 71 full-coverage cases and 79 gap\u002Fcontract cases. `benchmark\u002Fcovered\u002F` and\n`benchmark\u002Fgap\u002F` are read-only mirrored views; the original programs remain under\n`benchmark\u002Fcases\u002F`.\n\nThe 71-case archive records the runtime used at measurement time. Its AsNumpy\u002FCANN versions\nare not the current component baseline; reproduce the current path with `examples\u002Fdemo\u002F`,\n`examples\u002Fscientific\u002F`, and `components\u002Fasnumpy\u002F`.\n\n### Programs with real API gaps\n\nMeasured results for the four promoted complete-program cases from the six-case batch,\nplus the six real Ascend C operator cases:\n\n| Program | Gap API | Workload | End-to-end time | CPU \u002F NPU (ms) | Speedup |\n| --- | --- | --- | ---: | ---: | ---: |\n| `std` | `np.std` | 2048 × 2048 float32; std over axis=1 | 90.9 min | 15.96 \u002F 0.3718 | **42.92x** |\n| `tril` | `np.tril` | 2048 × 2048 float32; lower triangle | 38.4 min | 14.16 \u002F 1.649 | **8.59x** |\n| `ediff1d` | `np.ediff1d` | 2048 × 2048 float32 flattened; 4,194,303 differences | 60.7 min | 4.48 \u002F 1.664 | **2.69x** |\n| `pad` | `np.pad` | 2048 × 2048 float32; constant pad | 47.0 min | 4.117 \u002F 1.724 | **2.39x** |\n| `D1002_ulp_budget` | `np.spacing` | 1024 × 1024 float32; per-element ULP budget | 36.2 min | 34.860681 \u002F 4.032468 | **8.65x** |\n| `D1004_two_track_velocity` | `np.diff` | 1024 × 1024 float32; first difference, output 1024 × 1023 | 51.7 min | 27.339721 \u002F 8.133022 | **3.36x** |\n| `D1009_periodic_transport` | `np.roll` | 1024 × 1024 float32; axis=1 roll | 51.9 min | 26.669054 \u002F 7.455630 | **3.58x** |\n| `D1003_rounding_envelope` | `np.nextafter` | 1024 × 1024 float32; outward rounding envelope | 17.5 min | 47.455408 \u002F 4.736910 | **10.02x** |\n| `D1007_repeat_samples` | `np.repeat` | 1024 × 1024 float32; factor-3 repeat on axis=1, output 1024 × 3072 | 22.6 min | 49.392092 \u002F 27.628917 | **1.79x** |\n| `D1012_class_selection` | `np.argmax` | 1024 × 1024 float32; axis=1 winner indices, int64 output | 22.8 min | 30.189417 \u002F 5.230176 | **5.77x** |\n\nThe six generated-operator cases consumed 4,233,348 generation tokens in total. Each case\nalso has a native ACLNN numerical probe, operator unit tests, a route check, and a complete\nprogram comparison. See [the gap-operator archive](examples\u002Fgap_archive_20261112\u002FBENCHMARK_TABLE.md)\nfor per-case generation time, token usage, and evidence paths.\n\n`tril` requires a separate caveat: its standalone benchmark passed at 8.59x, but the full\nNumPilot migration receipt failed with `runtime target snapshot is invalid`. It is therefore\nnot counted as a completed full-program migration.\n\nThe archived `flip` and `argpartition` cases are retained as correctness evidence but are\nnot used as speedup claims: `flip` returns an O(1) view on the CPU baseline, and\n`argpartition` operates on only 512 elements where launch and synchronization dominate.\n\n## Repository layout\n\n```text\nnumpilot\u002F            migration framework, six agents, gates, CLI, H5 backend\nbenchmark\u002F           150-program corpus, classification, scopes, gap evidence\nexamples\u002Fdemo\u002F       user-facing scientific migration demo\nexamples\u002Fscientific\u002F real scientific workload (Vitamin C)\nexamples\u002F*_archive\u002F  immutable benchmark evidence and performance tables\ncomponents\u002Fasnumpy\u002F  frozen AsNumpy wheel, source snapshot, manifest, SBOM\ndocs\u002F                installation, architecture, contracts, and audit documents\nskill\u002F               CodeArts-compatible migration skill\ntests\u002F               regression and release-gate tests\ntools\u002F               reproducibility and release-audit utilities\n```\n\n## Contributing & License\n\nIssues and pull requests are welcome in the [GitHub repository](https:\u002F\u002Fgithub.com\u002FDEGger21\u002Fnumpilot).\nSee [CONTRIBUTING.md](CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). Report\nsecurity issues through the private channel described in [SECURITY.md](SECURITY.md).\n\nNumPilot is released under the [Apache-2.0 License](LICENSE).\n","NumPilot 是一个面向科学智能的昇腾NPU代码自动迁移智能体，专注于将完整 NumPy 程序端到端迁移到 AsNumpy（昇腾平台上的 NumPy 兼容张量库）。其核心采用六角色协同工作流，集成确定性解析、算子能力映射、构建验证、数值一致性比对与证据归档机制，确保迁移结果可验证、可追溯。项目依赖 Ascend CANN 运行时，支持在真实 NPU 环境或 CPU shim 模式下开发与验证。适用于科研计算、AI 基础库适配及国产化算力平台迁移等场景，尤其适合需保持数值精度与接口兼容性的科学计算代码迁移任务。",2,"2026-11-21 04:50:15","CREATED_QUERY"]