-
Notifications
You must be signed in to change notification settings - Fork 34
Use vectorization hints in MoE #406
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -42,6 +42,7 @@ def _convert_dp_to_ep( | |||||
| off_m_local = pid_m | ||||||
|
|
||||||
| offs_n = tl.arange(0, BLOCK) | ||||||
| offs_n = tl.max_contiguous(tl.multiple_of(offs_n, BLOCK), BLOCK) | ||||||
|
||||||
| offs_n = tl.max_contiguous(tl.multiple_of(offs_n, BLOCK), BLOCK) | |
| offs_n = tl.max_contiguous(offs_n, BLOCK) |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -45,10 +45,12 @@ def _allgather_push_kernel( | |||||||||
| ): | ||||||||||
| pid = tl.program_id(0) | ||||||||||
| offs = pid * BLOCK + tl.arange(0, BLOCK) | ||||||||||
| offs = tl.max_contiguous(tl.multiple_of(offs, BLOCK), BLOCK) | ||||||||||
|
Comment on lines
47
to
+48
|
||||||||||
| offs = pid * BLOCK + tl.arange(0, BLOCK) | |
| offs = tl.max_contiguous(tl.multiple_of(offs, BLOCK), BLOCK) | |
| base = tl.multiple_of(pid * BLOCK, BLOCK) | |
| offs = tl.max_contiguous(base + tl.arange(0, BLOCK), BLOCK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tl.multiple_of(offs_n, BLOCK)is an incorrect hint fortl.arange(0, BLOCK)and may allow the compiler to assume alignments that don't hold. Applytl.multiple_ofto an aligned base (e.g.,start_nif it’s known aligned, or the base pointer) and usetl.max_contiguousfor contiguity.