Skip to content

tflite-runtime: Add version 2.14.0 - #2154

Merged
luhenry merged 1 commit into
mainfrom
tflite-runtime
Sep 21, 2026
Merged

luhenry merged 1 commit into
mainfrom
tflite-runtime

Conversation

@luhenry

@luhenry luhenry commented Sep 21, 2026

Copy link
Copy Markdown
Member

Bazel builds one target, the TFLite interpreter's pybind11 extension, which is then packaged with setup_with_binary.py: no TensorFlow core, no MLIR converter, no flex delegate. Upstream publishes no riscv64 wheel.

Mirrors upstream's build_pip_package_with_bazel.sh, driven through its own CUSTOM_BAZEL_FLAGS hook.

Differs from upstream

  • bazel 7.5.0 bootstrapped from source instead of .bazelversion's 6.1.0 - no riscv64 release binary exists for either, 7.5.0 is what this repo bootstraps, and TensorFlow's only gate is a versions.check("1.0.0") minimum
  • python and pypi_numpy overridden with the container's CPython and numpy - TensorFlow 2.14 takes both header sets from rules_python 0.23.1's hermetic interpreter, which has no riscv64 build and would be the wrong interpreter for the wheel regardless
  • --nosubcommands - undoes the script's -s, which prints every compile command

Matrix: cp310/cp311; 2.14.0 is the last release and pins pybind11 2.10.4, which predates CPython 3.12, and the manylinux riscv64 image ships no interpreter below 3.10.

Testing

  • upstream ships no wheel test; this runs testdata/add.bin through the installed wheel's Interpreter and checks the output against three times the input

License: OK

Builds the TensorFlow Lite interpreter's pybind11 extension for riscv64 the way
upstream's own pip recipe does, tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh:
one bazel target, //tensorflow/lite/python/interpreter_wrapper:_pywrap_tensorflow_interpreter_wrapper,
copied next to interpreter.py and the metrics shims and packaged with
setup_with_binary.py. No TensorFlow core, no MLIR converter, no flex delegate.

2.14.0 is the last tflite-runtime release, so the build is the 2023 monorepo's:
bazel 6.1.0 in .bazelversion (7.5.0 is bootstrapped instead, since nothing on the
TensorFlow side gates it beyond a versions.check("1.0.0") minimum), XNNPACK
b9d4073a, whose riscv64 production microkernels are scalar-only, so neither RVV
nor its zvfh fp16 variant is compiled, and pybind11 2.10.4, which is what caps the
matrix at cp311. cp310 is the floor because the manylinux riscv64 image ships no
older interpreter.

The one riscv64 gap is hermetic Python: TensorFlow 2.14 takes both the Python and
the numpy headers from rules_python 0.23.1's downloaded interpreter, which has no
riscv64 build - and would be the wrong interpreter for the wheel even if it did.
Both repositories are overridden with the container's own CPython and its numpy
through bazel's --override_repository, so no patch to the checkout is needed.

Tested by running add.bin through the installed wheel's Interpreter and comparing
the result against three times the input.
@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-21 11:35 UTC

luhenry added a commit that referenced this pull request Sep 21, 2026
…-497

Both riscv64 legs built and tested on the first CI cycle, and the publish job
dry-ran clean.

The four gotchas are the reusable half of that port: a hermetic Python that
predates riscv64 supplies both the Python and the numpy headers, so two
repositories have to be stood in (494); a Bazel port's loading phase, including
those overrides, rehearses on x86_64 in minutes even behind blocked egress
(495); gotcha 420's XNNPACK fp16 define does not apply to a 2023 pin whose
riscv64 production microkernels are scalar-only (496); and an upstream build
script's own env hooks take the whole riscv64 delta, with the later flag
cancelling one the script hardcodes (497).
@luhenry
luhenry marked this pull request as ready for review September 21, 2026 11:26
@luhenry
luhenry merged commit eec8ffb into main Sep 21, 2026
11 checks passed
@luhenry
luhenry deleted the tflite-runtime branch September 21, 2026 11:26
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.

1 participant