-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Embed Metal library source into compiled binary #1842
Conversation
enable by setting WHISPER_EMBED_METAL_LIBRARY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, that's a neat trick!
Is there a way to avoid the extra file ggml-metal-embed.s
?
For example, could it be part of ggml-metal.m
just surrounded by a specific define like GGML_METAL_BUILD_ASM
#ifndef GGML_METAL_BUILD_ASM
... ggml-metal.m source ...
#else
... ggml-metal-embed.s ...
#endif
Or something similar - just looking for ways to avoid the extra file
CMakeLists.txt
Outdated
@@ -68,6 +68,7 @@ if (APPLE) | |||
option(WHISPER_METAL_NDEBUG "whisper: disable Metal debugging" OFF) | |||
option(WHISPER_COREML "whisper: enable Core ML framework" OFF) | |||
option(WHISPER_COREML_ALLOW_FALLBACK "whisper: allow non-CoreML fallback" OFF) | |||
option(WHISPER_EMBED_METAL_LIBRARY "whisper: embed Metal library" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to WHISPER_METAL_EMBED_LIBRARY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated also the preprocessor directive name
It looks like it is not possible to embed this approach into Objective-C source, however if the aim is to avoid having another file in the source tree, I updated the build process so that the assembly is autogenerated during the build phase. |
* ggml : embed Metal library source (ggml-metal.metal) into binary enable by setting WHISPER_EMBED_METAL_LIBRARY * rename the build option * rename the preprocessor directive * generate Metal library embedding assembly on-fly during build process
* ggml : embed Metal library source (ggml-metal.metal) into binary enable by setting WHISPER_EMBED_METAL_LIBRARY * rename the build option * rename the preprocessor directive * generate Metal library embedding assembly on-fly during build process
* ggml : embed Metal library source (ggml-metal.metal) into binary enable by setting WHISPER_EMBED_METAL_LIBRARY * rename the build option * rename the preprocessor directive * generate Metal library embedding assembly on-fly during build process
* ggml : embed Metal library source (ggml-metal.metal) into binary enable by setting WHISPER_EMBED_METAL_LIBRARY * rename the build option * rename the preprocessor directive * generate Metal library embedding assembly on-fly during build process
* ggml : embed Metal library source (ggml-metal.metal) into binary enable by setting WHISPER_EMBED_METAL_LIBRARY * rename the build option * rename the preprocessor directive * generate Metal library embedding assembly on-fly during build process
This PR adds option to embed ggml-metal.metal file directly into exectuable.