Foresight swap space: per-layer VRAM slots refilled on their own stream with recently missed experts, served as GPU groups at the pool's existing per-layer decision (STRATA_FS_SLOTS, off by default)
This commit is contained in:
1 parent
f0880b3251
commit
14f9e4c50b
4 files changed
+317
No files matched your search
@@ -25,6 +25,7 @@
|
||||
#include "strata/core/conversation_memory.hpp"
|
||||
#include "strata/core/coupled_draft.hpp"
|
||||
#include "strata/core/expert_source.hpp"
|
||||
#include "strata/core/foresight_swap.hpp"
|
||||
#include "strata/core/pinned.hpp"
|
||||
#include "strata/core/remote_experts.hpp"
|
||||
#include "strata/core/on_device.hpp"
|
||||
@@ -7212,6 +7213,18 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
drive.d.plan = ver.plan_sink();
|
||||
// Foresight swap space (STRATA_FS_SLOTS; unset = null and nothing changes)
|
||||
std::unique_ptr<strata::core::ForesightSwap> fs_swap;
|
||||
{
|
||||
int main_dev = 0;
|
||||
cudaGetDevice(&main_dev);
|
||||
std::vector<int> devs{main_dev};
|
||||
for (auto& st : stages) devs.push_back(st->dev);
|
||||
std::vector<int> card((size_t) g.n_layers, 0);
|
||||
for (int64_t l = 0; l < g.n_layers; ++l) card[(size_t) l] = multi_gpu ? stage_of(l) : 0;
|
||||
fs_swap.reset(strata::core::foresight_swap_from_env(g.n_layers, g.n_expert, card, devs));
|
||||
drive.d.fs = fs_swap.get();
|
||||
}
|
||||
drive.d.pcie_num = std::max(0, std::min(256, (int) (o.pcie_frac * 256.0 + 0.5)));
|
||||
const bool all_experts_resident = !host_res.empty() &&
|
||||
std::all_of(host_res.begin(), host_res.end(), [](int32_t r) { return r >= 0; });
|
||||
@@ -10277,6 +10290,7 @@ int main(int argc, char** argv) {
|
||||
draft_offered += A.T - 1;
|
||||
draft_accepted += a;
|
||||
++rounds;
|
||||
if (drive.d.fs) drive.d.fs->completed.fetch_add(1, std::memory_order_release);
|
||||
++dec_windows;
|
||||
dec_T += A.T;
|
||||
bool eos = false;
|
||||
@@ -10527,6 +10541,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
std::fflush(stdout);
|
||||
++rounds;
|
||||
if (drive.d.fs) drive.d.fs->completed.fetch_add(1, std::memory_order_release);
|
||||
const Clock::time_point tw2 = Clock::now();
|
||||
// coupled drafts with penalties: the next window's row-0 history (`consumed` holds this window's
|
||||
// commit, outv[a] is its row 0) - the drafts extend it on the device as the verify rows will
|
||||
@@ -10585,6 +10600,7 @@ int main(int argc, char** argv) {
|
||||
else std::fprintf(stderr, "strata decode GPU stages, stage %d (ms/window):%s\n", st, pr.c_str());
|
||||
}
|
||||
}
|
||||
if (drive.d.fs) std::fprintf(stderr, "strata serve: %s\n", drive.d.fs->report().c_str());
|
||||
if (!cancelled) {
|
||||
// a prompt stopped halfway leaves the session somewhere between two chunks: nothing to continue from
|
||||
// (the checkpoints taken while reading it are still good)
|
||||
|
||||
Reference in new issue
Block a user