File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,9 +90,11 @@ class ET_EXPERIMENTAL LLMSession {
9090 virtual ::executorch::runtime::Result<DecodeResult> decode_one (
9191 const SamplingConfig& sampling) = 0;
9292
93- // / Rewind the KV cache to `pos` (prefix reuse). Valid for full-KV models;
94- // / sliding-window KV may reject a seek past its window (the caller falls back
95- // / to a fresh prefill).
93+ // / Rewind the KV cache to `pos` (prefix reuse). Valid for full-KV models.
94+ // / Returns InvalidArgument if `pos` is outside [0, position()]. Returns
95+ // / NotSupported for models whose state cannot be safely rewound (for example,
96+ // / non-KV-cache, sliding-window, or recurrent-state models); callers should
97+ // / fall back to reset() + full prefill.
9698 virtual ::executorch::runtime::Error seek (int64_t pos) = 0;
9799
98100 // / Number of tokens with resident KV (upper bound for seek()).
Original file line number Diff line number Diff line change @@ -101,13 +101,14 @@ ET_EXPERIMENTAL size_t inline utf8_complete_prefix_len(const std::string& s) {
101101
102102// How many leading bytes of `text` a streaming consumer may safely emit given a
103103// set of `stops` strings, and whether a stop was hit (`stop_hit`).
104- // * If any stop occurs, returns the byte offset of the EARLIEST occurrence and
105- // sets stop_hit=true — text before it is safe; the stop and everything after
106- // are dropped (the stop is excluded from output).
104+ // * If any stop occurs, returns the byte offset of the EARLIEST occurrence
105+ // and
106+ // sets stop_hit=true — text before it is safe; the stop and everything
107+ // after are dropped (the stop is excluded from output).
107108// * Otherwise returns the length minus the longest possible partial-stop tail
108- // (max(len(stop))-1 bytes), snapped DOWN to a UTF-8 boundary so a multi-byte
109- // character is never split; stop_hit=false. Holding back that tail lets a
110- // stop that straddles the next piece still be caught.
109+ // (max(len(stop))-1 bytes), snapped DOWN to a UTF-8 boundary so a
110+ // multi-byte character is never split; stop_hit=false. Holding back that
111+ // tail lets a stop that straddles the next piece still be caught.
111112// `text` is expected to be complete-UTF-8 (e.g. the assembled output of
112113// utf8_complete_prefix_len). Empty `stops` => emit everything, no hold-back.
113114ET_EXPERIMENTAL size_t inline stop_safe_prefix_len (
You can’t perform that action at this time.
0 commit comments