Port of BatchRotatingKVCache.make_mask for the DECODE case. Returns a
[B,1,N,S] bool mask (S == min(maxSize-1, offsetScalar) + N) for the step
ABOUT to be written: causal AND sliding-window AND per-row left-padding,
rolled to the ring's physical layout once wrapped.
Inputs are the PRE-write scalar ring state (idx=_idx, offsetScalar=_offset,
rotated) and per-row leftPad. The leftPad adjustments here are LOCAL to
the mask (mlx-lm decrements left_padding both in make_mask AND in update; the
update's decrement is the persistent one, applied separately by the cache).
Port of BatchRotatingKVCache.make_mask for the DECODE case. Returns a [B,1,N,S] bool mask (S == min(maxSize-1, offsetScalar) + N) for the step ABOUT to be written: causal AND sliding-window AND per-row left-padding, rolled to the ring's physical layout once wrapped.
Inputs are the PRE-write scalar ring state (
idx=_idx,offsetScalar=_offset,rotated) and per-rowleftPad. The leftPad adjustments here are LOCAL to the mask (mlx-lm decrements left_padding both in make_mask AND in update; the update's decrement is the persistent one, applied separately by the cache).