ml-explore/mlx

[Feature] block GPU access on iOS simulator

Opened this issue · 2 comments

Describe the bug
block GPU access on iOS simulator

See ml-explore/mlx-swift#269 and others. We have documented that MLX does not run on iOS simulators:

but you have to go looking for that. Right now you get a mysterious crash. What if we turned that into:

  • print to stderr
  • exception or abort
  • maybe calling a function named mlx_not_supported_on_simulator
  • all things to make it more obvious what is going on

This could be done with:

#include < TargetConditionals.h>

#if TARGET_OS_SIMULATOR
    // report the errors
#endif

Would we allow CPU on iOS simulator? Or none at all?

awni commented

I think it's a good idea to report the error as you point out.

Regarding allowing CPU on the sim -- generally MLX workloads are quite compute intensive and it's probably a good idea to just not allow the simulator for now (since it won't be a good experience on the CPU). But I'm open to suggestions there / if there is a compelling reason to add it that seems ok -- though maybe trickier to implement?

I was thinking it might be easier if we didn't allow anything to run on the simulator -- then we can just put it in the GPU Device.cpp and when it sets itself up it can trigger this. The other alternative is whenever something gets scheduled on the GPU device we would trigger this (that is probably closer to what we have today).