Router look-ahead: STRATA_LOOKAHEAD_STATS scores each layer's prediction against the real routing (measurement only)
This commit is contained in:
1 parent
8b0c241ca0
commit
e247c61127
3 files changed
+106
-6
No files matched your search
@@ -5335,7 +5335,9 @@ int main(int argc, char** argv) {
|
||||
// tiers, where there are no pages to warm, and feeds its predictions to the swap space (STRATA_FS_AHEAD=0: not)
|
||||
const bool fs_ahead = srcp != nullptr && [] { const char* v = std::getenv("STRATA_FS_SLOTS"); return v != nullptr && std::atoi(v) > 0; }() &&
|
||||
[] { const char* v = std::getenv("STRATA_FS_AHEAD"); return v == nullptr || std::atoi(v) != 0; }();
|
||||
if (srcp != nullptr && ((srcp == &src && src.warms()) || fs_ahead) &&
|
||||
// STRATA_LOOKAHEAD_STATS=1 (measurement only): run the predictor on any tier and score it against the real routing
|
||||
const bool la_stats = srcp != nullptr && [] { const char* v = std::getenv("STRATA_LOOKAHEAD_STATS"); return v != nullptr && std::atoi(v) != 0; }();
|
||||
if (srcp != nullptr && ((srcp == &src && src.warms()) || fs_ahead || la_stats) &&
|
||||
[] { const char* v = std::getenv("STRATA_LOOKAHEAD"); return v == nullptr || std::atoi(v) != 0; }()) {
|
||||
std::vector<std::vector<uint16_t>> routers((size_t) g.n_layers);
|
||||
bool ok = true;
|
||||
@@ -5348,8 +5350,9 @@ int main(int argc, char** argv) {
|
||||
ok = cudaMemcpy(routers[(size_t) l].data(), w->data, (size_t) w->bytes, cudaMemcpyDeviceToHost) == cudaSuccess;
|
||||
}
|
||||
const char* kv = std::getenv("STRATA_LOOKAHEAD_K");
|
||||
if (ok && lookahead.start(std::move(routers), g.n_embd, g.n_expert, kv ? std::atoi(kv) : 10, srcp, err, fs_ahead)) {
|
||||
if (ok && lookahead.start(std::move(routers), g.n_embd, g.n_expert, kv ? std::atoi(kv) : 10, srcp, err, fs_ahead || la_stats)) {
|
||||
drive.d.lookahead = &lookahead;
|
||||
if (la_stats) lookahead.enable_stats(g.n_layers);
|
||||
if (const char* dv = std::getenv("STRATA_IO_PREFETCH_DEPTH"); dv != nullptr && std::atoi(dv) > 0)
|
||||
lookahead.set_depth(std::atoi(dv));
|
||||
else if (srcp == &src && src.io_prefetch())
|
||||
|
||||
Reference in new issue
Block a user