轉檔時若 op 在目標 platform 不支援(如 Softmax@520),原本會白跑完 onnx+bie 兩階段、最後在 nef 的 batch_compile 拋難懂的 C++ backtrace(undefined CPU op)。 本次在 onnx 階段(拿到 out.onnx 後、進 bie 前)用 Kneron IP Evaluator (ktc ModelConfig.evaluate / ip_evaluator mode 0 會跑 compiler frontend) 早期偵測不支援 op,快速失敗並回清楚訊息。 - 新增 services/backends/precheck.py:run_precheck 掃 evaluate 的不支援訊號 (HardwareNotSupport / UnimplementedFeature / undefined CPU op / EmptyNode) 抽出 op 名、raise UnsupportedOperatorError;錯誤走既有 _push_done(fail) 回報 - services/workers/onnx/core.py:enable_precheck default-on;pre-check 與既有 evaluate 共用同一次 evaluate() 呼叫(避免跑兩次 compiler frontend) - error 訊息:「platform 520 不支援 operator Softmax,請改用支援的 platform (如 720/730)或將該 operator 移至 host 端後處理。」 - fail-open:只有明確訊號才擋、evaluate 環境問題無訊號則放行(不誤擋能跑的模型) - 17 tests pass(含多 op / dedup) follow-up(部署後、需 docker toolchain 環境):integration smoke 真觸發 Softmax@520 確認 onnx 階段就擋;依實測 frontend 耗時評估是否收窄 default-on 粒度。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Test Run Instructions
From the repository root, run:
pytest tests/workers
If you only want one worker's core tests:
pytest tests/workers/test_onnx_core.py
pytest tests/workers/test_bie_core.py
pytest tests/workers/test_nef_core.py
Input Files
These tests run the real KTC flow. You must provide input files.
Place them under tests/fixtures as follows:
tests/fixtures/
onnx/
input.onnx # Required for ONNX and BIE tests
bie_images/
image1.jpg # Required for BIE test (at least 1 image)
bie/
input.bie # Required for NEF test
outputs/
(test outputs will be written here)
Notes:
tests/fixtures/onnx/input.onnxshould be a valid ONNX model.tests/fixtures/bie_images/should contain at least one image file.tests/fixtures/bie/input.bieshould be a valid BIE file.- Outputs are written to
tests/fixtures/outputs/and are required for the tests.