tflite: Add sync driver

Although we have the async driver helper, not every delegate are assumed
to be supporting async API. Hence, this CL adds a similar helper but
only uses the traditional sync API, so we can easily control delegate
behaviors without requiring the delegate to support async API.

BUG=b:374245241
TEST=`bazelisk run --config=host_clang '//common:sync_driver_test'` with
sample delegate

Change-Id: I25b8f4b27ff7fed09a7d336b1b4eca36a8cbc6f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/tflite/+/6176630
Auto-Submit: Tommy Chiang <ototot@google.com>
Tested-by: Tommy Chiang <ototot@google.com>
Reviewed-by: Shik Chen <shik@chromium.org>
Commit-Queue: Tommy Chiang <ototot@google.com>
4 files changed
tree: f82d4c507c83267cead269b3ed94960a2a822e7e
  1. android/
  2. common/
  3. delegate/
  4. patch/
  5. script/
  6. tool/
  7. udev/
  8. .bazelignore
  9. .bazelrc
  10. .bazelversion
  11. .clang-format
  12. .gitignore
  13. BUILD.bazel
  14. CPPLINT.cfg
  15. DIR_METADATA
  16. OWNERS
  17. PRESUBMIT.cfg
  18. README.md
  19. WORKSPACE.bazel
README.md

ChromeOS TFLite

This repository hosts the core ChromeOS TFLite components, enabling on-device machine learning (ODML) workloads accelerated by NPU.

The corresponding ebuild can be found at: tensorflow-9999.ebuild

TensorFlow Patch Management

Patches are stored in the patch/ directory and explicitly listed in WORKSPACE.bazel. A helper script, ./script/patcher.py, is included to facilitate patch management within a TFLite workspace.

The typical workflow:

  1. Eject (Download) TensorFlow Source Code

    Download the TensorFlow source code into a local git repository with patches applied as individual commits:

    ./script/patcher.py eject
    

    This creates a new local git repository at tensorflow/.

  2. Modify the TensorFlow Repository

    Make changes to the tensorflow/ repository as needed, following standard git workflows. Optionally, include a PATCH_NAME= tag in commit messages to specify the filename of the corresponding patch.

  3. Seal the Repository

    Regenerate the patch files and update the WORKSPACE.bazel file:

    ./script/patcher.py seal
    

    This updates the patches in the patch/ directory and reflects the changes in WORKSPACE.bazel.

It's preferred to submit changes to upstream TensorFlow first and cherry-pick them as patches. This helps minimize divergence and makes TensorFlow updates easier.