[Intel NPU/GPU] Add Windows & Linux Intel NPU & GPU support - #1171
[Intel NPU/GPU] Add Windows & Linux Intel NPU & GPU support#1171Looong01 wants to merge 39 commits into
Conversation
|
This is screenshot of Sabaki testing: And the binary release here: https://github.com/Looong01/KataGo-Multi-backends/releases/tag/v1.16.4-openvino |
|
I partially referenced the code from #1164, and I am very grateful to @ChinChangYang |
|
|
Thanks, I'll also look at this soon. |
Thanks! |
|
Thank you for the updates. b37aa25 works fine with the following minor corrections to the
In my environment, I also needed to downgrade GCC when running At the moment, this is the only branch that runs fast enough for practical use in my environment. I would appreciate official support for this. |
|
@Looong01 I don't know if this is a problem with the original or with OpenVino. |
This is a DEVICE_LOST from the Intel NPU that occurred mid-inference, after roughly 6 hours of self-play (~22,950 games).
The error message itself says "or driver update occurred." Windows Update silently pushes Intel NPU driver updates in the background. If WU updated the NPU driver during the 6-hour run, the device gets re-enumerated and all existing Level Zero contexts/handles are invalidated, causing in-flight inference to fail with device lost. This is ~22,950 games with many inferences each — a very large volume. If the intel_npu plugin or this OpenVINO version leaks memory or handles when repeatedly creating/destroying infer requests, accumulation past some threshold can hang the NPU firmware, triggering a GPU-TDR-style reset. The fact that it crashed after 6 hours rather than immediately is consistent with an accumulation-type issue. A single inference stalls past the watchdog timeout, the NPU is force-reset, and all subsequent command-queue submissions fail. Possible under sustained load, but NPU power draw is low, so this is the least likely. Add auto-restart + error recovery to the self-play loop. This is the most practical fix: after a device lost, the current process generally has to rebuild the ONNX Runtime session (re-initialize the Level Zero context) — simply catching the exception and continuing will likely fail on all subsequent inferences. The most robust approach is to have an outer script detect this error code, kill the process, and relaunch it, resuming from the last SGF/checkpoint. |
|
@Looong01 |
@foxrainowo |
|
@seniorfish |
SummaryAdapts the Intel_NPU branch's custom ONNX Runtime backend to the v1.16.5→v1.17.1 upstream sync. The The rewrite follows the design of the not-yet-merged upstream PR #1222 ("Add ONNX Changes
Testing
|
|
Intel GPU test on Ultra 9 275HX: |
|
I'm having issues using Although |
|
@foxrainowo Thanks again for the detailed testing — your logs (plus a day of controlled experiments on my machine) let us root-cause the NPU crash, and the fixes are now in. Updated report: Why
|
|
@lightvector Could u pls check this? Update to v1.17.1 and NPU, GPU, Hybird mode fully tested. It's ready to merge. |
|
After updating the versions of onnxruntime and openvino to the latest versions, the NPU backend can run normally (without getting stuck), but the speed is extremely slow. In version 1.17.1, the performance of the GPU backend is excellent, with a speed of around 80v/s. I don't know what special optimizations are involved, but the result is really surprising. However, the performance of the NPU backend is very poor. For comparison, b28_NPU_1.16.4 runs at 70v/s, while b40_NPU_1.16.4 runs at 30v/s. Assuming b11 >≈ b40, the speed of b11_NPU_1.17.1 should be greater than 30v/s.
|




Summary
This PR adds and hardens the Windows & Linux Intel NPU path for KataGo using the ONNX backend with ONNX Runtime + OpenVINO Execution Provider, and updates docs/config guidance for an end-to-end workflow.
It also improves failure behavior for non-ONNX builds and simplifies Windows & Linux dependency handling.
What Changed
1) ONNX backend and OpenVINO provider support
onnxProvider(cpu,openvino,cuda,tensorrt,migraphx,coreml).onnxOpenVINODeviceTypeonnxOpenVINODeviceIdonnxOpenVINOCacheDironnxOpenVINOEnableNPUFastCompile(best-effort; depends on ORT build support).onnxmodels directly.bin/.bin.gzmodels via internal conversion to ONNX graph2)
exportonnxcommand behaviorexportonnxis available in ONNX builds and exports fixed-size ONNX models.-x/-ycan override).exportonnxnow returns a clear error instead of failing ambiguously.3) Config safety for non-ONNX binaries
onnx*config keys now fails fast with a clear message.4) CMake dependency flow
ONNXRUNTIME_ROOT(defaulting tocpp/external/onnxruntime-win-x64-openvinoandcpp/external/onnxruntime-linux-x64-openvino).zlib,onnx,protobuf) through vcpkg when enabled.5) Documentation updates
Compiling.md:use_openvino=NPU)cpp/external/onnxruntime-win-x64-openvino.README.md:exportonnx(default 19x19)benchmarkgtpBehavior Notes
onnxDeviceToUseThread*) is mainly intended for ONNX providers like CUDA/TensorRT/MIGraphX.Validation
exportonnxworks from.bin/.bin.gz->.onnx.benchmark/gtprun withonnxProvider=openvinoandonnxOpenVINODeviceType=NPU.