NVIDIA / NVIDIA/cutlass

[QST]Why is __syncthreads() required before cluster_sync() on SM90?

Open
#2,573 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

? - Needs Triage inactive-30d inactive-90d question
Dominant language
C++
Stars
10.5k
Forks
2.1k
Avg merge
3d 11h
Merged PRs (30d)
7

Description

Hi all,

I'm working with the Hopper architecture and have a question about the synchronization scopes of __syncthreads() versus cute::cluster_sync().

I frequently see the following pattern, where an intra-block sync is called right before a cluster-wide sync:

// A single thread/warp prepares a resource in shared memory
if (/* designated thread */) {
    prepare_shared_resource();
}

// Why is this intra-block sync needed?
__syncthreads();

// Before the inter-CTA sync
cute::cluster_sync();

I had assumed cluster_sync (which uses barrier.cluster) would be a superset of __syncthreads, making the explicit __syncthreads() call redundant.

Could someone clarify the precise scope of barrier.cluster? Does it only synchronize the calling threads across the cluster's CTAs? If so, is the __syncthreads() mandatory to prevent race conditions within each block before the cluster-level synchronization begins?

Thanks for any insights.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the CUDA documentation for barrier.cluster and the implementation or call sites of cute::cluster_sync in CUTLASS. Determine whether cluster_sync synchronizes all threads in each CTA or only participating threads, and document when __syncthreads() is required before it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.