Skip to content

Commit 1cff8e4

Browse files
mkopcinsMateusz Kopciński
andcommitted
feat: added configurable num of threads for xnnpack to fix android performance (#534)
## Description After migrating llms to cpp architecture we saw significant drop in performance (up to 10x slower). After debugging the main culprit turned out to be the number of threads spawned for xnnpack threadpool, which defaulted to the number of cores (the underlying reason is still unknown). ### Introduces a breaking change? - [x] Yes - migrating back to cpp architecture for llms - [ ] No ### Type of change - [x] Bug fix (change which fixes an issue) - [x] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [ ] Other (chores, tests, code style improvements etc.) ### Tested on - [x] iOS - [x] Android ### Testing instructions <!-- Provide step-by-step instructions on how to test your changes. Include setup details if necessary. --> ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues <!-- Link related issues here using #issue-number --> ### Checklist - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [ ] My changes generate no new warnings ### Additional notes <!-- Include any additional information, assumptions, or context that reviewers might need to understand this PR. --> --------- Co-authored-by: Mateusz Kopciński <mateusz.kopcinski@swmansnion.com>
1 parent 9cb5f03 commit 1cff8e4

File tree

98 files changed

+5027
-2115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+5027
-2115
lines changed

apps/llm/ios/Podfile.lock

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,9 +2153,9 @@ PODS:
21532153
- ReactCommon/turbomodule/core
21542154
- Yoga
21552155
- SocketRocket (0.7.1)
2156-
- sqlite3 (3.50.4):
2157-
- sqlite3/common (= 3.50.4)
2158-
- sqlite3/common (3.50.4)
2156+
- sqlite3 (3.50.1):
2157+
- sqlite3/common (= 3.50.1)
2158+
- sqlite3/common (3.50.1)
21592159
- Yoga (0.0.0)
21602160

21612161
DEPENDENCIES:
@@ -2444,97 +2444,97 @@ EXTERNAL SOURCES:
24442444
SPEC CHECKSUMS:
24452445
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
24462446
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
2447-
EXConstants: 9f310f44bfedba09087042756802040e464323c0
2448-
Expo: 4e8bda07d30b024b1732f87843a5349a3ecc1316
2449-
ExpoAsset: 3bc9adb7dbbf27ae82c18ca97eb988a3ae7e73b1
2450-
ExpoBrightness: c335c6ccc082d5249a4b38dba5cd9a08aa0bf62b
2451-
ExpoCalendar: f5f94ea8dcd957b1434beb4e1c0da1af063322e6
2452-
ExpoFileSystem: c36eb8155eb2381c83dda7dc210e3eec332368b6
2453-
ExpoFont: abbb91a911eb961652c2b0a22eef801860425ed6
2454-
ExpoHead: af044f3e9c99e7d8d21bf653b4c2f2ef53a7f082
2455-
ExpoKeepAwake: bf0811570c8da182bfb879169437d4de298376e7
2456-
ExpoLinking: b85ff4eafeae6fc638c6cace60007ae521af0ef4
2457-
ExpoModulesCore: d431ffe83c8673d02cb38425594a5f5480fd3061
2447+
EXConstants: be238322d57d084dc055dbd5d6fe6479510504ce
2448+
Expo: 77b39f42396989cbe6fbef9f6fafc9b35186a95b
2449+
ExpoAsset: 3ea3275cca6a7793b3d36fbf1075c590f803fbcb
2450+
ExpoBrightness: 05e750736f8886dcf235212b0caf85b0f605fc88
2451+
ExpoCalendar: 660542dc1c5ef98f46bedcc8745aa707df5d501a
2452+
ExpoFileSystem: 3a98ca2a6f13674ecfd97327d1b44a8ace444cbd
2453+
ExpoFont: 312c73403bbd4f98e1d6a5330641a56292583cd2
2454+
ExpoHead: 5df88545652c2d3a3ea50bcd7f6be6ca935ac997
2455+
ExpoKeepAwake: e8dedc115d9f6f24b153ccd2d1d8efcdfd68a527
2456+
ExpoLinking: 5d151d4a497d7e375308602f0a89b4e8acf7b5f8
2457+
ExpoModulesCore: e2e363bcdee87b46f858586d1887ebb215582001
24582458
fast_float: 06eeec4fe712a76acc9376682e4808b05ce978b6
24592459
FBLazyVector: 84b955f7b4da8b895faf5946f73748267347c975
24602460
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
24612461
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
24622462
hermes-engine: 314be5250afa5692b57b4dd1705959e1973a8ebe
24632463
opencv-rne: 2305807573b6e29c8c87e3416ab096d09047a7a0
2464-
RCT-Folly: e78785aa9ba2ed998ea4151e314036f6c49e6d82
2464+
RCT-Folly: 36fe2295e44b10d831836cc0d1daec5f8abcf809
24652465
RCTDeprecation: 83ffb90c23ee5cea353bd32008a7bca100908f8c
24662466
RCTRequired: eb7c0aba998009f47a540bec9e9d69a54f68136e
24672467
RCTTypeSafety: 659ae318c09de0477fd27bbc9e140071c7ea5c93
24682468
React: c2d3aa44c49bb34e4dfd49d3ee92da5ebacc1c1c
24692469
React-callinvoker: 1bdfb7549b5af266d85757193b5069f60659ef9d
2470-
React-Core: 10597593fdbae06f0089881e025a172e51d4a769
2471-
React-CoreModules: 6907b255529dd46895cf687daa67b24484a612c2
2472-
React-cxxreact: a9f5b8180d6955bc3f6a3fcd657c4d9b4d95c1f6
2470+
React-Core: 7150cf9b6a5af063b37003062689f1691e79c020
2471+
React-CoreModules: 15a85e6665d61678942da6ae485b351f4c699049
2472+
React-cxxreact: 74f9de59259ac951923f5726aa14f0398f167af9
24732473
React-debug: e74e76912b91e08d580c481c34881899ccf63da9
2474-
React-defaultsnativemodule: 11f6ee2cf69bf3af9d0f28a6253def33d21b5266
2475-
React-domnativemodule: f940bbc4fa9e134190acbf3a4a9f95621b5a8f51
2476-
React-Fabric: 6f5c357bf3a42ff11f8844ad3fc7a1eb04f4b9de
2477-
React-FabricComponents: 10e0c0209822ac9e69412913a8af1ca33573379b
2478-
React-FabricImage: f582e764072dfa4715ae8c42979a5bace9cbcc12
2474+
React-defaultsnativemodule: 628285212bbd65417d40ad6a9f8781830fda6c98
2475+
React-domnativemodule: 185d9808198405c176784aaf33403d713bd24fb7
2476+
React-Fabric: c814804affbe1952e16149ddd20256e1bccae67e
2477+
React-FabricComponents: 81ef47d596966121784afec9924f9562a29b1691
2478+
React-FabricImage: f14f371d678aa557101def954ac3ba27e48948ff
24792479
React-featureflags: d5facceff8f8f6de430e0acecf4979a9a0839ba9
2480-
React-featureflagsnativemodule: a7dd141f1ef4b7c1331af0035689fbc742a49ff4
2481-
React-graphics: 36ae3407172c1c77cea29265d2b12b90aaef6aa0
2482-
React-hermes: 9116d4e6d07abeb519a2852672de087f44da8f12
2483-
React-idlecallbacksnativemodule: ae7f5ffc6cf2d2058b007b78248e5b08172ad5c3
2484-
React-ImageManager: 9daee0dc99ad6a001d4b9e691fbf37107e2b7b54
2485-
React-jserrorhandler: 1e6211581071edaf4ecd5303147328120c73f4dc
2486-
React-jsi: 753ba30c902f3a41fa7f956aca8eea3317a44ee6
2487-
React-jsiexecutor: 47520714aa7d9589c51c0f3713dfbfca4895d4f9
2488-
React-jsinspector: cfd27107f6d6f1076a57d88c932401251560fe5f
2489-
React-jsinspectortracing: 76a7d791f3c0c09a0d2bf6f46dfb0e79a4fcc0ac
2490-
React-jsitooling: 995e826570dd58f802251490486ebd3244a037ab
2491-
React-jsitracing: 094ae3d8c123cea67b50211c945b7c0443d3e97b
2492-
React-logger: 8edfcedc100544791cd82692ca5a574240a16219
2493-
React-Mapbuffer: c3f4b608e4a59dd2f6a416ef4d47a14400194468
2494-
React-microtasksnativemodule: 054f34e9b82f02bd40f09cebd4083828b5b2beb6
2495-
react-native-executorch: 88c3786c6346d5fbd62417b5c799e818568e6cc5
2496-
react-native-safe-area-context: 562163222d999b79a51577eda2ea8ad2c32b4d06
2497-
React-NativeModulesApple: 2c4377e139522c3d73f5df582e4f051a838ff25e
2480+
React-featureflagsnativemodule: 96f0ab285382d95c90f663e02526a5ceefa95a11
2481+
React-graphics: 1a66ee0a3f093b125b853f6370296fadcaf6f233
2482+
React-hermes: 8b86e5f54a65ecb69cdf22b3a00a11562eda82d2
2483+
React-idlecallbacksnativemodule: 5c25ab145c602264d00cb26a397ab52e0efa031c
2484+
React-ImageManager: 15e34bd5ef1ac4a18e96660817ef70a7f99ee8c2
2485+
React-jserrorhandler: 02cdf2cd45350108be1ffd2b164578936dbbdff7
2486+
React-jsi: 6af1987cfbb1b6621664fdbf6c7b62bd4d38c923
2487+
React-jsiexecutor: 51f372998e0303585cb0317232b938d694663cbd
2488+
React-jsinspector: 3539ad976d073bfaa8a7d2fa9bef35e70e55033e
2489+
React-jsinspectortracing: e8dbacaf67c201f23052ca1c2bae2f7b84dec443
2490+
React-jsitooling: 95a34f41e3c249d42181de13b4f8d854f178ca9f
2491+
React-jsitracing: 25b029cf5cad488252d46da19dd8c4c134fd5fe4
2492+
React-logger: 368570a253f00879a1e4fea24ed4047e72e7bbf3
2493+
React-Mapbuffer: c04fcda1c6281fc0a6824c7dcc1633dd217ac1ec
2494+
React-microtasksnativemodule: ca2804a25fdcefffa0aa942aa23ab53b99614a34
2495+
react-native-executorch: 66ffc33df70ec85bc591f9ee34c862835966ead3
2496+
react-native-safe-area-context: 00d03dc688ba86664be66f9e3f203fc7d747d899
2497+
React-NativeModulesApple: 452b86b29fae99ed0a4015dca3ad9cd222f88abf
24982498
React-oscompat: ef5df1c734f19b8003e149317d041b8ce1f7d29c
2499-
React-perflogger: 9a151e0b4c933c9205fd648c246506a83f31395d
2500-
React-performancetimeline: 5b0dfc0acba29ea0269ddb34cd6dd59d3b8a1c66
2499+
React-perflogger: 6fd2f6811533e9c19a61e855c3033eecbf4ad2a0
2500+
React-performancetimeline: abf31259d794c9274b3ea19c5016186925eec6c4
25012501
React-RCTActionSheet: a499b0d6d9793886b67ba3e16046a3fef2cdbbc3
2502-
React-RCTAnimation: cc64adc259aabc3354b73065e2231d796dfce576
2503-
React-RCTAppDelegate: 9d523da768f1c9e84c5f3b7e3624d097dfb0e16b
2504-
React-RCTBlob: e727f53eeefded7e6432eb76bd22b57bc880e5d1
2505-
React-RCTFabric: 58590aa4fdb4ad546c06a7449b486cf6844e991f
2506-
React-RCTFBReactNativeSpec: 9064c63d99e467a3893e328ba3612745c3c3a338
2507-
React-RCTImage: 7159cbdbb18a09d97ba1a611416eced75b3ccb29
2508-
React-RCTLinking: 46293afdb859bccc63e1d3dedc6901a3c04ef360
2509-
React-RCTNetwork: 4a6cd18f5bcd0363657789c64043123a896b1170
2510-
React-RCTRuntime: 5ab904fd749aa52f267ef771d265612582a17880
2511-
React-RCTSettings: 61e361dc85136d1cb0e148b7541993d2ee950ea7
2512-
React-RCTText: abd1e196c3167175e6baef18199c6d9d8ac54b4e
2513-
React-RCTVibration: 490e0dcb01a3fe4a0dfb7bc51ad5856d8b84f343
2502+
React-RCTAnimation: 2595dcb10a82216a511b54742f8c28d793852ac6
2503+
React-RCTAppDelegate: f03604b70f57c9469a84a159d8abecf793a5bcff
2504+
React-RCTBlob: e00f9b4e2f151938f4d9864cf33ebf24ac03328a
2505+
React-RCTFabric: 3945d116fd271598db262d4e6ed5691d431ed9e8
2506+
React-RCTFBReactNativeSpec: 0f4d4f0da938101f2ca9d5333a8f46e527ad2819
2507+
React-RCTImage: dac5e9f8ec476aefe6e60ee640ebc1dfaf1a4dbe
2508+
React-RCTLinking: 494b785a40d952a1dfbe712f43214376e5f0e408
2509+
React-RCTNetwork: b3d7c30cd21793e268db107dd0980cb61b3c1c44
2510+
React-RCTRuntime: a8ff419d437228e7b8a793b14f9d711e1cbb82af
2511+
React-RCTSettings: a060c7e381a3896104761b8eed7e284d95e37df3
2512+
React-RCTText: 4f272b72dbb61f390d8c8274528f9fdbff983806
2513+
React-RCTVibration: 0e5326220719aca12473d703aa46693e3b4ce67a
25142514
React-rendererconsistency: 351fdbc5c1fe4da24243d939094a80f0e149c7a1
2515-
React-renderercss: 3438814bee838ae7840a633ab085ac81699fd5cf
2516-
React-rendererdebug: 0ac2b9419ad6f88444f066d4b476180af311fb1e
2515+
React-renderercss: d333f2ada83969591100d91ec6b23ca2e17e1507
2516+
React-rendererdebug: 039e5949b72ba63c703de020701e3fd152434c61
25172517
React-rncore: 57ed480649bb678d8bdc386d20fee8bf2b0c307c
2518-
React-RuntimeApple: 8b7a9788f31548298ba1990620fe06b40de65ad7
2519-
React-RuntimeCore: e03d96fbd57ce69fd9bca8c925942194a5126dbc
2518+
React-RuntimeApple: 344a5e1105256000afabaa8df12c3e4cab880340
2519+
React-RuntimeCore: 0e48fb5e5160acc0334c7a723a42d42cef4b58b6
25202520
React-runtimeexecutor: d60846710facedd1edb70c08b738119b3ee2c6c2
2521-
React-RuntimeHermes: aab794755d9f6efd249b61f3af4417296904e3ba
2522-
React-runtimescheduler: c3cd124fa5db7c37f601ee49ca0d97019acd8788
2521+
React-RuntimeHermes: 064286a03871d932c99738e0f8ef854962ab4b99
2522+
React-runtimescheduler: e917ab17ae08c204af1ebf8f669b7e411b0220c8
25232523
React-timing: a90f4654cbda9c628614f9bee68967f1768bd6a5
2524-
React-utils: a612d50555b6f0f90c74b7d79954019ad47f5de6
2525-
ReactAppDependencyProvider: 04d5eb15eb46be6720e17a4a7fa92940a776e584
2526-
ReactCodegen: 7ea266ccd94436294f516247db7402b57b1214af
2527-
ReactCommon: 76d2dc87136d0a667678668b86f0fca0c16fdeb0
2528-
RNAudioAPI: 2e3fd4bf75aa5717791babb30126707504996f09
2529-
RNDeviceInfo: d863506092aef7e7af3a1c350c913d867d795047
2530-
RNGestureHandler: 7d0931a61d7ba0259f32db0ba7d0963c3ed15d2b
2531-
RNLiveAudioStream: 93ac2bb6065be9018d0b00157b220f11cebc1513
2532-
RNReanimated: afd6a269a47d6f13ba295c46c6c0e14e3cbd0d8a
2533-
RNScreens: 482e9707f9826230810c92e765751af53826d509
2534-
RNSVG: 794f269526df9ddc1f79b3d1a202b619df0368e3
2524+
React-utils: 51c4e71608b8133fecc9a15801d244ae7bdf3758
2525+
ReactAppDependencyProvider: d5dcc564f129632276bd3184e60f053fcd574d6b
2526+
ReactCodegen: c9a256facbe4996140f3fb95c7f03ba61c12acc9
2527+
ReactCommon: 4d0da92a5eb8da86c08e3ec34bd23ab439fb2461
2528+
RNAudioAPI: f93e51adeee0911c8c6629a56f6df35edc60c084
2529+
RNDeviceInfo: feea80a690d2bde1fe51461cf548039258bd03f2
2530+
RNGestureHandler: ccf4105b125002bd88e39d2a1f2b7e6001bcdf34
2531+
RNLiveAudioStream: 02584d52711b6b9f268cb371a4b1bdd76ab3e079
2532+
RNReanimated: c567de23384730756bb19ff55490819980536b09
2533+
RNScreens: c2e3cc506212228c607b4785b315205e28acbf0f
2534+
RNSVG: ee32efbed652c5151fd3f98bed13c68af285bc38
25352535
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
2536-
sqlite3: 73513155ec6979715d3904ef53a8d68892d4032b
2537-
Yoga: c758bfb934100bb4bf9cbaccb52557cee35e8bdf
2536+
sqlite3: 1d85290c3321153511f6e900ede7a1608718bbd5
2537+
Yoga: 9f110fc4b7aa538663cba3c14cbb1c335f43c13f
25382538

25392539
PODFILE CHECKSUM: bba19a069e673f2259009e9d2caab44374fdebcf
25402540

apps/llm/ios/llm.xcodeproj/project.pbxproj

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
63C842393C3838DA2ECEFC7C /* Pods-llm.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-llm.release.xcconfig"; path = "Target Support Files/Pods-llm/Pods-llm.release.xcconfig"; sourceTree = "<group>"; };
2727
8CD8BF58A368F789F1E7DF50 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-llm/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
2828
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = llm/SplashScreen.storyboard; sourceTree = "<group>"; };
29-
B79E360E00239D910BF9B38D /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = llm/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
29+
B79E360E00239D910BF9B38D /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = llm/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3030
BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = "<group>"; };
31-
E8C01EF33FCE4105BBBC9DF6 /* Aeonik-Medium.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Aeonik-Medium.otf"; path = "../assets/fonts/Aeonik-Medium.otf"; sourceTree = "<group>"; };
31+
E8C01EF33FCE4105BBBC9DF6 /* Aeonik-Medium.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Aeonik-Medium.otf"; path = "../assets/fonts/Aeonik-Medium.otf"; sourceTree = "<group>"; };
3232
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
3333
F11748412D0307B40044C1D9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = llm/AppDelegate.swift; sourceTree = "<group>"; };
3434
F11748442D0722820044C1D9 /* llm-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "llm-Bridging-Header.h"; path = "llm/llm-Bridging-Header.h"; sourceTree = "<group>"; };
3535
F5CE0775ADE5923FA417B603 /* libPods-llm.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-llm.a"; sourceTree = BUILT_PRODUCTS_DIR; };
36-
F866B7979FB94C8797EE2E3D /* Aeonik-Regular.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Aeonik-Regular.otf"; path = "../assets/fonts/Aeonik-Regular.otf"; sourceTree = "<group>"; };
36+
F866B7979FB94C8797EE2E3D /* Aeonik-Regular.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Aeonik-Regular.otf"; path = "../assets/fonts/Aeonik-Regular.otf"; sourceTree = "<group>"; };
3737
/* End PBXFileReference section */
3838

3939
/* Begin PBXFrameworksBuildPhase section */
@@ -93,6 +93,7 @@
9393
4F489A14802F01369BFDDEFD /* Pods-llm.debug.xcconfig */,
9494
63C842393C3838DA2ECEFC7C /* Pods-llm.release.xcconfig */,
9595
);
96+
name = Pods;
9697
path = Pods;
9798
sourceTree = "<group>";
9899
};
@@ -134,6 +135,7 @@
134135
E8C01EF33FCE4105BBBC9DF6 /* Aeonik-Medium.otf */,
135136
);
136137
name = Resources;
138+
path = "";
137139
sourceTree = "<group>";
138140
};
139141
BB2F792B24A3F905000567C9 /* Supporting */ = {
@@ -353,7 +355,6 @@
353355
CLANG_ENABLE_MODULES = YES;
354356
CODE_SIGN_ENTITLEMENTS = llm/llm.entitlements;
355357
CURRENT_PROJECT_VERSION = 1;
356-
DEVELOPMENT_TEAM = "";
357358
ENABLE_BITCODE = NO;
358359
GCC_PREPROCESSOR_DEFINITIONS = (
359360
"$(inherited)",
@@ -390,7 +391,6 @@
390391
CLANG_ENABLE_MODULES = YES;
391392
CODE_SIGN_ENTITLEMENTS = llm/llm.entitlements;
392393
CURRENT_PROJECT_VERSION = 1;
393-
DEVELOPMENT_TEAM = "";
394394
INFOPLIST_FILE = llm/Info.plist;
395395
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
396396
LD_RUNPATH_SEARCH_PATHS = (
@@ -468,7 +468,10 @@
468468
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
469469
MTL_ENABLE_DEBUG_INFO = YES;
470470
ONLY_ACTIVE_ARCH = YES;
471-
OTHER_LDFLAGS = "$(inherited) ";
471+
OTHER_LDFLAGS = (
472+
"$(inherited)",
473+
" ",
474+
);
472475
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
473476
SDKROOT = iphoneos;
474477
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
@@ -523,7 +526,10 @@
523526
);
524527
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
525528
MTL_ENABLE_DEBUG_INFO = NO;
526-
OTHER_LDFLAGS = "$(inherited) ";
529+
OTHER_LDFLAGS = (
530+
"$(inherited)",
531+
" ",
532+
);
527533
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
528534
SDKROOT = iphoneos;
529535
USE_HERMES = true;

apps/llm/ios/llm/llm.entitlements

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
4-
<dict/>
4+
<dict>
5+
<key>com.apple.developer.kernel.increased-debugging-memory-limit</key>
6+
<true/>
7+
<key>com.apple.developer.kernel.increased-memory-limit</key>
8+
<true/>
9+
</dict>
510
</plist>

packages/react-native-executorch/android/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,28 @@ set(COMMON_CPP_DIR "${CMAKE_SOURCE_DIR}/../common")
1414
set(LIBS_DIR "${CMAKE_SOURCE_DIR}/../third-party/android/libs")
1515
set(INCLUDE_DIR "${CMAKE_SOURCE_DIR}/../third-party/include")
1616

17+
# FIXME: Below u can see miserable attempts of trying to link tokenizers-cpp
18+
# directly into react-native-executorch instead of it being linked against ExecuTorch
19+
# and then transitively to our library. Please go back to this when we bump ET runtime to the next version.
20+
# The problem with directly linking tokenizers-cpp using a submodule is that we get unresolved symbols for
21+
# some android logging libraries, which are referenced by sentencepiece.
22+
23+
# set(TOKENIZERS_CPP_DIR "${CMAKE_SOURCE_DIR}/../../../third-party/tokenizers-cpp")
24+
# add_subdirectory("${TOKENIZERS_CPP_DIR}" tokenizers-cpp)
25+
26+
# # Link Android log library to sentencepiece targets
27+
# if(TARGET sentencepiece-static)
28+
# target_link_libraries(sentencepiece-static INTERFACE log)
29+
# endif()
30+
# if(TARGET sentencepiece_train-static)
31+
# target_link_libraries(sentencepiece_train-static INTERFACE log)
32+
# endif()
33+
34+
# # Link log library to sentencepiece executables
35+
# foreach(exe spm_encode spm_decode spm_normalize spm_train spm_export_vocab)
36+
# if(TARGET ${exe})
37+
# target_link_libraries(${exe} log)
38+
# endif()
39+
# endforeach()
40+
1741
add_subdirectory("${ANDROID_CPP_DIR}")

packages/react-native-executorch/android/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,6 @@ dependencies {
168168
implementation 'com.facebook.fbjni:fbjni:0.6.0'
169169
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
170170
implementation files('libs/classes.jar')
171+
implementation 'org.opencv:opencv:4.10.0'
171172
implementation("com.squareup.okhttp3:okhttp:4.9.2")
172173
}

packages/react-native-executorch/android/src/main/cpp/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,37 @@ set(RN_VERSION_LINK_LIBRARIES
3333
)
3434

3535
# Dependencies:
36+
3637
# ------- Executorch -------
3738

3839
add_library(executorch SHARED IMPORTED)
3940

4041
set_target_properties(executorch PROPERTIES
4142
IMPORTED_LOCATION "${LIBS_DIR}/executorch/${ANDROID_ABI}/libexecutorch.so")
4243

44+
45+
if(ANDROID_ABI STREQUAL "arm64-v8a")
46+
target_compile_definitions(react-native-executorch PRIVATE ARCH_ARM64)
47+
48+
# ------- pthreadpool -------
49+
add_library(pthreadpool SHARED IMPORTED)
50+
51+
set_target_properties(pthreadpool PROPERTIES
52+
IMPORTED_LOCATION "${LIBS_DIR}/pthreadpool/${ANDROID_ABI}/libpthreadpool.so"
53+
INTERFACE_INCLUDE_DIRECTORIES "${LIBS_DIR}/../../include/pthreadpool/")
54+
55+
# ------- cpuinfo -------
56+
add_library(cpuinfo SHARED IMPORTED)
57+
58+
set_target_properties(cpuinfo PROPERTIES
59+
IMPORTED_LOCATION "${LIBS_DIR}/cpuinfo/${ANDROID_ABI}/libcpuinfo.so"
60+
INTERFACE_INCLUDE_DIRECTORIES "${LIBS_DIR}/../../include/cpuinfo/")
61+
set(EXECUTORCH_LIBS
62+
"pthreadpool"
63+
"cpuinfo"
64+
)
65+
endif()
66+
4367
# ------- OpenCV -------
4468

4569
set(OPENCV_LIBS
@@ -70,4 +94,5 @@ target_link_libraries(
7094
${OPENCV_LIBS}
7195
${OPENCV_THIRD_PARTY_LIBS}
7296
executorch
97+
${EXECUTORCH_LIBS}
7398
)

0 commit comments

Comments
 (0)