diff --git a/.github/workflows/build-tensorstore.yml b/.github/workflows/build-tensorstore.yml new file mode 100644 index 000000000..a32f32448 --- /dev/null +++ b/.github/workflows/build-tensorstore.yml @@ -0,0 +1,219 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +# +# This workflow is based on: https://github.com/google/tensorstore/blob/v0.1.85/.github/workflows/build.yml +--- +name: Build tensorstore wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'tensorstore version to build (git tag without leading v, e.g. 0.1.85)' + required: true + default: '0.1.85' + pull_request: + paths: + - '.github/workflows/build-tensorstore.yml' + - 'patches/tensorstore/**' + +run-name: build-tensorstore - ${{ inputs.version || '0.1.85' }} + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '0.1.85' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +env: + TENSORSTORE_VERSION: ${{ inputs.version || '0.1.85' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + # bazelisk.py has no riscv64 entry in determine_bazel_filename(), so bootstrap a bazel + # binary from the dist archive instead. Bazel fixed riscv64 bootstrapping in 8.2.0 + # (bazelbuild/bazel#25745); tensorstore's own .bazelversion (8.5.1) is past that, so no + # rules_python/rules_java patches are needed. + BAZEL_VERSION: '8.5.1' + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + bazel: + needs: [setup] + name: Bootstrap bazel (riscv64) + runs-on: ubuntu-24.04-riscv + timeout-minutes: 180 + + steps: + - name: Restore bazel binary + id: cache + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: bazel-bin + key: bazel-${{ env.BAZEL_VERSION }}-manylinux_riscv64 + + - name: Bootstrap bazel ${{ env.BAZEL_VERSION }} + if: steps.cache.outputs.cache-hit != 'true' + run: | + mkdir -p bazel-bin + docker run --rm -i --network=host \ + -v "${GITHUB_WORKSPACE}:/work" \ + -w /work \ + -e BAZEL_VERSION="${BAZEL_VERSION}" \ + "${MANYLINUX_RISCV64_IMAGE}" \ + bash <<'SCRIPT' + set -eux + + dnf install -y --setopt=install_weak_deps=False java-21-openjdk-devel zip unzip + JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v javac)")")")" + export JAVA_HOME + + mkdir -p /tmp/bazel-src + cd /tmp/bazel-src + curl -fsSLo dist.zip "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip" + unzip -q dist.zip + + EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh + install -m 0755 output/bazel /work/bazel-bin/bazel + SCRIPT + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: bazel-${{ env.BAZEL_VERSION }}-riscv64 + path: bazel-bin/bazel + if-no-files-found: error + + build_wheels: + name: Build tensorstore ${{ inputs.version || '0.1.85' }} manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 1440 + needs: [setup, bazel] + + steps: + - name: Checkout tensorstore v${{ env.TENSORSTORE_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: google/tensorstore + ref: v${{ env.TENSORSTORE_VERSION }} + path: tensorstore + fetch-depth: 1 + persist-credentials: false + + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + fetch-depth: 1 + persist-credentials: false + + - name: Patch tensorstore source + working-directory: tensorstore + run: git apply ../python-wheels/patches/tensorstore/${{ env.TENSORSTORE_VERSION }}/00*.patch + + - name: Download bazel + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: bazel-${{ env.BAZEL_VERSION }}-riscv64 + path: bazel-bin + + - name: Build wheels + run: | + mkdir -p wheelhouse + set -o pipefail + docker run --rm -i --network=host \ + -v "${GITHUB_WORKSPACE}:/work" \ + -w /work \ + -e PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ \ + -e PIP_ONLY_BINARY=numpy \ + -e TENSORSTORE_VERSION="${TENSORSTORE_VERSION}" \ + "${MANYLINUX_RISCV64_IMAGE}" \ + bash <<'SCRIPT' 2>&1 | tee build.log + set -eux + + dnf install -y --setopt=install_weak_deps=False java-21-openjdk-devel + JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v javac)")")")" + export JAVA_HOME + + install -m 0755 /work/bazel-bin/bazel /usr/local/bin/bazel + git config --global --add safe.directory '*' + # git apply leaves the tree dirty, so setuptools_scm reads it as a + # post-release dev build (0.1.85 -> 0.1.85.post1.dev0) unless pinned. + export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TENSORSTORE="${TENSORSTORE_VERSION}" + + # setup.py invokes `sys.executable -u $TENSORSTORE_BAZELISK`, so the bootstrapped + # native bazel binary needs a thin python shim rather than direct assignment. + cat > /usr/local/bin/bazelisk_shim.py <<'PY' + import os + import sys + os.execv("/usr/local/bin/bazel", ["/usr/local/bin/bazel"] + sys.argv[1:]) + PY + + export TENSORSTORE_BAZELISK=/usr/local/bin/bazelisk_shim.py + export TENSORSTORE_BAZEL_STARTUP_OPTIONS="--output_user_root=/work/bazel-output" + # A multi-hour build's default curses progress output is large enough that + # GitHub drops the job log, taking the failure with it. --local_ram_resources + # keeps analysis/compile action concurrency from oversubscribing memory on the + # shared riscv64 runner pool (other jobs run concurrently on the same hosts). + export TENSORSTORE_BAZEL_BUILD_OPTIONS="--curses=no --show_progress_rate_limit=60 --local_ram_resources=HOST_RAM*.5" + + cd /work/tensorstore + + for python in cp311-cp311 cp312-cp312 cp313-cp313 cp314-cp314 cp314-cp314t; do + "/opt/python/${python}/bin/pip" install -q -r third_party/pypa/wheel_requirements_frozen.txt + PATH="/opt/python/${python}/bin:$PATH" \ + "/opt/python/${python}/bin/python" -m pip wheel -w /work/wheelhouse . --no-deps --no-build-isolation + done + + for wheel in /work/wheelhouse/*.whl; do + mv "${wheel}" "$(dirname "${wheel}")/$(basename "${wheel}" | sed 's/-linux_riscv64\.whl$/-manylinux_2_39_riscv64.whl/')" + done + SCRIPT + + - name: Upload build log + if: failure() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: tensorstore-${{ env.TENSORSTORE_VERSION }}-build-log + path: build.log + + # Uploaded before the smoke test so a failing wheel is still available to inspect. + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: tensorstore-${{ env.TENSORSTORE_VERSION }}-wheels-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + compression-level: 0 + + - name: Test wheels + run: | + docker run --rm -i --network=host \ + -v "${GITHUB_WORKSPACE}:/work" \ + -e PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ \ + "${MANYLINUX_RISCV64_IMAGE}" \ + bash <<'SCRIPT' + set -eux + + for python in cp311-cp311 cp312-cp312 cp313-cp313 cp314-cp314 cp314-cp314t; do + pytag="${python%%-*}" + # PIP_ONLY_BINARY stops pip at the newest numpy/ml_dtypes our registry has a + # riscv64 wheel for, instead of resolving a newer sdist-only release. + PIP_ONLY_BINARY=numpy,ml_dtypes "/opt/python/${python}/bin/pip" install \ + /work/wheelhouse/tensorstore-*-"${pytag}"-*.whl \ + pytest pytest-asyncio cloudpickle numpy ml_dtypes + # /work holds the tensorstore checkout, whose root would shadow the installed + # wheel if pytest ran from there (python/tensorstore is importable as-is). + (cd /tmp && "/opt/python/${python}/bin/python" -m pytest \ + /work/tensorstore/python/tensorstore/tests -vv -s --asyncio-mode=auto) + done + SCRIPT + + publish: + name: Publish tensorstore ${{ inputs.version || '0.1.85' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: tensorstore-${{ inputs.version || '0.1.85' }}-*-manylinux_riscv64 diff --git a/patches/tensorstore/0.1.85/0001-Add-riscv64-support-to-the-dav1d-Bazel-BUILD-wrapper.patch b/patches/tensorstore/0.1.85/0001-Add-riscv64-support-to-the-dav1d-Bazel-BUILD-wrapper.patch new file mode 100644 index 000000000..637ddf4e8 --- /dev/null +++ b/patches/tensorstore/0.1.85/0001-Add-riscv64-support-to-the-dav1d-Bazel-BUILD-wrapper.patch @@ -0,0 +1,118 @@ +From 721c7c44fa91bc8ac74682c16896458df70938b7 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sun, 13 Sep 2026 04:40:02 +0200 +Subject: [PATCH] Add riscv64 support to the dav1d Bazel BUILD wrapper + +dav1d.BUILD.bazel's select()s for deps/TMPL_SRCS/DAV1D_SRCS/TEXTUAL_HDRS/ +CONFIG_H only branch on arm64/ppc/x86_64, so building //python/tensorstore +for any other cpu (riscv64 included) fails bazel's analysis phase outright: +"doesn't match this configuration. Would a default condition help?". + +dav1d has shipped riscv64 (rv64gcv) assembly since 1.4.0 under src/riscv/, +gated on ARCH_RISCV/ARCH_RV64 in config.h exactly like the other arches' +asm is gated on their own ARCH_* defines (src/cpu.c, src/*_tmpl.c). This +adds a riscv64 branch mirroring arm64's shape (raw .S sources, no _tmpl.c +split, asm.S as a textual header) instead of falling back to a slower +plain-C build, plus a //conditions:default on the three selects that only +varied by "is there extra arch-specific work" (empty on every arch this +project doesn't build asm for anyway). + +Upstream-Status: To upstream [not submitted from this automated port run; needs a pull request against google/tensorstore] +--- + .../org_videolan_dav1d/dav1d.BUILD.bazel | 34 +++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/third_party/org_videolan_dav1d/dav1d.BUILD.bazel b/third_party/org_videolan_dav1d/dav1d.BUILD.bazel +index a8c504d..b371088 100644 +--- a/third_party/org_videolan_dav1d/dav1d.BUILD.bazel ++++ b/third_party/org_videolan_dav1d/dav1d.BUILD.bazel +@@ -30,6 +30,7 @@ cc_library( + "@platforms//cpu:arm64": [], + "@platforms//cpu:ppc": [], + "@platforms//cpu:x86_64": [":dav1d_asm_x86"], ++ "//conditions:default": [], + }), + ) + +@@ -53,6 +54,13 @@ PPC_ASM_SRCS = glob( + ], + ) + ++# Mirrors upstream's src/meson.build riscv branch: cpu.c plus the riscv64 .S ++# sources, with no _tmpl.c split (dav1d has none for this arch). ++RISCV_ASM_SRCS = glob([ ++ "src/riscv/*.c", ++ "src/riscv/64/*.S", ++]) ++ + # TMPL_SRCS are compiled for BITDEPTH=8 and BITDEPTH=16 + TMPL_SRCS = glob(["src/*_tmpl.c"]) + select({ + "@platforms//cpu:arm64": glob( +@@ -67,6 +75,7 @@ TMPL_SRCS = glob(["src/*_tmpl.c"]) + select({ + ["src/x86/*_tmpl.c"], + allow_empty = True, + ), ++ "//conditions:default": [], + }) + + DAV1D_SRCS = glob( +@@ -78,10 +87,12 @@ DAV1D_SRCS = glob( + }) + select({ + "@platforms//cpu:arm64": ARM_ASM_SRCS, + "@platforms//cpu:ppc": PPC_ASM_SRCS, ++ "@platforms//cpu:riscv64": RISCV_ASM_SRCS, + "@platforms//cpu:x86_64": glob( + ["src/x86/*.c"], + exclude = ["src/x86/*_tmpl.c"], + ), ++ "//conditions:default": [], + }) + + TEXTUAL_HDRS = select({ +@@ -96,6 +107,11 @@ TEXTUAL_HDRS = select({ + "src/*.h", + "src/ppc/*.h", + ]), ++ "@platforms//cpu:riscv64": glob([ ++ "src/*.h", ++ "src/riscv/*.h", ++ "src/riscv/asm.S", ++ ]), + "@platforms//cpu:x86_64": glob([ + "src/*.h", + "src/x86/*.h", +@@ -326,6 +342,23 @@ PPC_CONFIG_H = [ + "", + ] + ++# dav1d has shipped riscv64 (rv64gcv) asm since 1.4.0 (src/riscv), gated on ++# ARCH_RISCV/ARCH_RV64 the same way the other arches gate their asm dispatch. ++RISCV64_CONFIG_H = [ ++ "#define ARCH_AARCH64 0", ++ "#define ARCH_ARM 0", ++ "#define ARCH_X86 0", ++ "#define ARCH_X86_32 0", ++ "#define ARCH_X86_64 0", ++ "#define ARCH_PPC64LE 0", ++ "#define ARCH_RISCV 1", ++ "#define ARCH_RV32 0", ++ "#define ARCH_RV64 1", ++ "", ++ "#define HAVE_ASM 1", ++ "", ++] ++ + CONFIG_END_H = [ + "", + "#define CONFIG_16BPC 1", +@@ -358,6 +391,7 @@ CONFIG_H = CONFIG_START_H + select({ + "@platforms//cpu:x86_64": X86_64_CONFIG_H, + "@platforms//cpu:arm64": ARM64_CONFIG_H, + "@platforms//cpu:ppc": PPC_CONFIG_H, ++ "@platforms//cpu:riscv64": RISCV64_CONFIG_H, + }) + select({ + "@platforms//os:macos": DARWIN_CONFIG_H, + "//conditions:default": [], +-- +2.50.1 (Apple Git-155) + diff --git a/patches/tensorstore/0.1.85/0002-Add-a-riscv64-default-to-libaom-s-header-select.patch b/patches/tensorstore/0.1.85/0002-Add-a-riscv64-default-to-libaom-s-header-select.patch new file mode 100644 index 000000000..b47099195 --- /dev/null +++ b/patches/tensorstore/0.1.85/0002-Add-a-riscv64-default-to-libaom-s-header-select.patch @@ -0,0 +1,45 @@ +From 3a0c8bc6475937122508cac4443fff01fb707136 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sun, 13 Sep 2026 05:18:10 +0200 +Subject: [PATCH] Add a riscv64 default to libaom's header select() + +libaom.BUILD.bazel's LIBAOM_HEADERS select() only branches on arm64/x86_64/ +ppc, so building //python/tensorstore (which pulls in libaom transitively +through the avif image driver) fails bazel analysis on riscv64 the same way +dav1d's BUILD.bazel did. + +Unlike dav1d, this wrapper's own _PATTERN_UNSUPPORTED list already excludes +"**/riscv/**" and "**/*_rvv*" headers, and GENERATED_CONFIGS already maps +"//conditions:default" to a pre-generated "generic" (non-SIMD) aom_config.h/ +rtcd.h set. So riscv64 already gets a working, intentionally-generic config +elsewhere in this file; LIBAOM_HEADERS was simply missing the matching +default branch. This adds one, built from the same exclude-every-arch +pattern the generic config pairs with. + +Upstream-Status: To upstream [not submitted from this automated port run; needs a pull request against google/tensorstore] +--- + third_party/org_aomedia_aom/libaom.BUILD.bazel | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/third_party/org_aomedia_aom/libaom.BUILD.bazel b/third_party/org_aomedia_aom/libaom.BUILD.bazel +index a7e1788..80ca56d 100644 +--- a/third_party/org_aomedia_aom/libaom.BUILD.bazel ++++ b/third_party/org_aomedia_aom/libaom.BUILD.bazel +@@ -83,6 +83,14 @@ LIBAOM_HEADERS = select({ + allow_empty = True, + exclude = _PATTERN_UNSUPPORTED + _PATTERN_X86 + _PATTERN_ARM, + ), ++ # _PATTERN_UNSUPPORTED already excludes riscv/rvv; every other arch (this ++ # port's riscv64 included) gets the same generic, non-SIMD header set the ++ # GENERATED_CONFIGS "//conditions:default" -> "generic" entry below pairs with. ++ "//conditions:default": glob( ++ include = LIBAOM_HEADERS_PATTERN, ++ allow_empty = True, ++ exclude = _PATTERN_UNSUPPORTED + _PATTERN_PPC + _PATTERN_X86 + _PATTERN_ARM, ++ ), + }) + + cc_library( +-- +2.50.1 (Apple Git-155) + diff --git a/patches/tensorstore/0.1.85/0003-Unpin-the-hermetic-numpy-fetch-used-for-building-hea.patch b/patches/tensorstore/0.1.85/0003-Unpin-the-hermetic-numpy-fetch-used-for-building-hea.patch new file mode 100644 index 000000000..7025e8147 --- /dev/null +++ b/patches/tensorstore/0.1.85/0003-Unpin-the-hermetic-numpy-fetch-used-for-building-hea.patch @@ -0,0 +1,113 @@ +From e05f7a2322c4dce02313e2fd45bbbd47a10b53e4 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sun, 13 Sep 2026 06:49:55 +0200 +Subject: [PATCH] Unpin the hermetic numpy fetch used for building headers on + riscv64 + +third_party/pypa/workspace.bzl hash-pins numpy==2.4.6 for the @pypa_numpy +external repo (used only for @pypa_numpy//:headers, numpy's C API headers +consumed by the pybind11 extension). Bazel's own repository-rule pip install +(third_party_pypa_package.bzl) has no riscv64 wheel to install for that exact +pinned version anywhere - not on PyPI, not on our own registry - so pip falls +back to a from-source build, which reliably exceeds repository_ctx.execute's +600-second default timeout on this hardware and fails with a bare "Timed +out". + +numpy's C API is stable enough across minor releases that any recent version +works for compiling against; dropping the pin (and its hash list) lets pip +resolve to whatever version has a wheel, with PIP_ONLY_BINARY=numpy (set by +the workflow) keeping it from drifting into another from-source build. + +Upstream-Status: Inappropriate [riscv64/our-registry infra needs this; irrelevant upstream, which only builds x86_64/arm64/macos/windows] +--- + third_party/pypa/workspace.bzl | 74 +--------------------------------- + 1 file changed, 1 insertion(+), 73 deletions(-) + +diff --git a/third_party/pypa/workspace.bzl b/third_party/pypa/workspace.bzl +index 425741f..309e929 100644 +--- a/third_party/pypa/workspace.bzl ++++ b/third_party/pypa/workspace.bzl +@@ -1860,79 +1860,7 @@ def repo_pypa_numpy(): + name = "pypa_numpy", + target = "numpy", + requirement = [ +- "numpy==2.4.6", +- "--hash=sha256:001fbb8e08d942dd57599e781f2472269ee7f2755fae407b4f67b2f0b17da3f1", +- "--hash=sha256:0280e0356c0829a18d9de1cb7eee50ec22ca639878d7240307ca0943d73cd2c4", +- "--hash=sha256:043191bfa8eab18c776647b62723ac9dddece59743b13f49b2016094129c2b3f", +- "--hash=sha256:06ca2f61ec4385a07a6977c55ba998a4466c123642b4a32694d3128fce18c079", +- "--hash=sha256:0a041d3d761dc3c35cc56ce0351506a02bcbc25f7b169f652435141a17db9096", +- "--hash=sha256:0ab0a9c4ffb1a6d95ef519fe4247dba8eb6b18ad93999f76b7f657039acabd47", +- "--hash=sha256:0c9136e14ed34a9e343a31c533d78a9813a69a3148332bce5e9821cb2f996e66", +- "--hash=sha256:110f8b71aacb688ec69062bb7f6938a0f8acb01b7c1c4beb453c65b6d234584d", +- "--hash=sha256:112b06a867b235ef466ed3508ddf0238050df9c727cafb5301ac385b899189a1", +- "--hash=sha256:17f9ade344e7d9b464a084d69bcf18fc691cb1db67c62ed80820bf4926d78f0e", +- "--hash=sha256:1e254a00cdf42b1e4d5b3d68d33af63268d41340d8885df2ab6470f2e1500147", +- "--hash=sha256:1e978ec1e8bd0e0e4de6bb75de9d30cbb74db6b6a2bb727618613703ca0167dd", +- "--hash=sha256:25c692919ac5a01f170a3bfcd62d745b24fd095c353d50812637d6fcab442e75", +- "--hash=sha256:260a5d70215b61ab4fadf5c7baacd64821842975eea312125ed3c39a6391b063", +- "--hash=sha256:2803abfebfc990042cd494d8ce2d5f82e9d847af6d35ec486923aa19dbad5e73", +- "--hash=sha256:29a287e0cf63ff528da061de6b9f64a4618da591ca1046aafc54062e40ca7eab", +- "--hash=sha256:29cb7f67d10b479ff07c17d33e39f78c07f71c40ef30d63c153d340e96cd3fb4", +- "--hash=sha256:3213d622a0283a39a93d188f3cf72b26862df52fbb4ca3697f51705016523d41", +- "--hash=sha256:33111801a01c12a8a1e3721f0a9232f8cfc8ae2c6b7098167e6f623c6073f402", +- "--hash=sha256:357cc07a6d7b0b182ff02249616a03742827ebb1277546b5c7cd7f7620a45698", +- "--hash=sha256:38efbc8de75c7a0fc1ac190162d892787f3f47b57cc291231aafee36b80982b7", +- "--hash=sha256:4081eb135ac24158bd51cdfbef16f1c64df7063b1143f24731387137c092bec8", +- "--hash=sha256:40fdc1ae7125e518ea98e53e69a4ebc27e1fd50510c47b7ea130cf21e5e1d42b", +- "--hash=sha256:4cfe66903cc32a9921a6733d96b19bb6abf310397581bbad89c228f5abaf0ee8", +- "--hash=sha256:511dbaf848decaaaf4b4ca48032619fb3138710c4bf7da7617765edad1ef96b0", +- "--hash=sha256:55cced7c52e981362f708ad635198e97a752dfba412cc03c23bbf3bd8d5cd662", +- "--hash=sha256:56b39e5e0622a09a25bf5baf62f4bcf0cb8a41ae6e2819cf49bbc5a74c083f91", +- "--hash=sha256:5dbbdb29840ca3d91ee0fece42fc29278886d908280bfec0a5846c6f901a3eb0", +- "--hash=sha256:5f9fb9157b4ce2971008323afe46053787b526ef624fea915b261468a8421a0f", +- "--hash=sha256:6180d8b35af935aed8ece3a85e0a43f87393ae0ac87c8d2c8bd2c993f7270ef3", +- "--hash=sha256:68a5124b13fa6cc2086764a20005d30bc0548146f7f5322f02fce212ca14317f", +- "--hash=sha256:68bb27509ac1b9a3443094260f6326150663b06abe40b73a2f81160623da5b67", +- "--hash=sha256:6f41ae150c4e32db4f3310cdaf64b1593a03dbabe29eec77fc9b50fe64061df6", +- "--hash=sha256:7265a2f3d436e54ef9f2b52b5c937e6be778781bd97a590319d7348f1c1ca997", +- "--hash=sha256:72fbe16c6fac95aedf5937fa873445cec2110be35d8a4e9433d7501fd98dae6b", +- "--hash=sha256:7d92c3819208a60205a12a245c91ad70cb0a85336659b19b834205573ac8456e", +- "--hash=sha256:8155154c7c691289fe18f510b5d4657c68c67989f293f0535a91360392ff6538", +- "--hash=sha256:81a1cca95ed5bb92aa8b10dd2cdc9a0d3853a50fad926c28b5d7e8ea54389627", +- "--hash=sha256:89cd468399cfd2504718f0ba50e410dca55a170b61a02ad92bb18c8a65186e93", +- "--hash=sha256:8ad03c0965fb3c692200e74d458ca28c1dbb4ce96f9a479a8aa041ad5fabca02", +- "--hash=sha256:90f9849678c75fe7afa2d348ac842c168b0a4d3d61919687216dfc547976d853", +- "--hash=sha256:948424b06129ce883307e8cff868c31396d8dc7630a59c61d70d98dbe70f222c", +- "--hash=sha256:9cd5ffd25db4e7ba6a375693b3fc0fc1791ec636c17db3720da19bde7180ec43", +- "--hash=sha256:a0df0043bdb289bde1f62da130d20df23d58b45429f752bc7a8fc5325a225ecd", +- "--hash=sha256:a2c306dea656c12c68f51f4cea133cbe78ca7435eb28c735eac1d3ebe73be6e8", +- "--hash=sha256:a7830bab239b79cda9c08c2da014761cafb48da6150e1da17ac06283f43b6089", +- "--hash=sha256:a7c711e21628b52034bb5ab8d1bce291f752fcc5e92accc615778acee1ff4778", +- "--hash=sha256:aaf159caa35993cb1f56fb9b8e4610d35758e7ca005412eb1daa856a78c9c4b1", +- "--hash=sha256:ae506e6902902557576a26ff33eda8695e7ecb3cb36c3b573a0765dee114ebdb", +- "--hash=sha256:b507f5c4c1d508876d1819b6bf9a49d365b96320b5d4993426b33a23ca4b8261", +- "--hash=sha256:bf162abab1c1a736333192707cef898e735a5ca00f38f27eeedf44b39d9e85eb", +- "--hash=sha256:c1a2af6c6ef86344a6b0db6b97834208bf598db514f2b155042439b62605601a", +- "--hash=sha256:c2d37ab77531417474168eb79d6d80b14f821a966818505d03013d0833edb7a8", +- "--hash=sha256:c4fc99836233ea196540b17ab0983aff60ed07941751930f5f4d05bc3b3b7359", +- "--hash=sha256:d581b735e177fdcdce6fed8e7e8880a3fb6ee4e3653a3ac6af01c6f4c03effc5", +- "--hash=sha256:d6da64deb6b8ed903e7560180a92f2d804ee1ba5eeb849ac2748b8c1aba1f6d7", +- "--hash=sha256:d8e8286dd7cea7895157318d1b91cdacac64c479f3cbc8dce548331728484751", +- "--hash=sha256:ddea102b48f9e339f3948bf22040944184627a30fdf7f858667673b9c5f033c8", +- "--hash=sha256:dfa20cc6ca228e6b155b11da03825975ce66aea520985dbbddf0f2a5a495c605", +- "--hash=sha256:e3e5193ef5a3dc73bceee50f7fdc2c90dbb76c42df8d8fae3d1067a583df579e", +- "--hash=sha256:e3eeb0aabd6bd5ce64faae67e9935203a6991b4bc2a485a767fbafb2c5125f45", +- "--hash=sha256:e5805d5a22fd19c8ccff10a9561f9df94436b0545619ea579db2d3c35294bce2", +- "--hash=sha256:e85b752a1e912b70eaad4fafbd4d1238007ab221de2009b9a2f5ae7461239895", +- "--hash=sha256:eaf7fa2de5c0be8ae6ff8e9bea2ccd725e980541244521d8d4b5f3354a27babe", +- "--hash=sha256:ebfb099f8dcf083deef3ac1ca4c1503f387cf76296fcb3816b66f5ecb5f54fdb", +- "--hash=sha256:ece3d2cfe132e7d51f44a832b303895e6f2d499c5e74dfbdb06ee246147a304a", +- "--hash=sha256:ed9749eef4cbd126da3dc1d6bcb3a57f5eb7ac6a6484146bdbf743f552dfc577", +- "--hash=sha256:ede83e07a75dd06bc501566c1eca2afc0d61677c1472ac9ad93fdee6e638a48d", +- "--hash=sha256:ef4aea96ce4d3b074422cb4f2f64e216bf9e213004bb58ecfdf50ea02ea8eb9a", +- "--hash=sha256:f3a3570c4a2a16746ac2c31a7c7c7b0c186b95ce902e33db6f28094ed7387dda", +- "--hash=sha256:f407cb6b8e9d6d8c626bc73c945db1706035af8fd632295547bf1c9e46d092d6", +- "--hash=sha256:f74a575920ab21fe304421a3fc28793d82e299cae9eccb37084e9fc7f3617c20", ++ "numpy", + ], + ) + +-- +2.50.1 (Apple Git-155) + diff --git a/patches/tensorstore/0.1.85/0004-Ship-zlib-s-cpu_features.c-.h-on-every-arch-not-just.patch b/patches/tensorstore/0.1.85/0004-Ship-zlib-s-cpu_features.c-.h-on-every-arch-not-just.patch new file mode 100644 index 000000000..ecdcefea1 --- /dev/null +++ b/patches/tensorstore/0.1.85/0004-Ship-zlib-s-cpu_features.c-.h-on-every-arch-not-just.patch @@ -0,0 +1,64 @@ +From 4bb15c98deff65911623432214ba55f891045fa4 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sun, 13 Sep 2026 09:07:23 +0200 +Subject: [PATCH] Ship zlib's cpu_features.c/.h on every arch, not just + arm64/x86_64 + +zlib.BUILD.bazel only adds cpu_features.c/.h to srcs on arm64/x86_64 (bundled +in _SIMD_SRCS), but adler32.c, crc32.c and deflate.c each #include +"cpu_features.h" unconditionally, so building for any other cpu (ppc, +riscv64, ...) fails: "fatal error: cpu_features.h: No such file or +directory". cpu_features.c's own arch detection is #if-guarded per arch and +leaves its extern flags at their default 0 otherwise, so the pair is safe to +compile on every platform; only the actual accelerated *_simd.c/.h sources +need to stay gated to arm64/x86_64. This does not enable riscv64's RVV adler32 +path (real, present in this zlib fork, guarded by ADLER32_SIMD_RVV) - that +needs -march=+v applied build-wide with no per-function target isolation in +the vendored source, a correctness tradeoff better left to a follow-up. + +Upstream-Status: To upstream [not submitted from this automated port run; needs a pull request against google/tensorstore] +--- + third_party/zlib/zlib.BUILD.bazel | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/third_party/zlib/zlib.BUILD.bazel b/third_party/zlib/zlib.BUILD.bazel +index 758d193..6dae590 100644 +--- a/third_party/zlib/zlib.BUILD.bazel ++++ b/third_party/zlib/zlib.BUILD.bazel +@@ -20,6 +20,15 @@ cc_library( + + ############################################### + ++# adler32.c, crc32.c and deflate.c #include "cpu_features.h" unconditionally ++# (the arch-specific detection it declares is itself #if-guarded and safe to ++# compile everywhere), so it ships on every arch; only the accelerated *_simd ++# sources need gating to the arches this wrapper actually enables SIMD for. ++_CPU_FEATURES_SRCS = [ ++ "cpu_features.c", ++ "cpu_features.h", ++] ++ + _SIMD_SRCS = [ + "adler32_simd.c", + "adler32_simd.h", +@@ -27,8 +36,6 @@ _SIMD_SRCS = [ + "contrib/optimizations/inffast_chunk.c", + "contrib/optimizations/inffast_chunk.h", + "contrib/optimizations/inflate.c", +- "cpu_features.c", +- "cpu_features.h", + "crc_folding.c", + "crc32_simd.c", + "crc32_simd.h", +@@ -52,7 +59,7 @@ cc_library( + "trees.c", + "uncompr.c", + "zutil.c", +- ] + select({ ++ ] + _CPU_FEATURES_SRCS + select({ + "@platforms//cpu:arm64": _SIMD_SRCS, + "@platforms//cpu:x86_64": _SIMD_SRCS, + "//conditions:default": [ +-- +2.50.1 (Apple Git-155) +