Skip to content

Use aligned_alloc or _aligned_malloc #884

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 13, 2023
Merged

Use aligned_alloc or _aligned_malloc #884

merged 1 commit into from
Apr 13, 2023

Conversation

prusnak
Copy link
Collaborator

@prusnak prusnak commented Apr 10, 2023

Fixes #880

@sw
Copy link
Contributor

sw commented Apr 11, 2023

aligned_malloc requires the size to be a multiple of the alignment, which is probably fine for us. posix_memalign does not have that requirement.

Copy link
Member

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

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

Would be better to add a GGML_ALIGNED_MALLOC macro somewhere at the start to avoid cumbersome #if in the code

@prusnak
Copy link
Collaborator Author

prusnak commented Apr 13, 2023

Reworked the PR to use GGML_ALIGNED_MALLOC and GGML_ALIGNED_FREE macros.

which allows us to use aligned_alloc or _aligned_malloc functions
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use aligned_alloc() if aligned allocations are required
3 participants