Accelerator autodetection: use whatever compute a node has (CUDA/VNNI/iGPU/NPU/TPU) #129
Labels
No labels
agent
blocked
foreground
needs-andrew
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Tabled
needs-andrew
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
kreeader/kreeader-server#129
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Design:
roadmap/accelerator-autodetection.md. Probe at startup (asking runtimes, not inferring from hardware), stored capability manifests reported with agent registration, capability+measurement-based work routing, honest degradation with #123 issue raising. Phase 1 = probe package + manifests + measured use_cuda flip on rhaegar; Phase 2 = routing seams; Phase 3 = NPU/TPU execution paths as hardware arrives.Phase 1's detection + selection layer is on
feat/accelerator-autodetect(5 commits, pushed).Built
capabilities/package: versioned manifest (schema v1) with CUDA (asked of the linked OpenCV CUDA module via an injectedCUDAProbehook, so the package stays gocv-free), CPU features from/proc/cpuinfonarrowed to the routing-relevant flags (AVX2/AVX-512/VNNI/AMX), and report-only iGPU (/dev/dri/renderD*) / NPU (/dev/accel*) / TPU (/dev/apex*) device classes carryingruntime_probed:false, usable:false.probed=false(nobody asked) andavailable=false(asked, none) stay distinct facts.use_cudais now three-state.config.PaneDetectionConfig.UseCUDASetrecords whether an operator actually wrote it (config file viaviper.InConfig, or theKREEADER_env form). Explicit always wins, with one exception:use_cuda=trueon a node with no CUDA device degrades to CPU and says so, rather than being honored literally while gocv silently falls back one layer down.capabilities.ResolveConfigruns at startup ABOVE the agent-mode branch in main.go, so both the server and a detection agent get it, and writes the effective value back intocfg.Processing.PaneDetection.UseCUDA— every existing consumer (Processor, escalation ladder, signals, panetrain's adoption gate, the agent loop) keeps reading the same field. No existinguse_cudaplumbing was removed.GET /api/admin/debug/accelerators(admin-gated, next to memstats/pprof) returns manifest + selection with source (config/autodetect),degraded, and a one-sentence reason. Mirrored inapi/openapi.yaml(path + 6 schemas).packaging/config.tomlno longer ships an explicituse_cuda = false— that line made every packaged install permanently opt out of the probe. Documented inconfig.toml.exampleand a newdocs/operations.mdsection.Measured on rhaegar (live probe, not a claim):
cpu=12t+avx2+avx512+vnni cuda=1 device(s) igpu=present(unused)— Xeon W-11855M, 1 CUDA device via opencv-cuda,/dev/dri/renderD128present but unused. Withuse_cudaunset it now autodetects to GPU. That is the roadmap's "flip rhaegar's use_cuda by measurement" item, done by probe rather than by editing a TOML.Deferred (not in this branch)
Gates:
CGO_LDFLAGS=-lprotobuf go build ./...OK,go vet ./...OK,go test ./api/ ./components/detection/processing/ ./capabilities/ ./config/ ./agent/ .all OK.go build -tags nocv ./...OK. (go vet -tags nocv ./components/detection/processing/fails on a pre-existing untaggedchoose_test.goreferencingcv.PageResult; unrelated to this branch.)Selection logic is table-tested with injected probe results — probe results are environment-dependent, so nothing asserts against the host.
First measured increment merged (
5074f31, branch feat/accelerator-autodetect): versioned accelerator manifest (CUDA probe, CPU AVX2/AVX-512/VNNI/AMX flags, report-only iGPU/NPU/TPU device classes), tri-state use_cuda — explicit wins, true-without-CUDA degrades with recorded reason, unset autodetects — applied at startup for server and agent, admin inventory at /api/admin/debug/accelerators, openapi mirrored, docs. Live-verified on rhaegar (autodetects its CUDA device with the key unset; packaged config no longer ships a hardcoded use_cuda=false). Deferred (agent heartbeat manifest + fleet view, routing seams, NPU/TPU execution paths, mid-run CUDA-OOM latching) stays in roadmap/accelerator-autodetection.md. Closing the issue on the autodetection deliverable.