VRAM Diagnostics: DSH VRAM Diagnostic Sampler

Introduction

When a DSH (DeepSeek Harness) agent invokes GPU workloads, out-of-memory (OOM) crashes or unexplained performance degradation can be notoriously hard to trace. Most VRAM plugins on the market just draw real-time gauges. The problem is: the moment OOM hits and memory is freed, the dashboard only shows “all clear now.” This plugin runs a lightweight always-on sampler by default, keeping the last hour of data in memory. When you go back and ask the agent “why did it just blow up,” it reads the buffer and gives you four-part conclusions.

What It Is

This is xinming-chenniang/dsh-vram-watch, a DSH plugin categorized under admin-security. It’s not yet another VRAM dashboard — it’s the one that delivers conclusions after a VRAM overflow. By lightly sampling GPU and system performance counters, it outputs a four-part verdict after an OOM or an unexplained slowdown: who ate the VRAM, whether it spilled into system memory, whether there’s a leak, and whether memory was released after the job finished.

Core Features

  • Always-on lightweight sampling: Starts automatically by default. GPU metrics are sampled every 2 seconds; shared VRAM and the process table are sampled every 20 seconds. If the system is idle for more than 2 minutes, the interval automatically drops to 10 seconds.
  • Four-part conclusion: Provides first → last → peak for each process, shared VRAM delta, whether the process is still running, and whether dedicated VRAM returned to baseline after the task exited.
  • Report output: The vram_report tool generates a structured report. The csv parameter allows direct analysis of historical CSV files, and write_csv persists the window to disk.
  • Diagnostic rules: Built-in threshold checks, e.g., peak > 95% of total VRAM, shared VRAM increased > 300 MiB over baseline, end value > 300 MiB above baseline, etc.

Installation & Activation

Install with the following command:

dsh plugin --profile desktop add @xinming-chenniang/dsh-vram-watch

Or search for “VRAM Diagnostics” in the desktop client under Settings → Plugins. After installation, restart DSH — the sampler starts automatically.

Typical Usage

Just talk to the agent in plain language:

  • “I just ran SD and got a CUDA out of memory error — check why.”
  • “VRAM keeps climbing — is it leaking?”
  • “Rendering didn’t crash but was really slow — did it spill into system memory?”

The agent will call vram_report (default: last 30-minute window) and read the conclusions. Two tools are available:

Tool Purpose
vram_report Generates a diagnostic report; the csv parameter analyzes historical CSVs directly, write_csv persists the window to disk
vram_watch status / start / stop the sampler (already running by default)

Report example:

==== VRAM Diagnostic Report ====
Source  : In-memory buffer (last 30 minutes)
Samples : 892 / 1,784 s (15:20:10 - 15:49:54)
VRAM    : Baseline 1,503 MiB → Peak 8,002 MiB (98%) @ 15:21:14 → Final 2,674 MiB
Shared  : Baseline 162 MiB → Peak 2,140 MiB (+1,978 MiB)
GPU     : Peak 100% · Avg 29%
Temp    : Peak 72°C
Power   : Peak 190 W

Process VRAM (first → last, peak):
  python                   141 → 1,835 MiB (+1,694, peak 7,771)  still running
  chrome                    85 → 153 MiB (+68, peak 328)  still running
  ...

Verdict:
  - VRAM peak 8,002 MiB — 98% utilization, nearly maxed out
  - Shared VRAM grew by 1,978 MiB over baseline: WDDM has been spilling to system memory; expect stutters/OOM afterward
  - Largest grower is python (+1,694 MiB, still running): if the trend is monotonically increasing, suspect a VRAM leak

Data Sources

  • Dedicated / shared VRAM come from WDDM performance counters (same source as Task Manager); GPU utilization / temperature / power / total used come from nvidia-smi.
  • Sampling cadence: GPU metrics every 2 seconds (auto-drops to 10 s after 2 min idle); shared VRAM and full process table every 20 seconds.
  • The process table merges PDH data (covers Chrome, desktop, and other graphical processes) with compute processes from nvidia-smi (Python, training processes). For same-named entries, the larger value is used.
  • CSV column format is fully compatible with the vram-watch skill: the skill’s vram-report.ps1 / vram-chart.ps1 can read CSVs written by this plugin directly.

Configuration

The defaults work out of the box; to customize, override in your profile’s cordis.patch.yml:

- id: dsh-vram-watch
  name: '@xinming-chenniang/dsh-vram-watch'
  config:
    autoStart: false     # Don't keep running; let the agent call vram_watch start when needed
    intervalSec: 3
    pdhEverySec: 30
    bufferMinutes: 120
    csvDir: D:/dsh/tmp
Field Default Description
autoStart true Begin sampling on load (without this, you’ll miss the OOM scene)
intervalSec 2 nvidia-smi sampling interval (seconds)
pdhEverySec 20 Shared VRAM / full process table sampling interval (seconds)
bufferMinutes 60 In-memory buffer retention duration (minutes)
csvDir %TEMP%\dsh-vram-watch CSV output directory
powershell auto Specify PowerShell path (defaults to Windows PowerShell 5.1)

Use Cases & Notes

Suitable for scenarios requiring investigation of VRAM overflows, performance anomalies, or suspected memory leaks. The plugin runs with the current DSH process privileges; review the source code and license before installing.

Limitations

  • Windows + NVIDIA only. Both PDH GPU counters and nvidia-smi are Windows/NVIDIA-specific; AMD / Intel GPUs are not supported.
  • No GUI. v0.1 deliberately skips a dashboard — there are plenty of those already; the budget goes toward conclusions. For curves, use the skill’s vram-chart.ps1 to read the CSV.
  • Buffer is in-memory only. Stopping the plugin or exiting DSH loses it. To preserve evidence, call vram_report with write_csv.
  • No game injection, no hooking, no services installed. Read-only performance counters + nvidia-smi; anti-cheat friendly.
  • Overhead (estimated from per-call cost; no per-process CPU sampling): ~1 s PDH every 20 s + 2× nvidia-smi calls every 2 s (~50 ms each) ≈ 10% of one core / 1% of the whole machine (12 threads); halved after idle downshift.

Privacy

No network calls, no file access (except the single file you explicitly pass via the csv parameter), no registry writes. CSVs land in %TEMP%\dsh-vram-watch\ and are cleaned up with the system temp directory.

Compatibility

Item Tested
DSH 0.2.2-rc.3 (engines.dsh >= 0.2.2-rc.3)
OS Windows 11 26220 (WDDM counters require Win10 1809+)
PowerShell Both Windows PowerShell 5.1 and pwsh 7 verified working
Node >= 20

Uninstall

dsh plugin --profile desktop remove @xinming-chenniang/dsh-vram-watch

The sampling process is a child of the host process; it terminates with plugin uninstall / DSH exit. No background services are left behind.

Summary

This plugin turns VRAM monitoring from “watching numbers” into “getting conclusions.” After an OOM or performance anomaly, it delivers a four-part verdict via lightweight sampling: who consumed the VRAM, whether it spilled into system memory, whether there’s a leak, and whether memory was released. Ideal for DSH agent developers who need to debug local GPU resource issues.

  • Plugin directory page: https://www.skillhub.cn/plugins/xinming-chenniang/dsh-vram-watch
  • GitHub: https://github.com/xinming-chenniang/dsh-vram-watch
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye