diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-06-15 09:45:22 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-06-15 09:45:22 +0200 |
| commit | 43fdb308879fb0c61cb71553d9ac885c011d3a66 (patch) | |
| tree | f33b036fa5ef8d8c069a5787cac684e85d54c17f /embed.h | |
| parent | 16d2bd83d24d45828fe039d593f5560a0eb8329f (diff) | |
| download | ffwd-43fdb308879fb0c61cb71553d9ac885c011d3a66.tar.gz ffwd-43fdb308879fb0c61cb71553d9ac885c011d3a66.zip | |
late: batch CPU rerank candidate encoding in one packed forward
Diffstat (limited to 'embed.h')
| -rw-r--r-- | embed.h | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -287,6 +287,25 @@ EMBED_API int embed_late_model_encode_tokens(const embed_late_model_t *model, float *out_vectors); /* + * Encode n_docs documents in one block-diagonal forward and pack each + * document's kept token vectors back-to-back into out_vectors[total_keep, + * token_dim] in document order, where total_keep is the sum of n_keep. + * out_offsets[n_docs + 1] receives the prefix sum of kept counts, the layout + * embed_late_maxsim_batch consumes. keep[d] lists the n_keep[d] token indices to + * retain from document d. Returns 0 on success, -1 on error. + */ +EMBED_API int embed_late_model_encode_docs(const embed_late_model_t *model, + embed_late_workspace_t *ws, + const int *const *doc_ids, + const int *n_tokens, + const int *const *keep, + const int *n_keep, + int n_docs, + int normalize, + float *out_vectors, + int *out_offsets); + +/* * Sum over query tokens of max dot product against document tokens. */ EMBED_API float embed_late_maxsim(const float *query_vectors, |
