Repository navigation
Conversation
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
…city DXGI-reported shared memory is a WDDM host-RAM budget the GPU may borrow for graphics use; it does not back CUDA device allocations. Counting it as capacity (as GetEffectiveTotalMemoryBytes/GetEffectiveFreeMemoryBytes previously did) can make a model appear eligible when the GPU cannot actually load it, per PR openclaw#1237's second finding. Eligibility and free-memory checks now use NVML dedicated memory only. Co-Authored-By: Claude Sonnet 5 <[email protected]>
… failure SetupPipeline previously rolled back every completed step whenever any step failed with RollbackOnFailure enabled. A failed Local AI GPU/inference verification downstream of expensive artifact acquisition would delete the just-downloaded multi-gigabyte model and llama-server runtime, per PR openclaw#1237's third finding. Adds SetupStep.RollsBackPrecedingStepsOnFailure (default true, preserving existing behavior everywhere else) and opts VerifyLocalAiGpuLoadStep and VerifyLocalAiInferenceStep out of it — both are read-only verification steps whose failure shouldn't force re-acquisition of artifacts that are otherwise reused via each acquisition step's own CreatedThisRun-gated skip logic. The failed step itself is still rolled back regardless. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 27, 2026, 3:27 AM ET / 07:27 UTC. ClawSweeper reviewWhat this changesThe PR makes Local AI model qualification use dedicated NVML memory only and preserves completed setup work when Local AI verification fails. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof is added - 5 items remain Keep this PR open. Current main still has both reported behaviors, but the PCI join added here has no production consumer once shared memory is excluded from qualification, and external real-behavior proof is not yet posted. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherLocal AI setup probes GPU memory to decide whether a pinned local model fits, acquires the runtime and model, then verifies inference and GPU placement. The PR changes the eligibility decision and the rollback behavior after either verification failure. flowchart LR
A[Windows GPU probes] --> B[Local AI eligibility]
B --> C[Runtime and model acquisition]
C --> D[Inference and GPU verification]
D --> E[Rollback policy]
E --> F[Reusable Local AI install]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the dedicated-only qualification and scoped verification rollback changes, remove the unused PCI association until it serves a separate diagnostic surface, then add redacted current-head runtime proof for the changed setup recovery. Do we have a high-confidence way to reproduce the issue? Yes, from source. Current main explicitly aggregates shared memory for eligibility and unconditionally rolls back completed steps after failure; the PR's reported DGX result itself has not been independently executed here. Is this the best way to solve the issue? No. The dedicated-only and rollback portions are narrowly targeted, but the PCI join should be removed or given a real diagnostic consumer because its shared-memory result is no longer consumed by production code. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 911f36860b2d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
This breaks UMA architectures. Lets not merge. The correct fix is likely to use Cuda API to query available Cuda memory (which will include the shared 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.
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.
Adversarial review consensusRecommendation: request changes. PR #1239 can leave its managed Both models agree: HIGH consensus
Only one model flagged: LOW consensus
The NVML dedicated-memory eligibility change, DXGI shared-memory exclusion, PCI packing/subsystem matching, ambiguity handling, native struct layout, and fallback behavior were validated as correct and fail-closed. No concrete security vulnerability was found. |
|
Closing the current implementation. Its dedicated-memory direction is superseded and rollback can leave llama-server running; retain those requirements for a safer replacement. |
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
Builds on #1237's NVML/DXGI PCI-identity join fix and addresses the two remaining issues that PR's description flagged but deliberately left unfixed:
Shared memory wrongly counted as CUDA-allocatable capacity.
LocalInferenceQualificationPolicy.GetEffectiveTotalMemoryBytes/GetEffectiveFreeMemoryBytesused to add DXGI-reported shared memory directly into NVML dedicated memory. DXGI shared memory is a WDDM host-RAM budget the GPU may borrow for graphics use — it does not back CUDA device allocations. Counting it as capacity can make a model appear eligible when the GPU cannot actually load it. Eligibility/free-memory checks now use NVML dedicated memory only.Capability-verification failure destroyed unrelated completed work.
SetupPipelinerolled back every previously-completed step whenever any step failed with rollback enabled. A failed Local AI GPU/inference verification — which runs downstream of expensive model/runtime acquisition — would delete the just-downloaded multi-gigabyte GGUF and llama-server runtime. AddsSetupStep.RollsBackPrecedingStepsOnFailure(defaulttrue, preserving existing behavior everywhere else) and optsVerifyLocalAiGpuLoadStep/VerifyLocalAiInferenceStepout of it, since both are read-only verification steps whose failure shouldn't force re-acquisition of artifacts that are otherwise safely reused via each acquisition step's ownCreatedThisRun-gated skip logic. The failed step itself is still rolled back regardless.Testing
OpenClaw.Shared.Tests(3821 passed) andOpenClaw.SetupEngine.Tests(1002 passed, including the pipeline step-count/ordering lock-down test) — no regressions.LocalInferenceEligibility.Evaluatenow reports dedicated-only capacity (47.94 GiB, down from the previous 59.38 GiB that wrongly included shared memory), and all catalog models remainEligible.🤖 Generated with Claude Code