Comments (13)
it could be possible metal argument buffers aren't supported in a VM environment? a simple check could justify that:
device->argumentBuffersSupport()
device must be a tier2 to support argument buffers.
from mlx.
We should be able to run on virtual devices once #683 lands!
from mlx.
I'll admit I don't have any experience using MacOS VMs on Parallels - do you have access to AppleSilicon GPUs on your VM ?
Running the command system_profiler SPDisplaysDataType
might help us figure out if there is a GPU with metal support
If there isn't metal support, then I'm afraid we won't be able to help you much further
from mlx.
system_profiler SPDisplaysDataType
doesn't report anything. Running llama.cpp with MPS support compiled in, it reports this:
ggml_metal_init: allocating
ggml_metal_init: found device: Apple Paravirtual device
ggml_metal_init: picking default device: Apple Paravirtual device
ggml_metal_init: default.metallib not found, loading from source
ggml_metal_init: loading '/Users/user/llama.cpp/ggml-metal.metal'
ggml_metal_init: GPU name: Apple Paravirtual device
ggml_metal_init: GPU family: MTLGPUFamilyApple5 (1005)
ggml_metal_init: hasUnifiedMemory = true
ggml_metal_init: recommendedMaxWorkingSetSize = 1024.00 MiB
ggml_metal_init: maxTransferRate = built-in GPU
Very basic usage of Metal, e.g. https://github.com/neurolabusc/Metal/blob/main/minimal run as expected, but more advanced examples e.g. https://github.com/neurolabusc/Metal/tree/main/mmul have errors (in that particular example, the MPSMultiplication results are all 0).
from mlx.
is this a VM running on Intel or Apple Silicon? your report says "hasUnifiedMemory: true" so, i'm assuming it's silicon?
from mlx.
Yes, it's a VM running on a M2 Pro.
from mlx.
Oh, if llama.cpp works, then it must just be a missing ArgumentEncoder function for virtual devices down a Metal Framework level rather than something bigger like I was worried about
Let me see if I can look into it any further, but since this is something on the Metal Framework level, I wouldn't expect a quick update
That said, we only use Metal Argument Encoders for Gather and Scatter primitives to do multi-dimensional indexing. It is needed since we have a container that holds multiple device buffers of indices that are all to be used by the kernel.
There is a possibility that someone can write a few simple cases of the Gather and Scatter primitives without a Metal Argument Buffer by just simply unrolling those containers into a different arguments
For anyone interested in looking into that, these 2 files would a starting point:
https://github.com/ml-explore/mlx/blob/main/mlx/backend/metal/indexing.cpp
https://github.com/ml-explore/mlx/blob/main/mlx/backend/metal/kernels/indexing.metal
from mlx.
I've confirmed that argumentBuffersSupport is reporting 0 in my MacOS VM.
from mlx.
if llama.cpp works
I wouldn't say that llama.cpp works - it detects the paravirtualized GPU, but it reports errors when attempting to offload any layers onto the GPU.
from mlx.
if llama.cpp works
I wouldn't say that llama.cpp works - it detects the paravirtualized GPU, but it reports errors when attempting to offload any layers onto the GPU.
In that case, unfortunately, it might be a larger issue of metal support on virtual devices - are you aware if a simple metal program is able to run on the machine ? Something like this maybe: https://developer.apple.com/documentation/metal/performing_calculations_on_a_gpu?language=objc
from mlx.
if its reporting 0 then its Tier1 and most probably arguments buffer apis won't work. well, it may work but there's just a lot of limitations
from mlx.
are you aware if a simple metal program is able to run on the machine ? Something like this maybe: https://developer.apple.com/documentation/metal/performing_calculations_on_a_gpu?language=objc
Yes, that program runs successfully:
user@Users-Virtual-Machine MetalComputeBasic % ./MetalComputeBasic
Compute results as expected
2023-12-11 10:11:22.711 MetalComputeBasic[656:4830] Execution finished
from mlx.
Yes, that program runs successfully:
Increasing the amount of memory usage makes this sample program fail in the VM (e.g. from const unsigned long arrayLength = 1 << 24;
to const unsigned long arrayLength = 1 << 27;
:
Compute ERROR: index=0 result=0 vs 0.216261=a+b
Assertion failed: (result[index] == (a[index] + b[index])), function -[MetalAdder verifyResults], file MetalAdder.m, line 158.
from mlx.
Related Issues (20)
- [BUG] arithmetic operations with numpy arrays are not commutative HOT 3
- [Feature] KANs HOT 1
- No module named 'mlx.core'; 'mlx' is not a package HOT 2
- 0.12.2 release was not completed HOT 8
- [FEATURE REQUEST] mx.grad doesn't alias argnums and argnames HOT 5
- [BUG] `np.ndarray` of bfloat16 using ml_dtypes is being interpreted as complex64
- [BUG] mlx crashes with msg - uncaught exception of type std::invalid_argument: [Scatter::eval_gpu] Does not support int64 HOT 4
- Is dlpack supported? HOT 9
- [BUG] matmul yields different results when using concat HOT 1
- [BUG] give better diagnostic message when calling compiled code with an eval in it -- currently "Attempting to eval an array without a primitive" HOT 8
- [BUG] Bad result for GPU matmul for specific shape HOT 1
- [Feature] Leak memory on exit HOT 6
- [Feature] Rotary Positional Embeddings for Nomic Embed HOT 2
- Enhancement - Use M series iPads as extra GPU power HOT 1
- [Feature] Expose something like custom VJP in Python HOT 3
- [BUG] mx.radians & mx.degrees - unexpected behavior when the input is not an array
- [Feature] Build flag to make safetensor and GGUF dependencies optional
- [Feature] something like `mlx.scipy.stats` HOT 2
- [BUG] Passing `axis=None` into `argpartition` causes `TypeError` HOT 1
- [BUG] AttributeError in mlx.core.conj and mlx.core.conjugate functions HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlx.