mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 23:08:36 +00:00
Inkling CUDA: the elastic pool is for one slot; several slots keep the old placement and say so
With several slots a visit's K/V is one block [slot][position] of a fixed size per slot: it cannot grow one slot at a time inside one address range, so no chunk could ever go to the K/V and the pool would only be a different way to allocate d_sec4. The loader now takes the old path (one cudaMalloc, no pool, no hybrid tier pool in virtual memory) when the planned slot count is above 1 and logs one line: "[InkElastic] off: N parallel slots ...". The decision is InkElasticSec4Pool::slots_allowed, covered by the host test.
This commit is contained in:
1 parent
4b6c028fb9
commit
c4fb1f7af7
3 files changed
+19
-2
No files matched your search
@@ -954,7 +954,10 @@ struct InkCudaModel {
|
||||
// chunk are served by the hybrid engine from a host copy, see elastic_arm). STRATA_INK_ELASTIC_EXPERTS=0 keeps one cudaMalloc.
|
||||
bool used_elastic_vmm = false;
|
||||
const char* kv_vmm_env_ld = std::getenv("STRATA_INK_KV_VMM");
|
||||
if (InkElasticSec4Pool::env_enabled() && !(kv_vmm_env_ld && kv_vmm_env_ld[0] == '0') && strata::core::vmm_available()) {
|
||||
const int plan_slots_el = sm120_plan_slots_ref().load();
|
||||
if (InkElasticSec4Pool::env_enabled() && plan_slots_el > 1 && strata::core::vmm_available())
|
||||
std::fprintf(stderr, "[InkElastic] off: %d parallel slots (a slot's K/V cannot grow alone inside one address range); the experts are placed as before\n", plan_slots_el);
|
||||
if (InkElasticSec4Pool::env_enabled() && InkElasticSec4Pool::slots_allowed(plan_slots_el) && !(kv_vmm_env_ld && kv_vmm_env_ld[0] == '0') && strata::core::vmm_available()) {
|
||||
const auto& vorder = rd.vram_load_order();
|
||||
std::vector<uint16_t> order;
|
||||
if ((int)vorder.size() == n_total) {
|
||||
@@ -1171,7 +1174,7 @@ struct InkCudaModel {
|
||||
if (tier_mode) {
|
||||
// the slot pool in the elastic pool's virtual memory: the global K/V can then take chunks from it (hybrid.tier_shrink)
|
||||
const char* kv_vmm_env_t = std::getenv("STRATA_INK_KV_VMM");
|
||||
if (InkElasticSec4Pool::env_enabled() && !(kv_vmm_env_t && kv_vmm_env_t[0] == '0') && strata::core::vmm_available()) hybrid.tier_vmm = &elastic_sec4;
|
||||
if (InkElasticSec4Pool::env_enabled() && InkElasticSec4Pool::slots_allowed(sm120_plan_slots_ref().load()) && !(kv_vmm_env_t && kv_vmm_env_t[0] == '0') && strata::core::vmm_available()) hybrid.tier_vmm = &elastic_sec4;
|
||||
if (hybrid.tier_alloc()) {
|
||||
elastic_tier = hybrid.tier_vmm != nullptr;
|
||||
const int E = man.c.n_experts;
|
||||
|
||||
@@ -146,6 +146,9 @@ public:
|
||||
const char* e = std::getenv("STRATA_INK_ELASTIC_EXPERTS");
|
||||
return !(e && e[0] == '0');
|
||||
}
|
||||
// One slot only. With several slots a visit's K/V is one block [slot][position] of a fixed size per slot, which cannot grow one slot at a time inside one
|
||||
// address range, so no chunk could ever go to the K/V: the experts are placed as before (one allocation, nothing elastic), and the log says so once.
|
||||
static bool slots_allowed(int slots) noexcept { return slots == 1; }
|
||||
|
||||
static uint64_t env_min_expert_bytes() noexcept {
|
||||
if (const char* e = std::getenv("STRATA_INK_ELASTIC_MIN_EXP_MIB")) {
|
||||
|
||||
@@ -282,6 +282,16 @@ void test_elastic_pool_shrink_rescue_and_regrow() {
|
||||
}
|
||||
|
||||
// A pool with no expert table (the hybrid engine's slot pool): the caller moves the end of the mapped prefix itself.
|
||||
// Several slots: the pool is not used (one allocation, the old placement); the decision is one function the loader and this test share.
|
||||
void test_pool_is_for_one_slot_only() {
|
||||
CHECK(strata::ink::InkElasticSec4Pool::slots_allowed(1));
|
||||
CHECK(!strata::ink::InkElasticSec4Pool::slots_allowed(2));
|
||||
CHECK(!strata::ink::InkElasticSec4Pool::slots_allowed(16));
|
||||
CHECK(!strata::ink::InkElasticSec4Pool::slots_allowed(64));
|
||||
std::printf("[PASS] InkElasticSec4Pool: several slots keep the old placement
|
||||
");
|
||||
}
|
||||
|
||||
void test_tail_moves_for_a_caller_managed_pool() {
|
||||
set_env("STRATA_INK_ELASTIC_MIN_EXP_MIB", "256"); // 128 chunks kept
|
||||
strata::ink::InkElasticSec4Pool pool;
|
||||
@@ -354,6 +364,7 @@ void test_k8v4_and_k8v8_tc_attn_non_saturation() {
|
||||
|
||||
int main() {
|
||||
test_elastic_pool_shrink_rescue_and_regrow();
|
||||
test_pool_is_for_one_slot_only();
|
||||
test_tail_moves_for_a_caller_managed_pool();
|
||||
test_k8v4_and_k8v8_tc_attn_non_saturation();
|
||||
if (g_failures) {
|
||||
|
||||
Reference in new issue
Block a user