server: visit parent slots before child slots (#30779)
* server: visit parent slots before child slots A parent slot wakes its waiting child slots once it finishes the shared prompt prefix, while slots are visited in id order. When a child task lands on a lower slot id than its parent, the child is visited before the parent wakes it and waits an extra batch to process its suffix. Non-child slots are now visited before active child slots, so every child woken by its parent joins the same batch. * server: check systemone test events through test tags The systemone tests matched free-form debug messages, including the formatted f_keep value of the prompt cache. The server now emits __TEST_TAG_WAIT_PARENT_SLOT__ when a child slot waits for its parent, __TEST_TAG_PROMPT_CACHE_RESTORE__ on every prompt cache restore and __TEST_TAG_PROMPT_CACHE_FULL_RESTORE__ when the whole cached prompt is a prefix of the new one, compared on token counts. --------- Co-authored-by: Pascal <admin@serveurperso.com>
This commit is contained in:
1 parent
cf659f240b
commit
0956684529
3 files changed
+42
-13
No files matched your search
@@ -3424,13 +3424,19 @@ private:
|
||||
}
|
||||
|
||||
void iterate(std::vector<server_slot> & slots, std::function<void(server_slot &)> callback) {
|
||||
for (auto & slot : slots) {
|
||||
try {
|
||||
callback(slot);
|
||||
} catch (const std::exception & e) {
|
||||
SLT_ERR(slot, "got exception: %s\n", e.what());
|
||||
send_error(slot, std::string("got exception: ") + e.what(), ERROR_TYPE_SERVER);
|
||||
slot.release();
|
||||
for (int pass = 0; pass < 2; ++pass) {
|
||||
for (auto & slot : slots) {
|
||||
const bool is_child = slot.is_processing() && slot.task->is_child();
|
||||
if (is_child != (pass == 1)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
callback(slot);
|
||||
} catch (const std::exception & e) {
|
||||
SLT_ERR(slot, "got exception: %s\n", e.what());
|
||||
send_error(slot, std::string("got exception: ") + e.what(), ERROR_TYPE_SERVER);
|
||||
slot.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4007,6 +4013,7 @@ private:
|
||||
// check if this is a child slot
|
||||
if (slot.state == SLOT_STATE_WAIT_OTHER) {
|
||||
SLT_DBG(slot, "%s", "waiting for parent slot to complete\n");
|
||||
SLT_DBG(slot, "%s", "__TEST_TAG_WAIT_PARENT_SLOT__\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user