]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server : fix LRU check (#14079)
authorGeorgi Gerganov <redacted>
Mon, 9 Jun 2025 09:57:58 +0000 (12:57 +0300)
committerGitHub <redacted>
Mon, 9 Jun 2025 09:57:58 +0000 (12:57 +0300)
ggml-ci

tools/server/server.cpp

index 2e78dcd7bf1da400ced0e46cc08b9b45b358cae3..77dcbc11bf1f0a6fa9c69a2c4d0f39a382de4112 100644 (file)
@@ -2142,7 +2142,8 @@ struct server_context {
 
         // find the slot that has been least recently used
         if (ret == nullptr) {
-            int64_t t_last = ggml_time_us();
+            int64_t t_last = -1;
+
             for (server_slot & slot : slots) {
                 // skip the slot if it is not available
                 if (slot.is_processing()) {
@@ -2150,7 +2151,7 @@ struct server_context {
                 }
 
                 // select the current slot if the criteria match
-                if (slot.t_last_used < t_last) {
+                if (!ret || slot.t_last_used <= t_last) {
                     t_last = slot.t_last_used;
                     ret = &slot;
                 }