Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,12 @@ def forward(
)

kv_inputs[i % 2] = p2p_comm_buffers[i]

# Release the KV chunk from two steps back.
if i >= 2 and not is_graph_capturing():
p2p_comm_buffers[i - 2].record_stream(flash_attn_streams[i % 2])
Comment on lines +1719 to +1721

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Cover the active eviction branch

The new buffer release executes only for pure P2P Ring Attention with a context-parallel size of at least three, but existing coverage does not exercise that configuration. Add a regression test for this branch so stream-lifetime and ring-index regressions do not leave larger runs vulnerable to corrupted results or GPU memory errors.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

p2p_comm_buffers[i - 2] = None

k_part = kv_inputs[i % 2][:k_numel].view(*k_shape)
v_part = kv_inputs[i % 2][k_numel:].view(*v_shape)
q_part = q
Expand Down
Loading