﻿# RCCL groups: dependent GPU work belongs after ncclGroupEnd

Place dependent HIP consumers after RCCL group submission and distinguish grouped enqueue completion, nonblocking communicator progress and finished device communication.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-rccl-groupend-enqueue-not-completion-boundary/
Language: en

## Identify the group submission boundary

The [RCCL API reference](https://rocm.docs.amd.com/projects/rccl/en/latest/api-reference/api-library.html) explains that grouped communication is not started on the HIP stream until the group ends. A consumer kernel inserted inside the group can therefore be ordered before the communication it was supposed to consume. Keep data-dependent HIP operations after the enclosing group submission boundary. Merely using the same stream does not fix a sequence whose relevant producer has not yet been enqueued.

## Preserve the outer caller's grouping contract

A wrapper can be invoked while its caller already owns a group. Treating the wrapper's local end call as proof that the caller's entire communication batch is ready can misplace dependent work. Trace the actual enclosing grouping structure during integration, and define who owns post-communication processing. An adapter should not infer completion from a local function boundary that has no equivalent meaning in the caller's full operation sequence.

## Separate enqueue from completed communication

The [library specification](https://rocm.docs.amd.com/projects/rccl/en/latest/api-reference/library-specification.html) distinguishes stream submission from operations effectively finishing. A successful ordinary group end is not a statement that all GPU results are already available to the CPU or to unrelated streams. Use supported stream dependencies and completion checks for consumers outside the communication stream. Keep input and result buffers alive while communication still uses them.

## Respect nonblocking progress and failure handling

The [fault-tolerance guide](https://rocm.docs.amd.com/projects/rccl/en/latest/how-to/fault-tolerance.html) documents nonblocking communicator progress and asynchronous errors. In that mode, do not collapse an in-progress result into either success or immediate fatal failure. Follow the exact release's progress requirements before issuing dependent operations, and keep failure checks distinct from normal device completion. A consumer waiting on data cannot repair a communicator that never successfully submitted the required producer operation.

## Validate with an intentionally delayed producer

Build a small grouped exchange followed by a recognizable transformation of its output, then inspect ordering and result identity. Test the wrapper both alone and under its intended enclosing group usage. The existing [stream-dependency guide](/journal/learn-stream-ordering-dependencies/) and [software reproducibility guide](/journal/software-stack-reproducibility/) support related context. Report grouped submission, communicator progress and completed communication as separate boundaries, preventing a local optimization from reading data before its producer reaches the stream.
