Archived
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:
1 parent
b9c685a9c3
commit
9093bf618e
9 files changed
+222
-15
No files matched your search
@@ -1392,7 +1392,9 @@ void Ctx::flush_issued() {
|
||||
for (size_t r = 0; r < unflushed_.size(); ++r) {
|
||||
const uint32_t i = unflushed_[r];
|
||||
if (i < plans_.size() && i < program_->ops.size() && plans_[i].issued)
|
||||
program_->ops[i].issued = true;
|
||||
/* /graph reads this same bool from the HTTP thread: an atomic_ref store keeps that
|
||||
* pair a relaxed exchange rather than a data race (ctx.h OpInfo::issued). */
|
||||
std::atomic_ref<bool>(program_->ops[i].issued).store(true, std::memory_order_relaxed);
|
||||
else
|
||||
unflushed_[w++] = i;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user