Is it possible to restrict the dependencies of 'mlx.metallib' at compile time?
I think that would be nice for embed devices
What dependencies are you trying to remove? You can build without metal -DMLX_BUILD_METAL=OFF when you run cmake if that's what you mean.
My main use case is tensor manipulation, but I need to leverage the advantages of universal memory to reduce the cost of memory copying. I wonder are there ways to avoid bundling mlx.metallib with the compiled binary?
Thinking about possible methods, an option is to just bundle the metal source code and have the metal framework compile everything on the fly from the source - this might add some runtime overhead though (but also you will only have compiled versions of the kernels that you are using, so that might be a benefit depending on the device)
Beyond that, it will have to depend on your use case and what dependancies you want to avoid
Thinking about possible methods, an option is to just bundle the metal source code and have the metal framework compile everything on the fly from the source - this might add some runtime overhead though (but also you will only have compiled versions of the kernels that you are using, so that might be a benefit depending on the device)
Beyond that, it will have to depend on your use case and what dependancies you want to avoid
I primarily want to use it for iOS/macOS apps. If I include mlx.metallib in the binary, it will make the installation package too large. I'm wondering if it's possible to specify the operations to be used during compilation and then generate mlx.metallib based on these operations.
@tqtifnypmb -- how were you able to include mlx.metallib into the app? I cannot do it. Please see my bug report here: https://github.com/ml-explore/mlx/issues/1286
P.S. You can make the binary much smaller if you don't pre-compile the shaders. See "Binary Size Minimization" here: https://ml-explore.github.io/mlx/build/html/install.html
@akuz
I can't recall what I did.
I just copy mlx.metallib next to the compiled executable file, not to framework nor resources dir as you mentioned in #1286.
and
I maybe (maybe not) changed METAL_PATH while compiling.