sample: at eight ranks a rank keeps the candidates the merge can hold

Over a split vocabulary every rank's candidates are gathered and merged in one workgroup
(sample_merge_topk), and libr4d's row holds world_size * n_cand <= 4096 pairs in LDS. The engine
declared the default 1024 a rank, 8192 pairs at eight ranks, and the first step stopped on a shape
the merge does not serve. Declare now narrows the width to 4096 / world_size, 512 at eight ranks,
and says so in one line; a request whose top_k is wider is refused at admission, as a top_k over
the width already was. Two and four ranks keep 1024.

sample_test: at two, four and eight ranks declare succeeds, top_k at the width is admitted and one
more is refused, naming the width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
NunzeandClaude Opus 5.5 authored and StillDeadcode committed 2026-10-19 10:38:33 +02:00
1 parent 279214f520
commit 2c0dd8535e
3 files changed
+52

No files matched your search

+4
View File
@@ -197,6 +197,10 @@ int32_t host_argmax(const float* logits, int64_t n_vocab);
/* The candidate width every stage after top-k works in, SamplerConfig::max_candidates' default. */
constexpr int64_t kSampleCandidates = 1024;
/* Under a split vocabulary the merge (sample_merge_topk) holds world_size * n_cand gathered pairs
* in one workgroup's LDS; libr4d's row serves 4096 at most, so the per-rank width shrinks with
* the world (512 at eight ranks). */
constexpr int64_t kSampleMergeCandidates = 4096;
enum class ChainOrder {
Radiance = 0, /* penalties, DRY, temperature, mask, top-k, top-p/min-p/typical, XTC, pick */