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

Update SystemNative_AlignedAlloc to properly check aligned_alloc availability for Apple targets #54296

Closed
tannergooding opened this issue Jun 16, 2021 · 4 comments · Fixed by #94298

Comments

@tannergooding
Copy link
Member

#54006 introduced new NativeMemory APIs including one that wraps aligned_alloc where available.

On Apple targets this is only available on 10.15 or later but we currently target 10.13 and as such have a #if HAVE_ALIGNED_ALLOC && !defined(__APPLE__) check.

Ideally we would update this to correctly check for the availability of aligned_alloc (either via CMake magic or some existing Apple specific define) so we can light up on iOS, OSX, and Apple Silicon.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jun 16, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@filipnavara
Copy link
Member

Would it make sense to use __builtin_available and generate runtime check or is it not worth it?

@tannergooding
Copy link
Member Author

I don't think its worth it for this scenario. We are falling back to posix_memalign which is likely a wrapper for (or the underlying implementation of) aligned_alloc. Its simply just a matter of preferring the official C API when its available over the older POSIX API.

@filipnavara
Copy link
Member

filipnavara commented Jun 16, 2021

Makes sense. Thanks!

@jkotas jkotas added this to the Future milestone Jun 16, 2021
@jkotas jkotas removed the untriaged New issue has not been triaged by the area owner label Jun 16, 2021
jkotas added a commit to jkotas/runtime that referenced this issue Nov 2, 2023
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Nov 2, 2023
jkotas added a commit that referenced this issue Nov 14, 2023
* Enable aligned_alloc on macOS

Fixes #54296

Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Nov 14, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants