place+runtime: make the telemetry the HTTP thread reads atomic

/stats and LiveView read the mover's and heat engine's counters, the live tier of every
unit, and OpInfo::issued while the rank and step threads write them between passes. Plain
fields under a concurrent reader are a data race: no torn number matters on a dashboard,
but the compiler may tear, and the sanitizer is right to stop the process for it.

MoverCounters and HeatCounters mirror each struct's fields as relaxed atomics, written
exactly as the plain counters were and read whole through snapshot(); tier_ gains a
per-unit atomic byte mirror (TierMirror, copyable because HeatEngine is), and the step
path and the graph dump meet on OpInfo::issued through std::atomic_ref, which keeps the
struct layout and its copies intact. Engine-internal decisions keep reading the plain
counters -- they never race -- and only the HTTP-thread readers go through the mirrors.
This commit is contained in:
fl0l0u authored and StillDeadcode committed 2026-10-29 16:22:35 +01:00
1 parent b9c685a9c3
commit 9093bf618e
9 files changed
+222 -15

No files matched your search

+4 -3
View File
@@ -134,9 +134,10 @@ struct ServerOptions {
* a string rendered once: the dump includes `OpInfo::issued`, which a pre-first-step snapshot
* would report as false for every op, hiding dead declarations.
*
* Regenerating reads the Program on the HTTP thread while the step path writes that field. It
* is a monotonic false -> true bool, so at worst a mid-step fetch shows an op unissued one step
* early. Registry::select is called with record = false and mutates nothing else. */
* Regenerating reads the Program on the HTTP thread while the step path writes that field;
* both sides go through std::atomic_ref (Ctx::flush_issued, rad_graph.cpp), so the pairing is
* a relaxed exchange rather than a data race. Registry::select is called with record = false
* and mutates nothing else. */
std::function<std::string()> graph_json;
/* The startup report as JSON (core/diag/diag.h): options in force, the machine as it is now
* (the provider may reuse a reading for a second), and what on it costs speed. Without an API