Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Build TensorFlow Lite C Framework for x86_64 (simulator) as well #26

Closed
wants to merge 3 commits into from

Conversation

mrousavy
Copy link
Owner

Builds the TensorFlow Lite C Framework for x86 (64-bit) multi-CPU as well (used in the iOS Simulator)

@mrousavy mrousavy mentioned this pull request Jan 23, 2024
@mrousavy
Copy link
Owner Author

nvm the command I added does not work. I am not even sure if this really is a problem, I had this running on an iOS simulator on arm64. I think this might be an issue with the user's RN app, not with Fast TFLite.

@mrousavy mrousavy closed this Jan 23, 2024
@Chasty
Copy link

Chasty commented Jan 23, 2024

I could not run in simulator for arm64 arch.
@mrousavy

@computerjazz
Copy link

computerjazz commented Feb 22, 2024

There are several open issues suggesting that tflite does not currently work with arm64 sims:

tensorflow/tensorflow#47400
am15h/tflite_flutter_plugin#153 (comment)

In the meantime, i can get it up and running via a Rosetta simulator. And I've seen some mention that the upstream issue has been fixed, but not released yet -- although this comment is over a year old now: tensorflow/tensorflow#47400 (comment)

@computerjazz
Copy link

computerjazz commented Feb 24, 2024

I just spent a few hours going town a tflite rabbit hole and verified that if I build tflite ONLY for ios_sim_arm64 it builds and runs in the simulator. However, building for ios_multi_cpus and including ios_sim_arm64 as one of the options fails to build.

working build command for sim only:

bazel build --config=ios_sim_arm64  -c opt --cxxopt=--std=c++17 \                                
  //tensorflow/lite/ios:TensorFlowLiteC_framework

non-working build command, hoping to cover all architectures:

bazel build --ios_multi_cpus=armv7,arm64,i386,x86_64,ios_sim_arm64  -c opt --cxxopt=--std=c++17 \                                               
  //tensorflow/lite/ios:TensorFlowLiteC_framework

So, I'm not seeing a path forward for being able to run on ios sim outside of Rosetta, unless there's a way to include both sim-only and other-cpu binaries in the project and choose which one to include at build time, based on destination architecture.

PR that added arm64 sim support: tensorflow/tensorflow#55777

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants