mirror of
https://github.com/ml-explore/mlx.git
synced 2025-06-24 09:21:16 +08:00
Fix swift pm load (#2117)
This commit is contained in:
parent
86984cad68
commit
f0e70afff0
@ -69,8 +69,8 @@ MTL::Library* try_load_bundle(
|
|||||||
if (bundle != nullptr) {
|
if (bundle != nullptr) {
|
||||||
std::string resource_path =
|
std::string resource_path =
|
||||||
std::string(bundle->resourceURL()->fileSystemRepresentation()) + "/" +
|
std::string(bundle->resourceURL()->fileSystemRepresentation()) + "/" +
|
||||||
lib_name + ".metallib" auto [lib, error] =
|
lib_name + ".metallib";
|
||||||
load_library_from_path(device, resource_path.c_str());
|
auto [lib, error] = load_library_from_path(device, resource_path.c_str());
|
||||||
if (lib) {
|
if (lib) {
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ std::pair<MTL::Library*, NS::Error*> load_swiftpm_library(
|
|||||||
auto bundles = NS::Bundle::allBundles();
|
auto bundles = NS::Bundle::allBundles();
|
||||||
for (int i = 0, c = (int)bundles->count(); i < c; i++) {
|
for (int i = 0, c = (int)bundles->count(); i < c; i++) {
|
||||||
auto bundle = reinterpret_cast<NS::Bundle*>(bundles->object(i));
|
auto bundle = reinterpret_cast<NS::Bundle*>(bundles->object(i));
|
||||||
library = try_load_bundle(device, bundle->resourceURL());
|
library = try_load_bundle(device, bundle->resourceURL(), lib_name);
|
||||||
if (library != nullptr) {
|
if (library != nullptr) {
|
||||||
return {library, nullptr};
|
return {library, nullptr};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user