Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QST]How to Handle Synchronization with Different Thread Counts for Producer and Consumer in CUTLASS? #1998

Open
ziyuhuang123 opened this issue Dec 18, 2024 · 0 comments

Comments

@ziyuhuang123
Copy link

In scenarios where both producer and consumer threads exist, how can we achieve synchronization using CUTLASS's barrier.sync/arrive? I understand that in barrier.arrive(a, b), a represents the number of threads required to arrive, and b is the barrier_ID. However, the number of producer and consumer threads is often different.

In FlashAttention3, I saw this example:
https://github.com/Dao-AILab/flash-attention/blob/0dfb28174333d9eefb7c1dd4292690a8458d1e89/hopper/mainloop_fwd_sm90_tma_gmma_ws.hpp#L651

Here, the a parameter includes the consumer thread count (256) plus the active threads in the producer (32). However, I don't understand why it is written this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant