Commit 799a9fd
committed
fix: track actual selection count in vec0_mmr_rerank
The copy-back loop iterated k_target times, but the greedy selection
loop can terminate early via `if (best_idx < 0) break`, leaving the
tail of out_rowids/out_distances uninitialized. Add an n_selected
counter and out_n_selected output parameter so only actually-selected
entries are copied back. The caller now sets k_used = n_selected
instead of k_used = k_original.
Credit: mceachen (vlasky#6)1 parent be9c9dd commit 799a9fd
1 file changed
Lines changed: 13 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7001 | 7001 | | |
7002 | 7002 | | |
7003 | 7003 | | |
7004 | | - | |
| 7004 | + | |
| 7005 | + | |
| 7006 | + | |
7005 | 7007 | | |
7006 | 7008 | | |
7007 | 7009 | | |
| |||
7011 | 7013 | | |
7012 | 7014 | | |
7013 | 7015 | | |
7014 | | - | |
| 7016 | + | |
| 7017 | + | |
7015 | 7018 | | |
7016 | 7019 | | |
7017 | 7020 | | |
| |||
7056 | 7059 | | |
7057 | 7060 | | |
7058 | 7061 | | |
| 7062 | + | |
7059 | 7063 | | |
7060 | 7064 | | |
7061 | 7065 | | |
| |||
7085 | 7089 | | |
7086 | 7090 | | |
7087 | 7091 | | |
| 7092 | + | |
7088 | 7093 | | |
7089 | 7094 | | |
7090 | | - | |
7091 | | - | |
| 7095 | + | |
| 7096 | + | |
7092 | 7097 | | |
7093 | 7098 | | |
7094 | 7099 | | |
| 7100 | + | |
7095 | 7101 | | |
7096 | 7102 | | |
7097 | 7103 | | |
| |||
7387 | 7393 | | |
7388 | 7394 | | |
7389 | 7395 | | |
| 7396 | + | |
7390 | 7397 | | |
7391 | 7398 | | |
7392 | | - | |
| 7399 | + | |
7393 | 7400 | | |
7394 | | - | |
| 7401 | + | |
7395 | 7402 | | |
7396 | 7403 | | |
7397 | 7404 | | |
| |||
0 commit comments