mlx-swift
mlx-swift copied to clipboard
Adding mlx-swift to a Playgrounds project on iPad
Hi. I was trying to add mlx-swift package to a Playgrounds project on my M1 iPad. I get a this log:
Could not resolve package graph. Cannot continue.
unknownError(PlaygroundExecution.ConsoleReadingExecutionOperation.OperationError.failed(PlaygroundExecution.ExecutionError.remoteProcessWasInterrupted, Optional(["SignalNumber": 5, "ThreadInfoDictionaries": <__NSFrozenArrayM 0x3053fe190>(
{
DispatchQueueName = "com.apple.main-thread";
StackFrameDictionaries = (
{
CrashAnnotationMessage = "PackageDescription/Context.swift:19: Fatal error: 'try!' expression unexpectedly raised an error: Could not decode ContextModel parameter.\n";
StackFrameModule = "libswiftCore.dylib";
StackFramePC = 6877108416;
StackFrameSymbolName = "_$ss17_assertionFailure__4file4line5flagss5NeverOs12StaticStringV_SSAHSus6UInt32VtF";
},
{
CrashAnnotationMessage = "PackageDescription/Context.swift:19: Fatal error: 'try!' expression unexpectedly raised an error: Could not decode ContextModel parameter.\n";
StackFrameModule = "libswiftCore.dylib";
StackFramePC = 6877560084;
StackFrameSymbolName = "_swift_unexpectedError";
},
{
StackFrameModule = "libPackageDescription.dylib";
StackFramePC = 4409249908;
StackFrameSymbolName = "_$s18PackageDescription7ContextV5model33_16EFAD36DA072BCD1C8EFF86E7A18833LL_WZ";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034166740;
StackFrameSymbolName = "__dispatch_client_callout";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034173012;
StackFrameSymbolName = "__dispatch_once_callout";
},
{
StackFrameModule = "libPackageDescription.dylib";
StackFramePC = 4409250168;
StackFrameSymbolName = "_$s18PackageDescription7ContextV11environmentSDyS2SGvgZ";
},
{
StackFrameModule = "manifest_dzhhithcwvkymreztxsgzdonmnyv";
StackFramePC = 4343688296;
StackFrameSymbolName = "_main";
},
{
StackFrameModule = ExecutionExtension;
StackFramePC = 4337845880;
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901247132;
StackFrameSymbolName = "___CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901173740;
StackFrameSymbolName = "___CFRunLoopDoBlocks";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901171352;
StackFrameSymbolName = "___CFRunLoopRun";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901169368;
StackFrameSymbolName = "_CFRunLoopRunSpecific";
},
{
StackFrameModule = GraphicsServices;
StackFramePC = 8057422248;
StackFrameSymbolName = "_GSEventRunModal";
},
{
StackFrameModule = UIKitCore;
StackFramePC = 6941247756;
StackFrameSymbolName = "-[UIApplication _run]";
},
{
StackFrameModule = UIKitCore;
StackFramePC = 6941985232;
StackFrameSymbolName = "_UIApplicationMain";
},
{
StackFrameModule = "libxpc.dylib";
StackFramePC = 8459608772;
StackFrameSymbolName = "__xpc_objc_uimain";
},
{
StackFrameModule = "libxpc.dylib";
StackFramePC = 8459608256;
StackFrameSymbolName = "__xpc_objc_main";
},
{
StackFrameModule = "libxpc.dylib";
StackFramePC = 8459618076;
StackFrameSymbolName = "__xpc_main";
},
{
StackFrameModule = "libxpc.dylib";
StackFramePC = 8459618556;
StackFrameSymbolName = "_xpc_main";
},
{
StackFrameModule = Foundation;
StackFramePC = 6884238348;
StackFrameSymbolName = "-[NSXPCListener resume]";
},
{
StackFrameModule = PlugInKit;
StackFramePC = 7642701416;
},
{
StackFrameModule = PlugInKit;
StackFramePC = 7642701044;
},
{
StackFrameModule = PlugInKit;
StackFramePC = 7642700208;
},
{
StackFrameModule = PlugInKit;
StackFramePC = 7642702276;
},
{
StackFrameModule = ExtensionFoundation;
StackFramePC = 7153228784;
StackFrameSymbolName = "_EXExtensionMain";
},
{
StackFrameModule = Foundation;
StackFramePC = 6884812812;
StackFrameSymbolName = "_NSExtensionMain";
},
{
StackFrameModule = dyld;
StackFramePC = 7495392844;
StackFrameSymbolName = start;
}
);
ThreadCrashed = 1;
ThreadID = 8664217;
ThreadIsMain = 1;
},
{
StackFrameDictionaries = (
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126416272;
StackFrameSymbolName = "___workq_kernreturn";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459233664;
StackFrameSymbolName = "__pthread_wqthread";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459219148;
StackFrameSymbolName = "_start_wqthread";
}
);
ThreadID = 8664218;
},
{
DispatchQueueName = "com.apple.root.user-initiated-qos";
StackFrameDictionaries = (
{
StackFrameModule = CoreFoundation;
StackFramePC = 6906245136;
StackFrameSymbolName = "_objc_msgSend$bytes";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901321700;
StackFrameSymbolName = "__CFPropertyListCreateFiltered";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901707248;
StackFrameSymbolName = "__CFBundleGetLocTableProvenanceForLanguage";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901538004;
StackFrameSymbolName = "__CFBundleGetStringsSources";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901148400;
StackFrameSymbolName = "__copyStringTable";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901136016;
StackFrameSymbolName = "__CFBundleCopyLocalizedStringForLocalizationTableURLAndMarkdownOption";
},
{
StackFrameModule = Foundation;
StackFramePC = 6883003008;
StackFrameSymbolName = "-[NSBundle localizedStringForKey:value:table:]";
},
{
StackFrameModule = PencilKit;
StackFramePC = 7891695412;
StackFrameSymbolName = "+[PKTiledCanvasView prewarmFutureCanvasesIfNecessarySecureRendering:prewarmSharedResourceHandler:]";
},
{
StackFrameModule = PencilKit;
StackFramePC = 7892939312;
StackFrameSymbolName = "+[PKTextInputCanvasController prewarmFutureCanvasesIfNecessarySecureRendering:]";
},
{
StackFrameModule = PencilKit;
StackFramePC = 7892344356;
StackFrameSymbolName = "___40-[PKTextInputInteraction didMoveToView:]_block_invoke.32";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034159420;
StackFrameSymbolName = "__dispatch_call_block_and_release";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034166740;
StackFrameSymbolName = "__dispatch_client_callout";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034239596;
StackFrameSymbolName = "__dispatch_root_queue_drain";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034241180;
StackFrameSymbolName = "__dispatch_worker_thread2";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459233528;
StackFrameSymbolName = "__pthread_wqthread";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459219148;
StackFrameSymbolName = "_start_wqthread";
}
);
ThreadID = 8664219;
},
{
StackFrameDictionaries = (
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126416272;
StackFrameSymbolName = "___workq_kernreturn";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459233664;
StackFrameSymbolName = "__pthread_wqthread";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459219148;
StackFrameSymbolName = "_start_wqthread";
}
);
ThreadID = 8664220;
},
{
DispatchQueueName = "com.apple.root.user-initiated-qos";
StackFrameDictionaries = (
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126441996;
StackFrameSymbolName = "___mmap";
},
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126441884;
StackFrameSymbolName = "_mmap";
},
{
StackFrameModule = Foundation;
StackFramePC = 6883127700;
StackFrameSymbolName = "__NSReadBytesFromFileWithExtendedAttributes";
},
{
StackFrameModule = Foundation;
StackFramePC = 6883454156;
StackFrameSymbolName = "-[_NSBPlistMappedData initWithFileURL:error:]";
},
{
StackFrameModule = Foundation;
StackFramePC = 6883453928;
StackFrameSymbolName = "___NSCreateBPlistMappedDataFromURL";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901855768;
StackFrameSymbolName = "__CFBundleMapBPlistFile";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901536728;
StackFrameSymbolName = "__CFBundleGetStringsSources";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901148400;
StackFrameSymbolName = "__copyStringTable";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901136016;
StackFrameSymbolName = "__CFBundleCopyLocalizedStringForLocalizationTableURLAndMarkdownOption";
},
{
StackFrameModule = Foundation;
StackFramePC = 6883003008;
StackFrameSymbolName = "-[NSBundle localizedStringForKey:value:table:]";
},
{
StackFrameModule = PencilKit;
StackFramePC = 7891695412;
StackFrameSymbolName = "+[PKTiledCanvasView prewarmFutureCanvasesIfNecessarySecureRendering:prewarmSharedResourceHandler:]";
},
{
StackFrameModule = PencilKit;
StackFramePC = 7892939312;
StackFrameSymbolName = "+[PKTextInputCanvasController prewarmFutureCanvasesIfNecessarySecureRendering:]";
},
{
StackFrameModule = PencilKit;
StackFramePC = 7892344356;
StackFrameSymbolName = "___40-[PKTextInputInteraction didMoveToView:]_block_invoke.32";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034159420;
StackFrameSymbolName = "__dispatch_call_block_and_release";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034166740;
StackFrameSymbolName = "__dispatch_client_callout";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034239596;
StackFrameSymbolName = "__dispatch_root_queue_drain";
},
{
StackFrameModule = "libdispatch.dylib";
StackFramePC = 7034241180;
StackFrameSymbolName = "__dispatch_worker_thread2";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459233528;
StackFrameSymbolName = "__pthread_wqthread";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459219148;
StackFrameSymbolName = "_start_wqthread";
}
);
ThreadID = 8664221;
},
{
StackFrameDictionaries = (
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126416904;
StackFrameSymbolName = "_mach_msg2_trap";
},
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126431240;
StackFrameSymbolName = "_mach_msg2_internal";
},
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126431008;
StackFrameSymbolName = "_mach_msg_overwrite";
},
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126430560;
StackFrameSymbolName = "_mach_msg";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901174108;
StackFrameSymbolName = "___CFRunLoopServiceMachPort";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901171712;
StackFrameSymbolName = "___CFRunLoopRun";
},
{
StackFrameModule = CoreFoundation;
StackFramePC = 6901169368;
StackFrameSymbolName = "_CFRunLoopRunSpecific";
},
{
StackFrameModule = Foundation;
StackFramePC = 6883479116;
StackFrameSymbolName = "-[NSRunLoop(NSRunLoop) runMode:beforeDate:]";
},
{
StackFrameModule = Foundation;
StackFramePC = 6883478684;
StackFrameSymbolName = "-[NSRunLoop(NSRunLoop) runUntilDate:]";
},
{
StackFrameModule = UIKitCore;
StackFramePC = 6941328960;
StackFrameSymbolName = "-[UIEventFetcher threadMain]";
},
{
StackFrameModule = Foundation;
StackFramePC = 6883571480;
StackFrameSymbolName = "___NSThread__start__";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459239532;
StackFrameSymbolName = "__pthread_start";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459219160;
StackFrameSymbolName = "_thread_start";
}
);
ThreadID = 8664222;
ThreadName = "com.apple.uikit.eventfetch-thread";
},
{
StackFrameDictionaries = (
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126416272;
StackFrameSymbolName = "___workq_kernreturn";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459233664;
StackFrameSymbolName = "__pthread_wqthread";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459219148;
StackFrameSymbolName = "_start_wqthread";
}
);
ThreadID = 8664223;
},
{
StackFrameDictionaries = (
{
StackFrameModule = "libsystem_kernel.dylib";
StackFramePC = 8126416272;
StackFrameSymbolName = "___workq_kernreturn";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459233664;
StackFrameSymbolName = "__pthread_wqthread";
},
{
StackFrameModule = "libsystem_pthread.dylib";
StackFramePC = 8459219148;
StackFrameSymbolName = "_start_wqthread";
}
);
ThreadID = 8664224;
}
)
, "CrashCatcherPID": 31926, "ExceptionType": 6, "ExceptionData": <01000000 00000000 c058e899 01000000>]))) in https://github.com/ml-explore/mlx-swift.git
I don't think this is going to work to build on an iPad -- there are a lot of C, C++ and metal shader pieces to this. These won't build on an iPad. You should be able to make a playground on macOS, but you might need to wrap the libraries in a Framework. See #89
Why there is no way to run MLX on the iPad Pro M4? It’s like having a Ferrari and not being able to use it!
You can easily run it on an iPad -- you just can't build it on an iPad (which is what this is trying to do). Check out:
- https://github.com/ml-explore/mlx-swift-examples
That is full of example applications that you can build on your Mac and run on your iPad.