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

Allow aliasing in all mpn multiplication functions #1940

Open
fredrik-johansson opened this issue Apr 30, 2024 · 4 comments
Open

Allow aliasing in all mpn multiplication functions #1940

fredrik-johansson opened this issue Apr 30, 2024 · 4 comments

Comments

@fredrik-johansson
Copy link
Collaborator

The hardcoded assembly versions do so, the FFT versions ought to do so automatically, and at intermediate sizes we could probably afford to stick in some pointer comparison and allocate temporary memory when needed.

@albinahlback
Copy link
Collaborator

albinahlback commented Apr 30, 2024

Hmm, not all functions allow aliasing. Whenever there is a loop involved, I believe it does not support aliasing (or it may do up to some specific iteration).

@albinahlback
Copy link
Collaborator

Generally, I think it is a bad idea performance-wise to try to allow aliasing for low-level multiplication functions.

@fredrik-johansson
Copy link
Collaborator Author

The point is that for small n, the hardcoded functions do support aliasing, so there is no performance hit on the mpn level. But functions like fmpz_mul and arf_mul currently waste time comparing pointers, allocating temp space and copying data since they don't know about this.

Similarly, functions like fmpz_mul waste memory handling aliasing for FFT-size operands.

@albinahlback
Copy link
Collaborator

I don't recall if the Arm semi-hardcoded multiplication routines allow for aliasing, but I'm pretty sure there is ranges there where aliasing is not allowed.

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

2 participants