Repository navigation
Local AI unusable on DGX Spark (Windows ARM64): shared GPU memory is not CUDA-allocatable, and a capability failure rolls back the whole setup - #1237
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 26, 2026, 6:43 PM ET / 22:43 UTC. ClawSweeper reviewWhat this changesThe branch replaces NVML/DXGI display-name matching with PCI-identity matching and carries PCI identifiers through GPU discovery. Merge readiness⛔ Blocked by patch quality or review findings - 8 items remain Keep open for maintainer direction. This MEMBER-authored draft explicitly says it is a non-mergeable reproducer, and its PCI join would make WDDM shared memory count as CUDA allocation capacity, causing false-eligible model downloads and later allocation failure. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherLocal AI hardware discovery combines NVML CUDA-memory facts with DXGI shared-memory facts before model eligibility selects a runtime and downloads a model. The resulting selection feeds setup-time inference verification and the Local AI recovery UI. flowchart LR
A[NVML device memory] --> C[GPU memory association]
B[DXGI shared memory] --> C
C --> D[Eligibility capacity calculation]
D --> E[Model selection]
E --> F[Setup download and inference verification]
Decision needed
Why: The branch proves that a PCI join is technically possible but also demonstrates that its resulting capacity contract is wrong on the reported hardware; the supported WDDM capacity and recovery policy require maintainer intent. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep NVML dedicated memory as the WDDM eligibility limit, retain stable identity only for diagnostics and mismatch warnings, then separately design tested capability-failure recovery that preserves completed gateway setup and verified artifacts. Do we have a high-confidence way to reproduce the issue? Unclear for a current-main live run: the supplied DGX evidence used a local driver-threshold adjustment, but source proves the branch would add matched DXGI shared memory to the eligibility calculation. Is this the best way to solve the issue? No. PCI identity is useful for diagnostics, but the current selector treats the associated shared memory as CUDA-allocatable capacity, which the supplied WDDM evidence says is false. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ff3fb35a7d32. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
Shared GPU memory is discovered through DXGI and attached to the NVML device it belongs to by matching adapter *name*. The two APIs do not always report the same name for the same physical adapter, and when they disagree the match silently fails, SharedGpuMemoryBytes stays null, and the adapter is assessed on its dedicated pool alone. On a unified-memory part that is the difference between working and not. Measured on a DGX Spark (GB10) engineering unit: NVML name : 'JMJWOA-Generic-GPU' shared: null DXGI name : 'RTX Spark GPU' SharedSystemMemory: 30.07 GiB => no match, 30.07 GiB discarded The adapter is then judged to have 15.94 GiB instead of 46.01 GiB, and every model in the catalog fails eligibility with InsufficientGpuMemory: Qwen3.6 35B-A3B required 34.11 GiB detected 15.94 GiB Unsupported Qwen3.6 27B required 39.93 GiB detected 15.94 GiB Unsupported Qwen3.5 9B required 21.47 GiB detected 15.94 GiB Unsupported There is no diagnostic pointing at the cause: the failure reads as "this machine is too small", not "the join failed". DXGI already reads VendorId, DeviceId and SubSystemId in DXGI_ADAPTER_DESC1 and discards them. NVML exposes the same identity via nvmlDeviceGetPciInfo_v3, which packs pciDeviceId as (deviceId << 16) | vendorId. This joins on that identity and keeps the name match as a fallback, so behaviour is unchanged wherever the names already agree or PCI identity is unavailable. The identity match requires exactly one candidate, so an ambiguous set still attributes nothing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01BE8kMbmSjPCwd8i9GJEsqx
cce6ebb to
05994b9
Compare
Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes openclaw#1191. Related: Dallin's openclaw#1237 and Pedro's openclaw#1239.
|
Closing this research PR because it explicitly is not a merge candidate. The useful DGX/PCl investigation is preserved in issue discussion and the current follow-up work in #1239. |
Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes openclaw#1191. Related: Dallin's openclaw#1237 and Pedro's openclaw#1239.
Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes openclaw#1191. Related: Dallin's openclaw#1237 and Pedro's openclaw#1239.
Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes openclaw#1191. Related: Dallin's openclaw#1237 and Pedro's openclaw#1239.
Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes openclaw#1191. Related: Dallin's openclaw#1237 and Pedro's openclaw#1239.
Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes openclaw#1191. Related: Dallin's openclaw#1237 and Pedro's openclaw#1239.
Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes openclaw#1191. Related: Dallin's openclaw#1237 and Pedro's openclaw#1239.
Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes openclaw#1191. Related: Dallin's openclaw#1237 and Pedro's openclaw#1239.
* fix(local-ai): use CUDA for allocatable GPU memory Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes #1191. Related: Dallin's #1237 and Pedro's #1239. * refactor(local-ai): capture CUDA GPUs with a functional pipeline Split CaptureCudaGpus into TryCaptureGpu (per-device capture) and WithCudaContext (context create/destroy) and reassemble via Enumerable.Range(...).Select(...).Where(...).ToList(). Suggested in review: #1253 (review) * fix(local-ai): bound GPU admission by dedicated device memory CUDA-reported memory alone is not a safe Local AI admission bound on WDDM. On the recorded DGX Spark, cuMemGetInfo advertised 46,332 MiB because CUDA surfaces the shared host pool, while llama-server still died allocating 16,186 MiB against roughly 15.9 GiB of real device memory. Cap the CUDA-reported total at the adapter's DXGI dedicated video memory, joined to the CUDA device by adapter LUID, and take free memory from the adapter's local budget when it is available. Shared system memory is host RAM, so it is never added to the number eligibility is judged against. When no dedicated bound can be resolved, capacity stays unknown so qualification retries instead of over-qualifying the device. A reservation-based allocation gate was evaluated and rejected: on an RTX 4080 SUPER with 16,375 MiB, cuMemAlloc accepted 32,751 MiB and cuMemCreate accepted 65,536 MiB, so WDDM reservations cannot discriminate allocatable capacity. Also keep partial NVIDIA facts instead of collapsing them to a definitive no-GPU verdict. Only an absent driver or a driver reporting no device proves that no NVIDIA GPU exists; a failed cuInit, a failed device count, and per-device name, UUID, LUID, or memory failures now leave the device visible with missing facts null, which yields the retryable HardwareFactsIncomplete state. An inconclusive GPU also outranks a definitively unsupported one so recheck stays available. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4 * fix(local-ai): keep non-DXGI CUDA hosts supported with an NVML bound Capping admission capacity at the DXGI dedicated figure alone contracted support: a unified-memory DGX or Blackwell part that reports no dedicated video memory, a TCC device, or a headless GPU has no usable DXGI adapter and would resolve no bound at all, leaving a supported host permanently in the retryable incomplete state. Add an NVML dedicated-memory source joined on device identity. NVML keys on the same GPU-... UUID the CUDA driver reports, so the join is an exact identity match rather than an adapter-name guess. NVML reports dedicated device memory only and never the WDDM shared host pool, which is why it reported 16,320 MiB on the DGX Spark where CUDA advertised 46,332 MiB and llama-server died at 16,186 MiB. DXGI stays preferred wherever it applies, so the conservative WDDM budget behavior is unchanged. NVML is consulted only when DXGI supplies no adapter or reports zero dedicated memory. Capacity remains min(cudaTotal, dedicated) from a driver-reported source, with no raw CUDA total and no invented constants, and when neither source resolves the device still stays retryable rather than over-qualified. nvml.dll is loaded only from fully qualified driver-owned paths, matching the System32 pinning used for nvcuda.dll and dxgi.dll. Adds regressions for the no-LUID, no-DXGI, zero-dedicated, DXGI-preferred, identity-mismatch, and both-sources-failing cases, plus a hardware-gated proof that the non-DXGI path yields the same qualification decision as the DXGI path on real hardware. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4 * fix(local-ai): combine GPU memory bounds conservatively DXGI reports this process's WDDM budget while NVML reports device-wide unallocated memory. Preferring whichever source resolved first let the same GPU be called ready or busy purely by source availability. Combine instead: when both sources identify the device, take the smaller dedicated bound and the smaller free reading. The admission decision is then deterministic and conservative regardless of which sources a host exposes, and a device is never admitted on the larger of two bounds. Also free the NVML loader reference, widen the interop catch to the marshalling and SEH failures the previous implementation handled, keep library cleanup reachable when shutdown throws, narrow the NVML remarks to what the recorded Windows evidence supports, and note that MIG compute instances are out of scope. Adds disagreeing-bounds, case-insensitive multi-device identity join, and exact allowed-path regressions, and makes the hardware tests fail loudly instead of passing silently when integration is enabled without a GPU. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4 * test(local-ai): skip GPU proofs on hosts without an NVIDIA device The two hardware proofs were gated only by OPENCLAW_RUN_INTEGRATION, so hosted GPU-less CI runners ran them and failed on the explicit "requires an NVIDIA GPU" assertions. Gate them on the device instead. NvidiaHardwareFactAttribute skips when no NVIDIA GPU is detected, so ordinary CI stays green, while an explicit hardware proof run with OPENCLAW_RUN_GPU_PROOF=1 still requires the device and fails loudly if it is missing. No production logic changes. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4 --------- Co-authored-by: Pedro Larroy <[email protected]> Co-authored-by: Scott Hanselman <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4
…aw#1253) * fix(local-ai): use CUDA for allocatable GPU memory Query the CUDA driver directly for device identity and total/free allocatable memory instead of combining NVML and DXGI accounting. This should qualify both discrete RTX and UMA devices using the same allocator-visible source of truth. Closes openclaw#1191. Related: Dallin's openclaw#1237 and Pedro's openclaw#1239. * refactor(local-ai): capture CUDA GPUs with a functional pipeline Split CaptureCudaGpus into TryCaptureGpu (per-device capture) and WithCudaContext (context create/destroy) and reassemble via Enumerable.Range(...).Select(...).Where(...).ToList(). Suggested in review: openclaw#1253 (review) * fix(local-ai): bound GPU admission by dedicated device memory CUDA-reported memory alone is not a safe Local AI admission bound on WDDM. On the recorded DGX Spark, cuMemGetInfo advertised 46,332 MiB because CUDA surfaces the shared host pool, while llama-server still died allocating 16,186 MiB against roughly 15.9 GiB of real device memory. Cap the CUDA-reported total at the adapter's DXGI dedicated video memory, joined to the CUDA device by adapter LUID, and take free memory from the adapter's local budget when it is available. Shared system memory is host RAM, so it is never added to the number eligibility is judged against. When no dedicated bound can be resolved, capacity stays unknown so qualification retries instead of over-qualifying the device. A reservation-based allocation gate was evaluated and rejected: on an RTX 4080 SUPER with 16,375 MiB, cuMemAlloc accepted 32,751 MiB and cuMemCreate accepted 65,536 MiB, so WDDM reservations cannot discriminate allocatable capacity. Also keep partial NVIDIA facts instead of collapsing them to a definitive no-GPU verdict. Only an absent driver or a driver reporting no device proves that no NVIDIA GPU exists; a failed cuInit, a failed device count, and per-device name, UUID, LUID, or memory failures now leave the device visible with missing facts null, which yields the retryable HardwareFactsIncomplete state. An inconclusive GPU also outranks a definitively unsupported one so recheck stays available. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4 * fix(local-ai): keep non-DXGI CUDA hosts supported with an NVML bound Capping admission capacity at the DXGI dedicated figure alone contracted support: a unified-memory DGX or Blackwell part that reports no dedicated video memory, a TCC device, or a headless GPU has no usable DXGI adapter and would resolve no bound at all, leaving a supported host permanently in the retryable incomplete state. Add an NVML dedicated-memory source joined on device identity. NVML keys on the same GPU-... UUID the CUDA driver reports, so the join is an exact identity match rather than an adapter-name guess. NVML reports dedicated device memory only and never the WDDM shared host pool, which is why it reported 16,320 MiB on the DGX Spark where CUDA advertised 46,332 MiB and llama-server died at 16,186 MiB. DXGI stays preferred wherever it applies, so the conservative WDDM budget behavior is unchanged. NVML is consulted only when DXGI supplies no adapter or reports zero dedicated memory. Capacity remains min(cudaTotal, dedicated) from a driver-reported source, with no raw CUDA total and no invented constants, and when neither source resolves the device still stays retryable rather than over-qualified. nvml.dll is loaded only from fully qualified driver-owned paths, matching the System32 pinning used for nvcuda.dll and dxgi.dll. Adds regressions for the no-LUID, no-DXGI, zero-dedicated, DXGI-preferred, identity-mismatch, and both-sources-failing cases, plus a hardware-gated proof that the non-DXGI path yields the same qualification decision as the DXGI path on real hardware. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4 * fix(local-ai): combine GPU memory bounds conservatively DXGI reports this process's WDDM budget while NVML reports device-wide unallocated memory. Preferring whichever source resolved first let the same GPU be called ready or busy purely by source availability. Combine instead: when both sources identify the device, take the smaller dedicated bound and the smaller free reading. The admission decision is then deterministic and conservative regardless of which sources a host exposes, and a device is never admitted on the larger of two bounds. Also free the NVML loader reference, widen the interop catch to the marshalling and SEH failures the previous implementation handled, keep library cleanup reachable when shutdown throws, narrow the NVML remarks to what the recorded Windows evidence supports, and note that MIG compute instances are out of scope. Adds disagreeing-bounds, case-insensitive multi-device identity join, and exact allowed-path regressions, and makes the hardware tests fail loudly instead of passing silently when integration is enabled without a GPU. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4 * test(local-ai): skip GPU proofs on hosts without an NVIDIA device The two hardware proofs were gated only by OPENCLAW_RUN_INTEGRATION, so hosted GPU-less CI runners ran them and failed on the explicit "requires an NVIDIA GPU" assertions. Gate them on the device instead. NvidiaHardwareFactAttribute skips when no NVIDIA GPU is detected, so ordinary CI stays green, while an explicit hardware proof run with OPENCLAW_RUN_GPU_PROOF=1 still requires the device and fails loudly if it is missing. No production logic changes. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4 --------- Co-authored-by: Pedro Larroy <[email protected]> Co-authored-by: Scott Hanselman <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: a82f3722-db31-4cf3-b2b6-6350078584c4
Summary
On a DGX Spark (GB10) running Windows ARM64, Local AI is unusable and the failure is expensive:
setup runs to completion, downloads a multi-GB model, then fails at the very last step with an
opaque
HTTP 500, and rolls back everything including the gateway.Underneath are three separate issues. Only the first is a straightforward bug.
1. NVML and DXGI are joined on adapter name, and the names disagree
NvmlHostHardwareProbeattaches DXGI shared memory to an NVML device by matching adapter name:On this hardware the two APIs report different names for the same adapter, so the match fails
silently:
This part is a genuine defect: a silent no-match is indistinguishable from an adapter that has no
shared memory, and nothing is logged.
2. Why the obvious fix is wrong
The commit here joins on PCI identity instead (
nvmlDeviceGetPciInfo_v3against theVendorId/DeviceId/SubSystemIdthatDXGI_ADAPTER_DESC1already reads and discards). It works: theadapter then reports 46.01 GiB instead of 15.94 GiB, and every catalog model becomes
Eligible.That is the wrong outcome. Measured with the patched build:
llama-serverreports the same optimistic figure and then cannot honour it.Qwen3.5 9B, the smallest model in the catalog, allocates:
It dies at 15.81 GiB, against NVML's dedicated figure of 15.94 GiB (16320 MiB). Qwen3.6 35B
fails the same way earlier, on a single 21087.70 MiB model-buffer request.
So CUDA advertises 46.3 GiB but can only allocate about 15.9 GiB of device memory here. The shared
portion is host memory that DXGI reports and CUDA surfaces, but it does not back device allocations
under WDDM. NVML's dedicated figure is the one that predicts real behaviour, and the current
name-join failure accidentally produces the correct answer on this machine.
Fixing the join without changing capacity semantics would make eligibility worse: models are
selected that cannot load, and the user finds out only after a multi-GB download.
Worth noting the platform context: the unified memory that makes Spark good at local inference is
addressable under DGX OS / Linux, not through WDDM. With about 15.9 GiB usable, no model in the
catalog fits (the smallest requires 21.47 GiB).
3. A capability failure destroys the whole setup
verify-local-ai-inferenceis terminal, so its failure rolls back all completed steps:Local AI is one capability, but its verification failure takes down the WSL gateway too, and
discards a 12 GB download. The failure screen then offers only Close: no retry, and no way back
to the model dropdown one step earlier, even though choosing a smaller model is the obvious next
move. Repeating the attempt means re-downloading.
Suggested direction
not count toward CUDA-allocatable capacity on WDDM. If it is surfaced at all it should be
separate from the number eligibility is judged against.
That single line would have made this diagnosable in minutes.
gigabytes.
from the failure screen, and keep verified downloads.
Environment
b10488-cuda13-arm64), ARCHS include 1210,BLACKWELL_NATIVE_FP4 = 1qwen3.6-35b-a3b-mtp-q4-k-mandqwen3.5-9b-mtp-q4-k-mNote: reaching the failure at all required lowering
MinimumNvidiaDriverVersionfrom 615.0 to 580.0locally, since this host has driver 592.96 and no 615+ Windows ARM64 driver appears to be published
for this SKU. That local change is not part of this branch. Related: #1235.