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

XLA:CPU performance regression with the min alignment changed from 16 to 64 #18611

Open
snadampal opened this issue Oct 22, 2024 · 3 comments
Open
Assignees

Comments

@snadampal
Copy link
Contributor

snadampal commented Oct 22, 2024

I'm observing performance regressions for bert and bart model inference with jax mainline compared to jax-v0.4.34 on both x86 and arm64 cpu platforms. The performance drop is around 50%. I have root-caused it to the following PR (and commit) that updated the minimum alignment for the buffer from 16 to 64 to match Eigen.

I have tested two AWS EC2 instances:
c7i.xlarge (x86 architecture) and
c8g.xlarge (arm64 architecture)

I'm able to restore the performance by switching the alignment back to 16.
Can you please let me know what scenarios was this change helping?

PR: #16505
commit:

commit 7db61fe79207e457c89886048afa21484d827590
Author: Adam Banaś <[email protected]>
Date:   Thu Oct 10 04:06:07 2024 -0700

    [XLA:CPU] Change the minimum alignment of buffers to match Eigen
    
    PiperOrigin-RevId: 684386915
@snadampal
Copy link
Contributor Author

hi @Adam-Banas , appreciate if you could comment on this issue.

@Adam-Banas
Copy link
Member

Hi @snadampal, can you provide the script you're using to reproduce?

One reason for such a significant performance drop is that additional buffer copies are performed (instead of views). This can happen if XLA receives unaligned buffers.

To answer your question, there were two reasons for integrating this change:

@ezhulenev
Copy link
Member

I'm pretty sure the problem is from the fact that arguments to JAX come from numpy and they are not properly aligned.

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

No branches or pull requests

3 participants