abi: a request's words for the plugin (RadBatch::plugin_words), ABI 32

This commit is contained in:
Brandon Bertelsen committed 2026-10-28 00:33:55 -04:00
1 parent d60da58732
commit 5a2732f063
15 files changed
+207 -8

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ extern "C" {
* rad_spechub.h. Every kind of plugin reports it, and a plugin that does not report exactly this
* version is refused at load with both versions printed. A new optional export (e.g.
* rad_plugin_reference) is not a change of shape: a plugin without it gets the default. */
#define RAD_ABI_VERSION 31u
#define RAD_ABI_VERSION 32u
/* ================================================================== plugin identity */
/* One value per plugin, not flags (QUANT is 3). RAD_PLUGIN_QUANT is a quantiser plugin:
+5
View File
@@ -678,6 +678,11 @@ int rad_declare_logits(RadBuilder* b, rad_buf logits);
* this or logits, never both. */
int rad_declare_pooled(RadBuilder* b, rad_buf pooled);
/* The most integer words one request may hand the plugin (RadBatch::plugin_words), 0 for none.
* The engine stages that many a sequence in the step batch and refuses a longer request before
* it is admitted, so the plugin reads its words at the size it declared. Additive export. */
int rad_declare_plugin_words(RadBuilder* b, int64_t max_words);
/* ================================================================== the drafter */
/* The plugin's draft head. The core drives the extra passes, and only the plugin knows what it
+20
View File
@@ -290,6 +290,26 @@ typedef struct RadBatch {
* position tables per grid) reads them here; they live as long as the pass. */
const int32_t* enc_seg_h;
const int32_t* enc_seg_w;
/* ---- appended in ABI 32 (a request's words for the plugin) */
/* Integer words a request hands the plugin whole (Request::plugin_words), for a head that
* needs more of a request than its tokens: clef's joint schema head reads the prompt's
* question and option spans and the option tokens (abi/rad_clef.h). Sequence s's words are
* `plugin_words[plugin_cu[s] .. plugin_cu[s+1])`; a sequence with none has an empty range.
* The engine writes the sequence's first sampled logits row of this step into word 0 of its
* range, so the head can put its result beside that row's logits; the words after it are the
* request's own. Carried only on the trunk step that samples a prompt's first token, so a
* head runs once a request, when every prompt row has been computed.
*
* `plugin_words_h` and `plugin_cu_h` are the same words on the host, for a plugin that reads
* counts before it issues; they live as long as the pass. All null, with `n_plugin_words`
* 0, on a step no sequence of which carries words, and on every step of a program that
* declared none (rad_declare_plugin_words). */
int64_t n_plugin_words;
const int32_t* plugin_words; /* [n_plugin_words] device */
const int32_t* plugin_cu; /* [n_seq + 1] device */
const int32_t* plugin_words_h;
const int32_t* plugin_cu_h;
} RadBatch;
/* What a generator pass carries beside the step batch's own fields, which keep their meanings: