server : fix slot selection by lru, migrate lcs to size_t
This commit is contained in:
parent
ba6f62eb79
commit
aa4277cf97
2 changed files with 8 additions and 7 deletions
|
@ -247,6 +247,7 @@ struct server_slot {
|
||||||
if (is_processing()) {
|
if (is_processing()) {
|
||||||
SLT_INF(*this, "stop processing: n_past = %d, truncated = %d\n", n_past, truncated);
|
SLT_INF(*this, "stop processing: n_past = %d, truncated = %d\n", n_past, truncated);
|
||||||
|
|
||||||
|
t_last_used = ggml_time_us();
|
||||||
t_token_generation = (ggml_time_us() - t_start_generation) / 1e3;
|
t_token_generation = (ggml_time_us() - t_start_generation) / 1e3;
|
||||||
state = SLOT_STATE_IDLE;
|
state = SLOT_STATE_IDLE;
|
||||||
callback_on_release(id);
|
callback_on_release(id);
|
||||||
|
|
|
@ -453,20 +453,20 @@ static size_t longest_common_subsequence(const llama_tokens & a, const llama_tok
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the lengths of the input sequences
|
// get the lengths of the input sequences
|
||||||
int a_len = a.size();
|
size_t a_len = a.size();
|
||||||
int b_len = b.size();
|
size_t b_len = b.size();
|
||||||
|
|
||||||
// initialize the maximum length of the longest common subsequence (LCS)
|
// initialize the maximum length of the longest common subsequence (LCS)
|
||||||
int max_length = 0;
|
size_t max_length = 0;
|
||||||
|
|
||||||
// use two rows instead of a 2D matrix to optimize space
|
// use two rows instead of a 2D matrix to optimize space
|
||||||
std::vector<int> prev_row(b_len + 1, 0);
|
std::vector<size_t> prev_row(b_len + 1, 0);
|
||||||
std::vector<int> curr_row(b_len + 1, 0);
|
std::vector<size_t> curr_row(b_len + 1, 0);
|
||||||
|
|
||||||
// iterate through the elements of a
|
// iterate through the elements of a
|
||||||
for (int i = 1; i <= a_len; i++) {
|
for (size_t i = 1; i <= a_len; i++) {
|
||||||
// iterate through the elements of b
|
// iterate through the elements of b
|
||||||
for (int j = 1; j <= b_len; j++) {
|
for (size_t j = 1; j <= b_len; j++) {
|
||||||
// if elements at the current positions match
|
// if elements at the current positions match
|
||||||
if (a[i - 1] == b[j - 1]) {
|
if (a[i - 1] == b[j - 1]) {
|
||||||
// if it's the first element of either sequences, set LCS length to 1
|
// if it's the first element of either sequences, set LCS length to 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue