[mem_cache] Split duplicate insert frees at the SWA eviction floor (#37481)
This commit is contained in:
@@ -1071,9 +1071,17 @@ class UnifiedTreeCore(UnifiedTreeCoreInterface):
|
||||
|
||||
dup_start = max(0, state.params.prev_prefix_len - state.total_prefix_length)
|
||||
if dup_start < consumed_from:
|
||||
step_actions.append(
|
||||
FreeDeviceKV([value_slice[dup_start:consumed_from]])
|
||||
# The duplicate slice may straddle this request's own eviction
|
||||
# floor; below it only the full side is still ours to release.
|
||||
dup = value_slice[dup_start:consumed_from]
|
||||
abs_start = state.total_prefix_length + dup_start
|
||||
swa_already_freed = min(
|
||||
max(state.params.swa_evicted_seqlen - abs_start, 0), dup.numel()
|
||||
)
|
||||
if swa_already_freed > 0:
|
||||
step_actions.append(FreeDeviceKVFullOnly([dup[:swa_already_freed]]))
|
||||
if swa_already_freed < dup.numel():
|
||||
step_actions.append(FreeDeviceKV([dup[swa_already_freed:]]))
|
||||
|
||||
if self._inc_hit_count_and_check(node, state.params.chunked):
|
||||
step_actions.append(self._build_backup_kv_action(node))
|
||||
|
||||
Reference in New Issue
Block a user