This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/core/mem
C_Tamas 2bf1096131 prefix cache: the host tier cannot hold a streamed entry, so it is off
The prefix cache's host tier and --kv-resident are exclusive, and the engine
used to find that out at the first restore. An entry covers every cached
group; a streamed group's rows are addressed by the block id its sequence
used, in that group's own pinned mirror, so a slot cannot stand in for them
and their ids cannot be given up in exchange for one.

Three defects came from ignoring that:

  * the write-back gathered the resident sibling with the streamed group's
    block id, so the host slot held another group's row (TierExec indexes
    its block vector by gi_, the entry's ids are in groups_ order);
  * demotion released the streamed group's ids too (PrefixCache::
    release_blocks walks every group), handing the mirror rows the entry
    lives in back to the allocator;
  * a restore reserved one group's ids against an entry that has two, so
    rebind returned RAD_E_SHAPE and the record was dropped -- and
    engine.cpp's failure path then released those ids against the wrong
    pools.

Measured on 2x16GB tp2, three 44220-token conversations and a replay of the
first after the third displaced it, streaming on: 20247 entries demoted,
8588 restored, replay 0 cached tokens / 16.5s against streaming off's
44160 cached / 0.4s. The copies were pure waste.

Two rules now:

  * PrefixCache::demotable() is false when any cached group streams: the
    tiers are never told about such an entry (insert), and trim_sparing no
    longer skips it as though its copy were in flight, so it is evicted
    whole with every group's ids.
  * kvstream_prefix_host_off() turns --prefix-cache-mib off at bring-up,
    before anything is sized from it, when cfg.kv_streams is set -- the
    flag asked, the architecture streams and the ring is under the context.
    A flag with no streaming behind it (0, a ring that covers the context,
    a model with no kv_resolve) keeps the tier exactly as configured.

On the cards: --kv-resident 32768 reports "no host cache ... so it is off"
and 0 (off); --kv-resident 131072 keeps 2.00 GiB / 38836 entries. The tests
live in the mem test file's own commit; the docs in the docs commit.
2026-10-25 07:03:03 +07:00
..
2026-10-16 18:25:18 +02:00
2026-10-16 18:25:18 +02:00
2026-10-16 18:25:18 +02:00
2026-10-16 18:25:18 +02:00
2026-10-23 11:57:52 +02:00