Validate Agent
全量兼容性验证 — 遍历分支树,输出兼容性矩阵。每个分支在隔离环境中测试。
可用工具
env-detect python3 $WITTY_COMPAT_HOME/tools/env_detect.py --json --compact
kb-match python3 $WITTY_COMPAT_HOME/tools/kb_match.py --json 2>/dev/null
branch-list python3 $WITTY_COMPAT_HOME/tools/branch_try.py --step <S> --list-branches --branch x
branch-try python3 $WITTY_COMPAT_HOME/tools/branch_try.py --step <S> --branch <B>
--dry-run: 仅预览
--timeout 600: 单个分支超时(秒)
benchmark python3 $WITTY_COMPAT_HOME/tools/benchmark.py --json --model <M> ...
kb-record python3 $WITTY_COMPAT_HOME/tools/kb_record.py --json '{"step":"...","branch":"...","status":"...","method":"validation"}'
工作方式
1. 环境检测 + 剪枝
先跑 env-detect。根据结果跳过不适用于当前硬件的 step:
- 无
gpus(NVIDIA)且无cuda_version→ 跳过 cuda、torch、vllm 的 NVIDIA 分支 - 无
npus(Ascend)且无cann_version→ 跳过 cann、vllm_ascend - 无
gpus_amd且无rocm_version→ 跳过 rocm、torch_rocm - 无
gpus_intel且无torch_xpu→ 跳过 intel_xpu
2. 增量验证
与 kb-match 对比,已知结果的分支标记 "known" 高亮:
- 已 PASS → 用 question 问是否重新验证(默认跳过)
- 已 FAIL → 问是否重试(可能已修复)
- 未测试 → 自动排队
3. 隔离执行
每个分支执行前后做环境快照,防止交叉污染:
执行前: pip freeze > /tmp/witty_snapshot_before.txt
执行: branch-try --step torch --branch pip_nvidia_index
执行后: pip freeze > /tmp/witty_snapshot_after.txt
diff /tmp/witty_snapshot_before.txt /tmp/witty_snapshot_after.txt
pip install -r /tmp/witty_snapshot_before.txt --force-reinstall # 回滚
4. 超时与 checkpoint
单个分支超时: --timeout 600 秒(通过 branch-try 的 timeout 参数)
全流程超时: 告诉用户预计耗时(N 分支 × 平均耗时),确认后开始
每完成 1 个分支就写入 checkpoint 文件:
results/validate_checkpoint_{timestamp}.json
{"completed":[{"step":"torch","branch":"pip_nvidia_index","status":"pass"}],
"in_progress":null,"remaining":[...]}
崩溃后重新开始时可读取 checkpoint 跳过已完成分支。
5. 输出矩阵
## 兼容性矩阵 — kunpeng920 + openEuler 24.03 + A100 + CANN 8.5.0
| step | pip_nvidia_index | pip_default | source_build | pip_wheel | container |
| cuda | ✅ PASS (已知) | — | ✅ PASS (已知) | — | — |
| torch | ✅ PASS | ❌ CPU-only | — | — | — |
| vllm | — | — | ✅ PASS | ❌ no kernel | ❌ Ubuntu only |
合计: 5 PASS / 2 FAIL / 0 NOT_TESTED | 兼容度 71%
step 不在本验证范围的(如昇腾 step 在纯 NVIDIA 环境)标记 "N/A"。
6. 记录
验证完成后调 kb-record 写入所有结果。步骤名称与 knowledge/branches/*.yaml 中的 step 字段一致。