Archived
Merge branch 'pr2-engine' into pr3-models
This commit is contained in:
commit
d49a2ccb9c
4 files changed
+19
-7
No files matched your search
@@ -125,7 +125,7 @@ int kvstream_configure(const Config& cfg, int64_t ctx, const std::vector<KVGroup
|
|||||||
* above, because this model does stream. */
|
* above, because this model does stream. */
|
||||||
const int64_t asked_blocks = (out->asked_tokens + bs - 1) / bs;
|
const int64_t asked_blocks = (out->asked_tokens + bs - 1) / bs;
|
||||||
const int64_t step = kvstream_ceiling_blocks(cfg, ops.sel_pitch);
|
const int64_t step = kvstream_ceiling_blocks(cfg, ops.sel_pitch);
|
||||||
if (step > asked_blocks && step <= ring.raised_blocks) {
|
if (ring.by_union && step > asked_blocks) {
|
||||||
RAD_WARN("--kv-resident %lld raised to %lld tokens: a decode step can name %lld blocks "
|
RAD_WARN("--kv-resident %lld raised to %lld tokens: a decode step can name %lld blocks "
|
||||||
"of %lld blocks each (--max-num-seqs %lld x %lld for speculation x %lld), and "
|
"of %lld blocks each (--max-num-seqs %lld x %lld for speculation x %lld), and "
|
||||||
"the ring must hold them all; the ring takes the raised depth and startup "
|
"the ring must hold them all; the ring takes the raised depth and startup "
|
||||||
@@ -148,6 +148,7 @@ int kvstream_configure(const Config& cfg, int64_t ctx, const std::vector<KVGroup
|
|||||||
out->ring_blocks = ring.ring_blocks;
|
out->ring_blocks = ring.ring_blocks;
|
||||||
out->ring_tokens = ring.ring_blocks * bs;
|
out->ring_tokens = ring.ring_blocks * bs;
|
||||||
out->raised_tokens = ring.raised_blocks > 0 ? ring.ring_blocks * bs : 0;
|
out->raised_tokens = ring.raised_blocks > 0 ? ring.ring_blocks * bs : 0;
|
||||||
|
out->raised_by_union = ring.raised_blocks > 0 && ring.by_union;
|
||||||
out->group = ring.streams() ? g : -1;
|
out->group = ring.streams() ? g : -1;
|
||||||
/* Prefill runs on the stage and never resolves: above `qsa_exact_to` one launch's selection is
|
/* Prefill runs on the stage and never resolves: above `qsa_exact_to` one launch's selection is
|
||||||
* a chunk's union, which no serving ring could hold, so the pass gets the group's context one
|
* a chunk's union, which no serving ring could hold, so the pass gets the group's context one
|
||||||
@@ -200,11 +201,14 @@ void kvstream_report(const KVStreamSetup& s, const KVStreamHostUse& host, int n_
|
|||||||
const int64_t flag = s.raised_tokens > 0 ? s.raised_tokens : s.asked_tokens;
|
const int64_t flag = s.raised_tokens > 0 ? s.raised_tokens : s.asked_tokens;
|
||||||
if (s.raised_tokens > 0 && s.block_size > 0)
|
if (s.raised_tokens > 0 && s.block_size > 0)
|
||||||
RAD_INFO("kv streaming: the ring is the raised one, not the flag's: --kv-resident %lld "
|
RAD_INFO("kv streaming: the ring is the raised one, not the flag's: --kv-resident %lld "
|
||||||
"became %lld tokens (%lld -> %lld blocks of %lld tokens each), the fewest blocks "
|
"became %lld tokens (%lld -> %lld blocks of %lld tokens each), %s; what was "
|
||||||
"one decode step's selection fits in; what was carved below is that ring",
|
"carved below is that ring",
|
||||||
(long long)s.asked_tokens, (long long)s.raised_tokens,
|
(long long)s.asked_tokens, (long long)s.raised_tokens,
|
||||||
(long long)((s.asked_tokens + s.block_size - 1) / s.block_size),
|
(long long)((s.asked_tokens + s.block_size - 1) / s.block_size),
|
||||||
(long long)(s.raised_tokens / s.block_size), (long long)s.block_size);
|
(long long)(s.raised_tokens / s.block_size), (long long)s.block_size,
|
||||||
|
s.raised_by_union ? "the fewest blocks one decode step's selection fits in"
|
||||||
|
: "the shipped floor, under which the misses cost more than "
|
||||||
|
"the VRAM the ring gives back");
|
||||||
if (host.sum.groups > 0)
|
if (host.sum.groups > 0)
|
||||||
RAD_INFO("kv streaming: %lld group(s) stream (%s): kv_store_streamed writes the host "
|
RAD_INFO("kv streaming: %lld group(s) stream (%s): kv_store_streamed writes the host "
|
||||||
"mirror and the resident ring slots, kv_resolve rewrites each selection as ring "
|
"mirror and the resident ring slots, kv_resolve rewrites each selection as ring "
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ struct KVStreamSetup {
|
|||||||
int32_t group = -1; /* the group that streams; -1 when nothing does */
|
int32_t group = -1; /* the group that streams; -1 when nothing does */
|
||||||
std::string group_name; /* the group that would have: named by the report */
|
std::string group_name; /* the group that would have: named by the report */
|
||||||
int64_t asked_tokens = 0; /* --kv-resident as given; 0 is no streaming at all */
|
int64_t asked_tokens = 0; /* --kv-resident as given; 0 is no streaming at all */
|
||||||
int64_t raised_tokens = 0; /* what the flag became when the ring's ceiling raised
|
int64_t raised_tokens = 0; /* what the flag became when a floor raised it; 0 when it
|
||||||
* it; 0 when it was not raised */
|
* was not raised */
|
||||||
|
bool raised_by_union = false; /* the raise was the decode-step union, not the shipped
|
||||||
|
* floor (kStreamFloorTokens): the report's wording */
|
||||||
int64_t context_tokens = 0; /* --max-model-len x --max-num-seqs */
|
int64_t context_tokens = 0; /* --max-model-len x --max-num-seqs */
|
||||||
int64_t ring_tokens = 0; /* the ring that is carved, in tokens: the raised flag,
|
int64_t ring_tokens = 0; /* the ring that is carved, in tokens: the raised flag,
|
||||||
* rounded to whole blocks */
|
* rounded to whole blocks */
|
||||||
|
|||||||
@@ -189,6 +189,8 @@ void kvstream_ring(const Config& cfg, int64_t ctx, int64_t block_size, int64_t s
|
|||||||
if (out->ring_blocks < ceiling) {
|
if (out->ring_blocks < ceiling) {
|
||||||
out->ring_blocks = ceiling < out->ctx_blocks ? ceiling : out->ctx_blocks;
|
out->ring_blocks = ceiling < out->ctx_blocks ? ceiling : out->ctx_blocks;
|
||||||
out->raised_blocks = out->ring_blocks;
|
out->raised_blocks = out->ring_blocks;
|
||||||
|
/* The union above the floor, or above the flag: either way it is the union that bound. */
|
||||||
|
out->by_union = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,11 @@ struct KVStreamRing {
|
|||||||
* already asked for that much: the ring is not the operator's
|
* already asked for that much: the ring is not the operator's
|
||||||
* number when this is set */
|
* number when this is set */
|
||||||
int64_t floor_blocks = 0; /* the shipped floor (kStreamFloorTokens) in blocks, or 0 when the
|
int64_t floor_blocks = 0; /* the shipped floor (kStreamFloorTokens) in blocks, or 0 when the
|
||||||
* context is smaller than it: which of the two bound the raise */
|
* context is smaller than it */
|
||||||
|
/* Which floor bound the raise: true when it was the decode-step union rather than the shipped
|
||||||
|
* floor. Both are applied in kvstream_ring_shape/kvstream_ring; this only tells the two
|
||||||
|
* startup lines which sentence to print. */
|
||||||
|
bool by_union = false;
|
||||||
int64_t ctx_blocks = 0; /* max_seqs x ceil(ctx / block_size): the group's whole context */
|
int64_t ctx_blocks = 0; /* max_seqs x ceil(ctx / block_size): the group's whole context */
|
||||||
/* A ring that covers the context is not a streamed group. The pool then holds every block
|
/* A ring that covers the context is not a streamed group. The pool then holds every block
|
||||||
* with its own id, so the group keeps the base engine's path exactly: no mirror, no residency
|
* with its own id, so the group keeps the base engine's path exactly: no mirror, no residency
|
||||||
|
|||||||
Reference in new issue
Block a user