mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4789] [Engine] count the expert bytes Strata moves over PCIe on gfx1100 #5180
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5180
Loading…
Add table
Add a link
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4789
Author: @str0g
Created: 10/31/2026
Status: 🔄 Open
Base:
main← Head:f-029-pcie-link📝 Commits (1)
78362eb[Engine] count the expert bytes Strata moves over PCIe on gfx1100📊 Changes
31 files changed (+514 additions, -32 deletions)
View changed files
📝
CMakeLists.txt(+6 -0)📝
apps/host/server/monitor-dashboard.mjs(+7 -3)📝
apps/host/src/lib/native-monitor.ts(+6 -3)📝
apps/host/src/lib/types.ts(+3 -0)📝
apps/host/src/locales/de.json(+2 -1)📝
apps/host/src/locales/en.json(+2 -1)📝
apps/host/src/locales/es.json(+2 -1)📝
apps/host/src/locales/fr.json(+2 -1)📝
apps/host/src/locales/ja.json(+2 -1)📝
apps/host/src/locales/ko.json(+2 -1)📝
apps/host/src/locales/pt.json(+2 -1)📝
apps/host/src/locales/ru.json(+2 -1)📝
apps/host/src/locales/zh.json(+2 -1)📝
apps/host/src/screens/Monitor.tsx(+1 -1)📝
apps/host/tests/monitor-dashboard.test.mjs(+17 -0)📝
apps/host/tests/native-monitor-projection.test.mjs(+11 -0)📝
docs/AMD_HIP.md(+21 -1)📝
docs/TERMINAL_LAUNCH.md(+8 -0)📝
include/strata/core/expert_source.hpp(+3 -0)➕
include/strata/core/link_meter.hpp(+37 -0)...and 11 more files
📄 Description
…1100 (prompt staging and decode reads, said once a second)
The Monitor had no PCIe traffic figure for an AMD card on Linux: the amdgpu driver gives the card's load, VRAM, temperature, power and the link's generation and width, but counts no bytes over it. On our RX 7900 GRE (gfx1100, Arch, kernel 7.2.11-arch1-1, rocm-smi-lib 7.2.0-2) the driver's gpu_metrics table is 120 bytes and rocm-smi --showmetrics answers pcie_bandwidth_acc and pcie_bandwidth_inst with N/A. The engine is the thing doing the copying, so it counts what it puts on the link and the Monitor graphs that, labelled "staged to GPU" rather than "to GPU". An NVIDIA card keeps its own NVML figure: the engine's count is used only where there is no counter.
What it counts: the expert blobs the prompt copied host -> device (PrefillStats::experts_streamed_bytes, summed over the stages by chain_experts_streamed_bytes) and the blobs the decode read back over the link (ExpertDrive::pcie_bytes, one layer blob per PCIe fetch). About once a second while a request runs the engine says both running totals ("PCIE ", STRATA_LINK_STATS=1, which the server asks for) - after each run of the prompt read and after each decoded token - so the graph follows a long prompt instead of waiting for the request's DONE line, which now appends pcie_bytes= and staged_bytes=. The server adds them into hardware.pcie_engine_mb, pcie_engine_total_mb and the history, and the web Monitor, the Terminal Overview tile and the app show that figure. A DONE line without the keys leaves the figure missing rather than guessing 0.
The count is turned on for a HIP build running gfx1100 only - the RX 7900 XTX / XT / GRE and the W7900 / W7800, the card it was measured on - and nowhere else: a CUDA / SYCL build, a HIP build on another gfx, and an engine older than this print exactly what the last release printed. It is off for the integrated Radeons because their blobs never cross a link. STRATA_LINK_CHIPS=all turns it on for any AMD card, with that caveat in the docs; STRATA_LINK_STATS=0 turns the once-a-second line off. The rule itself is a string test in include/strata/core/link_meter.hpp, so it can be checked without a GPU.
Checked: ninja -C build-hip strata (gfx1100) built and installed, and a probe on this box's card reads gcnArchName=gfx1100, so the meter is on there; serve/test_server.py 365 passed, two of them new (the prompt staging counted into the run total, and a long prompt moving the rate although the decode has not started); tests/core/link_meter_test.cpp (new, registered in CMake) passed; apps/host tests/monitor-dashboard.test.mjs 22 passed; tests/terminal/test_overview.py's PCIe case passed. Not run: apps/host tests/native-monitor-projection.test.mjs (it needs esbuild, and this checkout has no node_modules) and the rest of the Terminal tests (the suite stops at a monitor case that opens a socket, which this sandbox blocks). Not built: CUDA and SYCL - the engine changes sit inside #if defined(STRATA_USE_HIP) and the two new files use no device API, but they were not compiled here.
Measured on the same RX 7900 GRE with the IQ3_S pack, answer only: 1.2-2.8 GB/s of expert reads while answering at 44-102 tok/s (the engine's own count, /metrics). The prompt's share of the figure is new in this build and is not measured yet. The streamed K/V and other programs' traffic are not in the number, and a prompt run longer than a second reports once at its end.
The title must start with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], for example "[Engine] fix decode stop on long prompts" or "[GUI] keep the model list after a tab switch".
Problem and result
No pcie traffic was reported on linux + 7900xtx.
Validation
Run validating prompt after implementation.
Passed:
PCIe traffic is being reported
Failed:
Initial model loading is not being reported as traffic.
Not run:
CUDA, SYCL, Metal. <- I don't have hardware.
Limits
Initial model loading is not being reported as traffic.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.