+ notes: 'PR #2154 open as a draft and FULLY GREEN on the first CI cycle - both legs built and tested, publish dry run clean (cp310 53m, cp311 52m; bazel build 991 actions / 2739s, wheels 1.8MB, tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so 3.9MB with ELF e_machine 0xF3, tag cp3XX-cp3XX-manylinux_2_39_riscv64 after auditwheel retagged linux_riscv64, test installs numpy 2.4.3 from the registry and runs testdata/add.bin to 3x its input). 12 Linux wheels upstream (abi: cp310,cp311,cp38,cp39); no riscv64 on PyPI or pypi.riseproject.dev. Feasible and much smaller than tensorflow itself (gotcha 426): 2.14.0 is the last tflite-runtime release and predates the LiteRT split, so upstream is tensorflow/tensorflow at tag v2.14.0 (verified: PyPI lists only www.tensorflow.org/lite, and tensorflow/tools/pip_package/setup.py at that tag reads _VERSION = 2.14.0 while tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh builds the tflite_runtime distribution). The recipe builds ONE bazel target, //tensorflow/lite/python/interpreter_wrapper:_pywrap_tensorflow_interpreter_wrapper, with -c opt --config=monolithic --config=noaws --config=nogcp --config=nohdfs --config=nonccl, then copies it next to interpreter.py/metrics_portable.py and runs setup_with_binary.py - no TF core, no MLIR, and flex is behind a define we do not set, so this is comparable in scope to ai-edge-litert (PR #2135) rather than to a full TF build. FOUR riscv64 questions checked statically before the first cycle: (1) bazel: .bazelversion says 6.1.0 and no riscv64 binary exists for any bazel release, so 7.5.0 is bootstrapped as elsewhere in this repo - TF 2.14 has no MODULE.bazel, its only version gate is workspace2.bzl versions.check("1.0.0"), and every flag its .bazelrc sets (--experimental_cc_shared_library, --experimental_link_static_libraries_once, --incompatible_enforce_config_setting_visibility, --experimental_repo_remote_exec, configs monolithic/noaws/nogcp/nohdfs/nonccl) was verified to parse under a real bazel 7.5.0 locally; build:linux is auto-applied via --enable_platform_specific_config and already carries --cxxopt=-std=c++17. (2) XNNPACK at this TF commit is b9d4073a, where riscv64 PRODUCTION microkernels are scalar only (scalar-riscv amalgam / PROD_SCALAR_RISCV_MICROKERNEL_SRCS); ALL_RVV_MICROKERNEL_SRCS and the XNN_ENABLE_RISCV_VECTOR define appear only in bench_microkernels/test_microkernels, and the tree has no rvvfp16arith at all - so neither gotcha 420 (zvfh vs binutils 2.41) nor an RVV-intrinsics-vs-GCC-14 problem can arise, and no xnn_enable_* define is needed. cpuinfo 87d82345 has a linux_riscv64 srcs branch. (3) hermetic python IS the one real gap: TF 2.14 pins rules_python 0.23.1, whose PLATFORMS/TOOL_VERSIONS have no riscv64 CPython, and BOTH //third_party/python_runtime:headers (via @local_config_python -> @python//:python_headers) and //third_party/py/numpy:headers (@pypi_numpy//:numpy_headers) come from it; WORKSPACE also load()s @python//:defs.bzl, so the toolchain_aliases repo is fetched eagerly and get_host_platform() fails on riscv64. Solved with no patch by --override_repository=python=... and --override_repository=pypi_numpy=..., two repos written at run time from the container CPython include dir and numpy.get_include(); VALIDATED off-target: a real bazel 7.5.0 on x86_64 evaluated the whole WORKSPACE python/pip_parse block with those overrides and got as far as workspace3.bzl fetching tf_runtime, i.e. past every hermetic-python line, and pip_parse never ran pip. (4) numpy: nothing needs patching either - the interpreter_wrapper C++ uses only APIs numpy 2 still exports (PyArray_SimpleNewFromData/EMPTY/FromAny/Return/SetBaseObject/ENABLEFLAGS/GETITEM/Iter*, NPY_ARRAY_*, no descr->elsize), so it builds against the registry numpy (2.2.2 cp310 / 2.4.3 cp311) and that keeps the wheel loadable under numpy 1.x and 2.x alike. Matrix is cp310+cp311 by upstream constraint, not by choice: upstream ships cp38-cp311 only, pybind11 is pinned at 2.10.4 which predates CPython 3.12, TF_PYTHON_VERSION accepts 3.9-3.11, and the manylinux riscv64 image has no interpreter below 3.10; registry numpy covers both. Local validation could not go further than WORKSPACE evaluation: this sandbox egress blocks codeload.github.com, so every tf_http_archive 403s.'
0 commit comments