device and plugin boundary: kv_resolve, the streamed store rows, ABI 30

This commit is contained in:
C_Tamas committed 2026-10-24 19:19:19 +07:00
1 parent 5a9ce4912b
commit cce687bf2c
34 files changed
+3643 -29

No files matched your search

+9 -1
View File
@@ -1,6 +1,7 @@
/* kvbind.cpp -- see kvbind.h. */
#include "kvbind.h"
#include "kvstream/bind.h"
#include "mem/kv.h"
namespace rad {
@@ -12,6 +13,8 @@ void bind_kv_pools(const Program& p, const std::function<const KVGroupPlan*(int3
const KVGroupPlan* gp = plan_of((int32_t)g);
if (!gp) continue;
KVPoolBinding& b = (*out)[g];
/* Stateful groups keep these as they always were; a paged group's are overwritten by
* kv_bind_views with the active view's arithmetic. */
b.base = gp->base;
b.layer_stride = gp->layer_stride();
b.bytes = gp->pool_bytes;
@@ -34,10 +37,15 @@ void bind_kv_pools(const Program& p, const std::function<const KVGroupPlan*(int3
case RAD_KV_WINDOW:
case RAD_KV_RING:
b.rank = 4;
b.shape[0] = gp->n_blocks;
/* `shape[0]` follows the view and is filled by kv_bind_views below: the resident
* window's depth for the ring, the group's context for the prefill stage
* (docs/KV-STREAMING.md §3.1, §4.1). */
b.shape[0] = gp->pool_blocks();
b.shape[1] = d.n_head_kv;
b.shape[2] = gp->block_size;
b.shape[3] = 2 * d.head_dim;
/* Both fixed views over the group's one allocation, with the ring active. */
kv_bind_views(*gp, &b);
break;
case RAD_KV_LINEAR:
b.rank = 4;