Verba/Rapida

Esperimenti #167f

Row 167p's fix: the shortlist's top-64 pick without sorting the losers. Row 167's `r167_topk_part`...

done

Il testo degli esperimenti resta in inglese, come l'ha scritto il laboratorio.

Cosa è stato provato

Row 167p's fix: the shortlist's top-64 pick without sorting the losers. Row 167's `r167_topk_part` (`src/topk_select.zig`) bitonic-sorts each 2,048-score chunk in full to keep 64 (106 us a step, plus a 33 us ); a threshold select (one pass counting scores above a candidate cut found from per-thread maxima, a gather of the at-most-few-hundred survivors, then the same stable order on those only) keeps argpartition's pick and tie order. Step 1 the r167 unit tests (ties, NaN, k = 64) plus a timing-free kernel microbench against row 167's part and merge; then the 150-reply identity count; then a pair stacked on row 167

Modello e configurazione

row 167

Guadagno atteso

about +0.7% to +1.0% (0.07 to 0.12 ms of 10.4 ms; **measured** cost, **estimate** of the new kernel's time)

Da dove viene l'idea

rows 167, 167p

Esito

done 2026-11-19: step 1a PASS (`2026-11-19-mac-r167f-select-chunks/README.md`: part plus merge 91.6 us at CH 256, TG 128 against 125.9 at CH 2048, saving 38.7 us [26.7, 51.3]; picks identical to argpartition at every size); closed into row stk2, which carries the constants (LESTO row/167f 9413eb26, stacked on row/stk2) to the identity count and the pair; no separate build

Lezione

smaller chunks cut row 167's select by a third with no new code: at CH 256 each threadgroup sorts 256 scores in shared memory instead of 2,048, and the merge's extra chunks (635 against 80) cost less than the sorts saved. The saving grows at every halving down to 256, so the sort dominated, not the merge.

Adottato

no (closed into row stk2, which measures it in the engine)

Vuoi vedere cosa hanno prodotto questi esperimenti? Lesto, il motore di inferenza per Gemma 4 sui Mac con Apple silicon, è su lestoengine.com

Creato da Federico Andrioli, @fedeandri su X Le misure di un laboratorio di ricerca, ricavate direttamente dai suoi file. Dati aggiornati al