-
Notifications
You must be signed in to change notification settings - Fork 352
[CPU] Improve INT8 SDPA template #3230
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3230
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 64eae18 with merge base f3fc5e7 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| auto tmp2 = tmp1.round(); | ||
| auto tmp3 = tmp2 + vec_beta1; | ||
| auto tmp1 = at::vec::fmadd(tmp0, vec_sum_scale, vec_beta1); | ||
| auto tmp3 = tmp1.round(); |
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.
Could we also apply the optimization to the below masked vectorization part?
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.
Updated. Thanks.
| auto tmp6 = tmp5.round(); | ||
| auto tmp7 = tmp6 + vec_beta2; | ||
| auto tmp5 = at::vec::fmadd(tmp4, vec_alpha, vec_beta2); | ||
| auto tmp7 = tmp5.round(); |
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.
Ditto.
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.
Updated. Thanks.
| auto tmp6 = tmp5.round(); | ||
| auto tmp7 = tmp6 + vec_beta2; | ||
| auto tmp5 = at::vec::fmadd(tmp4, vec_alpha, vec_beta2); | ||
| auto tmp7 = tmp5.round(); |
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.
Ditto.
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.
Updated. Thanks.
It brings about 1% E2E improvement when running int8 VIT on 4 cores.