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

metal : build metallib + fix embed path #6015

Merged
merged 4 commits into from Mar 14, 2024
Merged

metal : build metallib + fix embed path #6015

merged 4 commits into from Mar 14, 2024

Conversation

ggerganov
Copy link
Owner

fix #5977

This should improve the build process following the changes in #5940:

  • CMake now always builds default.metallib
  • Fix LLAMA_METAL_EMBED_LIBRARY (Makefile + CMake) to work with the new ggml-common.h

@giladgd
Copy link
Contributor

giladgd commented Mar 12, 2024

This PR seems to have solved the issue on my end.
I suggest deleting ggml-metal.air, ggml-common.h and ggml-metal.metal from the output directory after building default.metallib since it seems that those files aren't necessary at runtime now.

@giladgd
Copy link
Contributor

giladgd commented Mar 12, 2024

Compiling with LLAMA_METAL_EMBED_LIBRARY now relies on default.metallib to exist at runtime

@ggerganov
Copy link
Owner Author

I believe I fixed it - would appreciate another test if you have the opportunity

@giladgd
Copy link
Contributor

giladgd commented Mar 12, 2024

I've tested your recent commit and now compiling with LLAMA_METAL_EMBED_LIBRARY fails at runtime with the original error:

ggml_metal_init: error: Error Domain=MTLLibraryErrorDomain Code=3 "program_source:3:10: fatal error: 'ggml-common.h' file not found
#include "ggml-common.h"
         ^~~~~~~~~~~~~~~
" UserInfo={NSLocalizedDescription=program_source:3:10: fatal error: 'ggml-common.h' file not found
#include "ggml-common.h"
         ^~~~~~~~~~~~~~~
}
llama_new_context_with_model: failed to initialize Metal backend

@ggerganov ggerganov merged commit 381da2d into master Mar 14, 2024
54 of 62 checks passed
NeoZhangJianyu pushed a commit to NeoZhangJianyu/llama.cpp that referenced this pull request Mar 15, 2024
* metal : build metallib + fix embed path

ggml-ci

* metal : fix embed build + update library load logic

ggml-ci

* metal : fix embeded library build

ggml-ci

* ci : fix iOS builds to use embedded library
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
* metal : build metallib + fix embed path

ggml-ci

* metal : fix embed build + update library load logic

ggml-ci

* metal : fix embeded library build

ggml-ci

* ci : fix iOS builds to use embedded library
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

Successfully merging this pull request may close these issues.

'ggml-common.h' file not found when running as shared library and using metal
2 participants