mirror of
https://github.com/forkless/XPUSYS-Monitor-NG.git
synced 2026-08-16 08:46:38 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2730c09247 | ||
|
|
a949c77e5f | ||
|
|
d98dbb36b3 | ||
|
|
9f7cced92b | ||
|
|
a2039637fb | ||
|
|
809d7764e2 |
@@ -1,21 +0,0 @@
|
|||||||
# Project Context (Auto-generated)
|
|
||||||
|
|
||||||
> This file was automatically generated by CodeWhale.
|
|
||||||
> You can edit or delete it at any time.
|
|
||||||
|
|
||||||
## Bounded Project Overview
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"project_name": "xpusys",
|
|
||||||
"directory_structure": [],
|
|
||||||
"readme": null,
|
|
||||||
"config_files": [],
|
|
||||||
"key_source_files": [],
|
|
||||||
"counts": {
|
|
||||||
"config_files": 0,
|
|
||||||
"directory_entries": 0,
|
|
||||||
"key_source_files": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
"schema_version": 1,
|
|
||||||
"agents": [
|
|
||||||
{
|
|
||||||
"id": "agent_81924c2d",
|
|
||||||
"session_name": "clone-fork",
|
|
||||||
"fork_context": false,
|
|
||||||
"workspace": "/home/pe1085/development/xpusys",
|
|
||||||
"agent_type": "implementer",
|
|
||||||
"prompt": "Clone the repository https://github.com/forkless/ComfyUI-XPUSYS-Monitor-AMD into the current directory /home/pe1085/development/xpusys. Use `git clone https://github.com/forkless/ComfyUI-XPUSYS-Monitor-AMD .` to clone into the existing directory.",
|
|
||||||
"assignment": {
|
|
||||||
"objective": "Clone the repository https://github.com/forkless/ComfyUI-XPUSYS-Monitor-AMD into the current directory /home/pe1085/development/xpusys. Use `git clone https://github.com/forkless/ComfyUI-XPUSYS-Monitor-AMD .` to clone into the existing directory.",
|
|
||||||
"role": "implementer"
|
|
||||||
},
|
|
||||||
"model": "deepseek-v4-flash",
|
|
||||||
"nickname": "Beaked",
|
|
||||||
"status": {
|
|
||||||
"Failed": "Sub-agent requested unavailable tools: exec_shell\n(child model `deepseek-v4-flash` may be unavailable under the current access profile — retry agent_open with a different `model`, or remove `model` to inherit the parent's)"
|
|
||||||
},
|
|
||||||
"result": null,
|
|
||||||
"steps_taken": 0,
|
|
||||||
"duration_ms": 17,
|
|
||||||
"allowed_tools": [
|
|
||||||
"exec_shell"
|
|
||||||
],
|
|
||||||
"updated_at_ms": 1780951716988,
|
|
||||||
"session_boot_id": "boot_3aa40f1d-b3c"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -4,3 +4,7 @@ __pycache__/
|
|||||||
*.egg-info/
|
*.egg-info/
|
||||||
dist/
|
dist/
|
||||||
build/
|
build/
|
||||||
|
|
||||||
|
# Internal tooling state — not part of the project
|
||||||
|
.codewhale/
|
||||||
|
.deepseek/
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
# Integration Guide for upstream maintainer
|
||||||
|
|
||||||
|
This document is intended for **allanmeng**, maintainer of
|
||||||
|
[ComfyUI-XPUSYS-Monitor](https://github.com/allanmeng/ComfyUI-XPUSYS-Monitor).
|
||||||
|
|
||||||
|
The changes below are scoped to making `AMDProvider` work on Windows without
|
||||||
|
`rocm_smi_lib`. Nothing outside `providers/amd.py` and `providers/__init__.py`
|
||||||
|
needs to change in your codebase. The `_utils.py` and `_TypeperfGpuQuery` are
|
||||||
|
new standalone files you can take or leave.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Detection fix — `providers/__init__.py`
|
||||||
|
|
||||||
|
**Location:** `_is_amd_rocme()` function
|
||||||
|
|
||||||
|
**Problem:** `torch.version.roc` does not exist as an attribute on some
|
||||||
|
Windows ROCm builds (tested with PyTorch 2.9.1+rocm7.2.1). Bare attribute
|
||||||
|
access raises `AttributeError`, caught by the outer `except`, and the
|
||||||
|
detector falls through to `NvidiaProvider`.
|
||||||
|
|
||||||
|
**Fix (3 lines changed):** Replace `torch.version.roc` with
|
||||||
|
`getattr(torch.version, 'roc', None)`. Add `getattr(torch.version, 'hip',
|
||||||
|
None)` as a secondary signal. GPU name fallback (`"amd"`, `"radeon"`,
|
||||||
|
`"advanced micro devices"`) for builds where neither `roc` nor `hip`
|
||||||
|
attribute exists.
|
||||||
|
|
||||||
|
```
|
||||||
|
if getattr(torch.version, 'roc', None) is not None:
|
||||||
|
return True
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. VRAM — `providers/amd.py` → `_read_vram()`
|
||||||
|
|
||||||
|
**Replaces:** `rocm_smi.getMemFreeVdev(0)`, `.getMemSizeVdev(0)`,
|
||||||
|
`.getMemUsedVdev(0)`
|
||||||
|
|
||||||
|
**Substitute:** `torch.cuda.mem_get_info(device_index)` returns `(free_bytes,
|
||||||
|
total_bytes)`. This is the same function used by NVIDIA CUDA — ROCm's HIP
|
||||||
|
runtime implements the same API surface. Works on ROCm 6+ for Windows.
|
||||||
|
|
||||||
|
```python
|
||||||
|
free_bytes, total_bytes = torch.cuda.mem_get_info(0)
|
||||||
|
free_gb = free_bytes / (1024**3)
|
||||||
|
total_gb = total_bytes / (1024**3)
|
||||||
|
used_gb = max(0.0, total_gb - free_gb)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Caveat:** Call `torch.cuda.synchronize(0)` before `mem_get_info()` on
|
||||||
|
initialisation — some ROCm builds defer HIP context creation until the first
|
||||||
|
GPU operation and `mem_get_info` returns `(0, 0)` without an active context.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. GPU load — `providers/amd.py` → `_read_gpu_load()`
|
||||||
|
|
||||||
|
**Replaces:** `rocm_smi.getGpuBusyVdev(0)`
|
||||||
|
|
||||||
|
**No direct torch equivalent.** Two options:
|
||||||
|
|
||||||
|
### Option A (recommended): `typeperf` (Windows built-in)
|
||||||
|
|
||||||
|
Add the `_TypeperfGpuQuery` class from `providers/_utils.py` in our repo.
|
||||||
|
It calls:
|
||||||
|
|
||||||
|
```
|
||||||
|
typeperf "\GPU Engine(*)\Utilization Percentage" -sc 1
|
||||||
|
```
|
||||||
|
|
||||||
|
Parses the CSV output (one column per engine instance), takes `max()` across
|
||||||
|
all engines. Available on every Windows system since Vista — zero
|
||||||
|
dependencies. The `_utils.py` module is self-contained.
|
||||||
|
|
||||||
|
### Option B: `amdsmi` (official AMD SMI library)
|
||||||
|
|
||||||
|
`pip install amdsmi`. Talks directly to the AMD driver (not through WDDM).
|
||||||
|
Currently Linux-only — the PyPI wrapper searches for `libamd_smi.so`. If AMD
|
||||||
|
releases a Windows wheel in the future, this will work without code changes.
|
||||||
|
The `_AmdSmiGpuQuery` class is in `providers/_utils.py`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. GPU frequency / temperature / power — `providers/amd.py`
|
||||||
|
|
||||||
|
**Replaces:** `rocm_smi.getSingleClockSpeed(0)`, `.getTempVdev(0)`,
|
||||||
|
`.getPowerVdev(0)`, `.getPowerCapVdev(0)`
|
||||||
|
|
||||||
|
**No substitute available.** The AMD Windows WDDM driver on tested hardware
|
||||||
|
(RX 9070 XT, ROCm 7.2) does not expose these through any Python-accessible
|
||||||
|
API. Return sentinel values matching the `GPUSnapshot` contract defaults:
|
||||||
|
|
||||||
|
| Metric | Sentinel | Effect |
|
||||||
|
|---|---|---|
|
||||||
|
| Core clock | `0.0` | Capsule shows `0MHz` |
|
||||||
|
| Temperature | `-1.0` | Frontend greys out display |
|
||||||
|
| Power draw | `(-1.0, 0.0, False)` | `power_available=False` greys out PWR capsule |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Shared utility functions — `providers/_utils.py` (optional)
|
||||||
|
|
||||||
|
The CPU/RAM utility functions (`_get_cpu_info`, `_read_cpu_ram_stats`,
|
||||||
|
`_read_commit_charge`, `_is_admin`) were extracted from `providers/intel.py`
|
||||||
|
into a shared module. If you prefer to keep them in `intel.py`, just update
|
||||||
|
the import in `amd.py` (and `nvidia.py`) accordingly:
|
||||||
|
|
||||||
|
```python
|
||||||
|
# For _utils.py:
|
||||||
|
from ._utils import _get_cpu_info, _read_cpu_ram_stats, ...
|
||||||
|
|
||||||
|
# For intel.py (original):
|
||||||
|
from .intel import _get_cpu_info, _read_cpu_ram_stats, ...
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Files to touch (minimal set)
|
||||||
|
|
||||||
|
| File | Action |
|
||||||
|
|---|---|
|
||||||
|
| `providers/__init__.py` | Fix `_is_amd_rocme()` — 3 lines |
|
||||||
|
| `providers/amd.py` | Replace `_read_vram`, `_read_gpu_load`, freq/temp/power sentinels, add `_TypeperfGpuQuery` import |
|
||||||
|
| `providers/_utils.py` | **New file** — contains `_TypeperfGpuQuery` and optionally shared CPU/RAM utils |
|
||||||
|
|
||||||
|
Everything else (`base.py`, `nvidia.py`, `xpu_server.py`, `web/`, `__init__.py`)
|
||||||
|
is unchanged functionally from the upstream baseline.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Personal note
|
||||||
|
|
||||||
|
Seeing your plugin light up on my AMD machine for the first time —
|
||||||
|
capsules popping in, VRAM reporting live — genuinely made me smile. I
|
||||||
|
hope this small adaptation puts a similar grin on your face. Thank you
|
||||||
|
for building the original — it's a great piece of work.
|
||||||
|
|
||||||
|
— @forkless
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2026 forkless
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
> **Proof of Concept** — Native Windows ROCm support for ComfyUI-XPUSYS-Monitor
|
> **Proof of Concept** — Native Windows ROCm support for ComfyUI-XPUSYS-Monitor
|
||||||
|
|
||||||
This is a fork of [ComfyUI-XPUSYS-Monitor](https://github.com/allanmeng/ComfyUI-XPUSYS-Monitor)
|
This is a derived work based on [ComfyUI-XPUSYS-Monitor](https://github.com/allanmeng/ComfyUI-XPUSYS-Monitor)
|
||||||
by allanmeng, created as a proof of concept to add **native Windows AMD ROCm
|
by allanmeng. It is published separately solely because the changes
|
||||||
support** without requiring `rocm_smi_lib` (a Linux-only Python package).
|
are narrowly scoped to Windows AMD ROCm and were developed with AI
|
||||||
|
agent assistance — the author does not wish to push Agent generated
|
||||||
|
changes into the original repository out of respect for the developer.
|
||||||
|
|
||||||
## Intent
|
## Intent
|
||||||
|
|
||||||
@@ -82,24 +84,4 @@ welcome, but responses should not be expected.
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT License
|
[MIT](LICENSE.md) — Copyright (c) 2026 forkless
|
||||||
|
|
||||||
Copyright (c) 2026 forkless
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user