Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add VisionOS compatibility by adding missing type definitions #11019

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
Loading
from

Conversation

sinkingsugar
Copy link
Contributor

Fix visionOS compilation errors with legacy type definitions

The visionOS SDK doesn't include several legacy Unix type definitions that are present in other Apple platforms. Fixed compilation errors by:

  • Replaced u_int with unsigned int
  • Replaced uint with unsigned int

This allows the code to compile cleanly on visionOS while maintaining compatibility with other platforms. The changes are minimal and don't affect functionality, just addressing type definitions that aren't available in the modernized visionOS SDK.

Fixes compilation errors such as:

  • unknown type name 'u_int' in sys/ucred.h
  • unknown type name 'uint' in ggml calculations

…common and ggml source files. This update includes conditional type definitions for `u_int`, `u_char`, `u_short`, and `uint` to address legacy type issues on VisionOS across multiple files: common.cpp, ggml-backend.cpp, ggml-cpu.c, ggml-cpu.cpp, and ggml-metal.m.
@github-actions github-actions bot added ggml changes relating to the ggml tensor library for machine learning Apple Metal https://en.wikipedia.org/wiki/Metal_(API) labels Dec 30, 2024
ggerganov added a commit that referenced this pull request Jan 3, 2025
@ggerganov
Copy link
Member

In e7da954 I removed the uint instances from ggml-metal.m. For the rest of the errors, the proposed fix seems invalid since the code does not use types such as u_int or u_char. So there should be some alternative fix for this.

@sinkingsugar sinkingsugar changed the title Ass VisionOS compatibility by adding missing type definitions Add VisionOS compatibility by adding missing type definitions Jan 3, 2025
@sinkingsugar
Copy link
Contributor Author

sinkingsugar commented Jan 3, 2025

In e7da954 I removed the uint instances from ggml-metal.m. For the rest of the errors, the proposed fix seems invalid since the code does not use types such as u_int or u_char. So there should be some alternative fix for this.

Forgive my PR title btw.. generated.. or edited.. no idea what happened there hah!

What do you mean invalid? sure the code does not use it.. but apple code does. This does not fix anything in this codebase, it fixes issues within Apple codebase sadly. As I explained here The visionOS SDK doesn't include several legacy Unix type definitions that are present in other Apple platforms.
The issue arises because llama.cpp includes some headers apple has forgot to update/fix.

@sinkingsugar
Copy link
Contributor Author

The alternative is waiting apple to fix their own issues, which might take undefined amount of time vs few lines here.

@ggerganov
Copy link
Member

The fix is quite ugly, so I am looking for ways to avoid this. Could you first demonstrate the issue by adding a CI workflow for visionOS that fails? We already have one for tvOS, so I suppose it would not be too difficult to add one for visionOS. After we reproduce the errors, we can reconsider how to fix those.

@sinkingsugar
Copy link
Contributor Author

sinkingsugar commented Jan 3, 2025

The fix is quite ugly, so I am looking for ways to avoid this. Could you first demonstrate the issue by adding a CI workflow for visionOS that fails? We already have one for tvOS, so I suppose it would not be too difficult to add one for visionOS. After we reproduce the errors, we can reconsider how to fix those.

Done: #11065

PS: Consider github CI has an ancient version of Vision SDK, but I think the errors will come up nevertheless

tinglou pushed a commit to tinglou/llama.cpp that referenced this pull request Feb 13, 2025
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Feb 26, 2025
mglambda pushed a commit to mglambda/llama.cpp that referenced this pull request Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apple Metal https://en.wikipedia.org/wiki/Metal_(API) ggml changes relating to the ggml tensor library for machine learning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.