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

Enforce 128B alignment for TMA shared memory allocation. #3023

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

rdspring1
Copy link
Collaborator

From https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#table-alignment-multi-dim-tma, the shared memory address must be 128B aligned.

This PR enforces this alignment for all TMA shared memory allocations to avoid CUDA_ERROR_MISALIGNED_ADDRESS errors.

Copy link
Collaborator

@zasdfgbnm zasdfgbnm left a comment

Choose a reason for hiding this comment

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

This change looks good to me. But before you merge, could you move your changes in csrc/device_lower/pass/allocation.cpp, as well as initializeMbarrier and invalidateMbarrier, from #2833 to this PR? Because these are the things that makes TMA buffer no longer aligned well. I checked them in #2833 and they look good to me as well. Also, a nit pick: Should we move initializeMbarrier and invalidateMbarrier to allocation.cpp or as an ir_utils?

@rdspring1
Copy link
Collaborator Author

!build

@rdspring1
Copy link
Collaborator Author

I moved initializeMbarrier and invalidateMbarrier to allocation.cpp

@rdspring1 rdspring1 merged commit 29a59a0 into main Sep 26, 2024
31 of 35 checks passed
@rdspring1 rdspring1 deleted the tma_smem_align branch September 26, 2024 20:26
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