Skip to content

ssd: enforce streaming cache floor at one-prefill minimum - #725

Open
bestbug456 wants to merge 1 commit into
antirez:mainfrom
bestbug456:fix/ssd-streaming-cache-floor
Open

ssd: enforce streaming cache floor at one-prefill minimum#725
bestbug456 wants to merge 1 commit into
antirez:mainfrom
bestbug456:fix/ssd-streaming-cache-floor

Conversation

@bestbug456

Copy link
Copy Markdown

Hello! While I was try to make ds4 work on my machine I hit some error that where not clear (at least, to me) therefore after a little bit of digging with AI supported I realize that I was miss configuring the system, is not always easy to drive through this type of situation, therefore I would like to propose a change to guarantee that if miss configuration happen the system try to "auto heal" reporting a warning to the user. That been say, here is the technical description of the changes:

Summary

Enforce a floor on the SSD streaming expert cache budget: it must hold at least one full prefill's routed working set (n_layers x DS4_N_EXPERT_USED experts).

Problem

When the cache budget is smaller than a single token's routed expert set, every slot evicts what it is about to reuse. This causes prefill to always fail with "cannot reserve a slot".

Fix

Added a floor check after budget calculation. If the budget is below `DS4_N_LAYER * DS4_N_EXPERT_USED`, it is raised to that minimum and a diagnostic message is printed.

Files Changed

  • `ds4.c` - Added floor enforcement in `ds4_engine_configure_streaming_cache_budget()`

Testing

  • Builds cleanly on CUDA and ROCm targets
  • No behavioral change when budget is already above the floor (typical case)
  • Fixes eviction storms when budget is below the floor

Enforce a floor: the cache must hold at least one full prefill's
routed working set (n_layers * DS4_N_EXPERT_USED experts). Below
that the cache is smaller than a single token's routed set and
every slot evicts what it is about to reuse, so prefill always
fails with 'cannot reserve a slot'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant