Skip to content

Stream-ordered frees and send ordering without host fences - #30

Open
AdvaitTahilyani wants to merge 8 commits into
scale/14-sort-split-axisfrom
scale/15-stream-ordered-frees
Open

AdvaitTahilyani wants to merge 8 commits into
scale/14-sort-split-axisfrom
scale/15-stream-ordered-frees

Conversation

@AdvaitTahilyani

@AdvaitTahilyani AdvaitTahilyani commented Nov 5, 2026 •

Copy link
Copy Markdown

Replaces the per-message Kokkos::fence and free_buffer global fences in executor_signal.cpp (fft_conv, send_input, flip, conv, bmm input) with stream events, comm_free_after and free_after_compute. free_buffer(char*)/compute_fence in executor_castscansort.cpp and executor_indexing.cpp are not converted here. This is the base for the next few PRs.

🤖 Generated with Claude Code

free_buffer(partition, buf) frees after the chare's compute stream (ordered after its
comm stream and the default instance) instead of a device-wide Kokkos::fence; new
helpers ct_after_stream (host task after a stream), ct_stream_after/comm_after_compute
(event ordering), free_after_compute and upload_words. CONVOLVE/FLIP use them: the FFT
temporaries and cuFFT plans are released from a compute-stream callback, and packed
sends order the comm stream after the packs instead of fencing per message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit af00d12bbf06da7964ff3316c3bc4b92cadb6cc2)

@adityapb adityapb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verdict: approve with nits.

This is a static review. Line numbers are at this PR's head.

I enumerated every fence this PR removes (fft_conv_gpu, send_input, finish_flip, finish_conv, send_bmm_input):

  • Each is covered by an event, by same-stream ordering, or by comm_after_compute.
  • None of the freed buffers is read later by another stream or by the host.

Node outputs that now complete asynchronously are also covered:

  • children start with join_streams();
  • gets fence;
  • reuse calls compute_after_others().
  1. Nit: the description says the PR replaces the per-message fences and the free_buffer global fences in general. Only executor_signal.cpp is converted: free_buffer(char*) and compute_fence remain in executor_castscansort.cpp (:220, :634-636) and in executor_indexing.cpp.
  2. Nit: free_buffer(partition, buf) (backend_internal.hpp:602-606) always calls compute_after_others().
    • That adds false dependencies on the comm stream and the default instance for buffers used only on the compute stream; fft_conv_gpu calls it four times in a row.
    • Use free_after_compute there.

…er_compute

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AdvaitTahilyani

Copy link
Copy Markdown
Author
  1. Description scope: fixed in the description (only executor_signal.cpp is converted; castscansort/indexing keep free_buffer(char*)/compute_fence).
  2. free_buffer(partition, ...) in fft_conv_gpu: fixed in d1a46a8 (the four compute-only buffers use free_after_compute).
    Validated: nc build; test_signal +p1 146/146. The change is in the USE_NVIDIA path, so it was not compiled or run here (no GPU run).

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.

2 participants