| 1155 | } |
| 1156 | |
| 1157 | static void src_build_worker(int worker_id, void *ctx_ptr) { |
| 1158 | (void)worker_id; |
| 1159 | src_build_ctx_t *sc = ctx_ptr; |
| 1160 | while (true) { |
| 1161 | int start = atomic_fetch_add_explicit(&sc->next_idx, CBM_SEM_WORKER_STACK_CAP, |
| 1162 | memory_order_relaxed); |
| 1163 | if (start >= sc->entry_count) { |
| 1164 | break; |
| 1165 | } |
| 1166 | int end = start + CBM_SEM_WORKER_STACK_CAP; |
| 1167 | if (end > sc->entry_count) { |
| 1168 | end = sc->entry_count; |
| 1169 | } |
| 1170 | for (int i = start; i < end; i++) { |
| 1171 | build_src_entry(sc->entries[i].token, &sc->src_entries[i]); |
| 1172 | } |
| 1173 | } |
| 1174 | } |
| 1175 | |
| 1176 | /* Quantize pass1 float vectors to int8 (× 127) for use as pass2 source. |
| 1177 | * Input vectors are unit-normalized, so values are in [-1, 1] → int8 preserves |
nothing calls this directly
no test coverage detected