Skip to content

feat(toolchain): publish per-chip Xtensa slices for linux-arm64, macos* and win32 #1956

Closed

Description

@zackees

Follow-up to #1944 (closed: ESP32-S3 first install now 3.37 min / 237.0 MB on the
official benchmark, target met on linux-amd64 only).

What is published today

site/mirror/shards/esp-toolchain.json carries @esp-toolchain slices for
linux-amd64 only: esp32s3 106,462,349 B, esp32s2 106,655,161 B,
esp32 141,361,956 B (uploaded by ci/publish_toolchain_slices.py, verified
--verify). Every other host package in the vendor metadata (linux-arm64,
linux-armel, linux-armhf, linux-i686, macos, macos-arm64, win32)
has no slice entry, so those clients keep downloading the whole ~176 MB unified
archive. That is the documented fallback, not a failure -- but it is where the
remaining install-time win is.

Why this is not a mechanical loop over hosts

publish_toolchain_slices.py is deliberately a separate invocation per host
("a slice holds that host's compilers"). The uploader's --verify re-downloads
and hashes, which proves bytes, not correctness. #1949/#1953 were only
accepted on linux-amd64 after a real end-to-end build proved the slice was not
a degraded toolchain (build succeeded in 65.1s, identical flash 355899 / ram 74919 to the whole-archive build). A slice is authoritative once listed
(crates/fbuild-packages-fetch/src/variants.rs: a listed slice fails the install
instead of quietly falling back), so a slice missing one chip-specific library
would convert a working whole-archive install into a hard failure for every user
on that host.

Work

  1. For each host, download that host's archive from the vendor URL in
    tools/@esp-toolchain metadata, extract, and slice with
    ci/slice_toolchain.py; confirm the file set against the amd64 slice layout.
  2. Prove it the way amd64 was proven: one real ESP32-S3 build from an empty
    cache on a machine of that OS/arch (CI runner or the owner's host), asserting
    build succeeded and firmware flash/ram sizes identical to the
    whole-archive build.
  3. Only then list the entry in the shard. linux-arm64 first (CI runners,
    arm Linux devs), then macos-arm64, then win32; linux-armel/armhf/i686
    are almost certainly not worth the bytes.

Guardrails: additive only (a chip with no slice keeps the fallback), never list
an entry that has not been proven by a build on that host, and re-check
ci/publish_toolchain_slices.py --check so the Index descriptor stays honest.

Activity

  1. added
    enhancement
    on Nov 8, 2026
  2. zackees commented on Nov 8, 2026

    @zackees
    MemberAuthor

    Attempted the linux-arm64 arm of this today. Two results:

    The proof host exists. ubuntu-24.04-arm GitHub-hosted runners work for this
    repository, and PyPI ships an fbuild manylinux_2_17_aarch64 wheel, so
    uv tool install fbuild==<v> gives a complete arm64 fbuild with no soldr and no
    host build. Two cold-cache ESP32-S3 Blink builds there: build succeeded in 100.5 s / 98.5 s, flash 356075 / ram 74919 — the same numbers as the
    linux-amd64 whole-archive build.

    But step 2 is blocked, and the blocker is not arm64. With
    FBUILD_MIRROR_MANIFEST_URL pointed at a manifest that lists the linux-arm64
    slice, fbuild still downloaded the vendor whole archive and created no
    …+esp32s3 install dir. The same happens on linux-amd64, where the slice IS
    published and proven — so the override itself does not move slice resolution.
    Filed as #1961 with both logs. Until that is fixed there is no way to prove a new
    host's slice before listing it, which is exactly the ordering this issue forbids
    breaking ("never list an entry that has not been proven by a build on that host").

    Published but deliberately not listed: the linux-arm64 bundle
    (xtensa-esp-elf-14.2.0_20260121-aarch64-linux-gnu.tar.xz, 171,504,672 B, sha256
    matches the metadata pin) and its esp32s3 slice (104,408,554 B) are in the
    bucket, unreferenced by any shard. Nothing resolves them until the entry lands.

    Also fixed while doing this: the uploader keyed the mirrored bundle off the
    operator's local file name, so the bundle first landed at
    …/linux-arm64/whole/arm64.tar.xz while the shard listed the vendor filename
    (orphan deleted) — PR #1962, with the arm64 proof harness that will turn green
    once #1961 is fixed.

  3. zackees commented on Nov 8, 2026

    @zackees
    MemberAuthor

    linux-arm64: done — listed and proven (PR #1965, merged ededbdf1).

    site/mirror/shards/esp-toolchain.json now carries
    toolchain-xtensa-esp-elf/14.2.0_20260121/linux-arm64 with the esp32s3
    slice (104,408,554 B vs the 171,504,672 B whole archive). Chips stay additive:
    esp32/esp32s2 and every non-Xtensa target keep the whole-archive fallback.

    Proof, on a real ubuntu-24.04-arm runner
    (run 42526030221,
    all steps green), two cold builds:

    slice: flash 356075 / ram 74919   (build succeeded in 17.7s)
    whole: flash 356075 / ram 74919   (build succeeded in 59.1s)
    slice build used the per-chip install and downloaded no whole archive
    

    Sizes alone were not accepted as proof — earlier runs produced identical sizes
    on builds that never touched the slice. The assertion also requires a
    …+esp32s3 install directory and no whole .tar.xz in the slice build's
    cache.

    Two things worth recording:

    1. The proof harness had to build the client from the ref instead of
      uv tool install fbuild==2.5.51: that release predates fix(toolchain): scope registry-resolved toolchain to its MCU chip (slice was never selected) #1963, so its wheel
      ignores FBUILD_MIRROR_MANIFEST_URL (bug(ci): FBUILD_MIRROR_MANIFEST_URL does not move slice resolution — a new host slice cannot be proven before it is listed #1961) and would have "passed" without
      ever resolving the slice.
    2. The published arm64 objects were re-verified before listing: re-slicing the
      metadata-pinned vendor bundle reproduced the bucket sha
      15e485dddf36539aca26627491961426a589e33c60f8f99fceba2e8e3cd33cda exactly,
      and the whole bundle's sha 80ae10ce… matches its pin.

    Remaining from this issue: macos-arm64, then win32. Both need their own host
    proofs; linux-armel/armhf/i686 are probably not worth the bytes. The harness
    (.github/workflows/esp32s3-arm64-slice-proof.yml) is the template — a macOS
    runner would need runs-on: macos-14 plus its own manifest override, since the
    slice is host-specific.

  4. zackees commented on Nov 9, 2026

    @zackees
    MemberAuthor

    macos-arm64: done — listed and proven (PR #1966, merged 246b042e).

    site/mirror/shards/esp-toolchain.json now carries
    toolchain-xtensa-esp-elf/14.2.0_20260121/macos-arm64 with the esp32s3
    slice: 96,028,501 B vs the 170,666,656 B vendor package (-44%). The whole
    bundle is mirrored bucket-first as the shard contract requires. Chips stay
    additive — esp32/esp32s2 and every other host keep the whole-archive
    fallback.

    Proof, run 42536361264,
    both legs green:

    macos-15 (macos-arm64)      slice flash 356075 / ram 74919  (31.1s)
                                whole flash 356075 / ram 74919 (105.6s)
    ubuntu-24.04-arm (re-run)   slice 356075/74919 (17.4s) / whole 356075/74919 (60.6s)
    

    Both legs also require a chip-scoped …+esp32s3 install directory and no
    whole .tar.xz in the slice build's cache — sizes alone are not accepted as
    proof.

    Two things worth recording:

    1. A new workflow_dispatch harness cannot be proven from its own branch.
      GitHub resolves the workflow id against the default branch, so
      gh workflow run <new-file> --ref <branch> 404s with "not found on the
      default branch". The macOS proof therefore rides on the already-dispatchable
      esp32s3-arm64-slice-proof.yml, which is now a two-leg matrix
      (ubuntu-24.04-arm → linux-arm64, macos-15 → macos-arm64) with the
      host/arch assertion and cache key parametrised. The Linux leg is re-run and
      still byte-identical.
    2. Slicing for a foreign host is fine on any host. Selection is by path
      component (lib/esp32s3, …), so the macOS package sliced identically on
      Linux; only the proof needs the real macOS machine. The vendor bundle was
      pinned first (sha256 a450db49… from tools.json) and both uploaded objects
      were HEAD-checked before the shard named them.

    Remaining: win32 (413 MB zip; needs a Windows host proof). linux-armel /
    linux-armhf / linux-i686 still look not worth the bytes.

  5. zackees commented on Nov 9, 2026

    @zackees
    MemberAuthor

    win64: done — listed and proven (PR #1967, merged 57ef016c).

    First, a correction worth having in the record: this issue asks for win32, but
    fbuild never resolves win32. detect_platform()
    (crates/fbuild-toolchain/src/toolchain/esp32_metadata.rs) returns "win64" on
    every Windows host — there is no 32-bit Windows target. Worse, the publisher
    rejected the key that matters:

    $ ci/publish_toolchain_slices.py --host win64 ...
    ValueError: win64: metadata lists 0 host packages (have: linux-amd64, ..., win32)
    

    HOST_KEYS carried the vendor's win32 and not win64, so the one Windows key
    clients actually resolve could not be published at all. Fixed in code: win64
    added, plus HostKeyParityTests which reads detect_platform() out of the Rust
    source and fails when a key it can return is missing from HOST_KEYS
    (assertEqual(keys - HOST_KEYS, set())) — the class of bug, not the instance. No
    win32 slice was produced: it would be downloaded by nobody.

    site/mirror/shards/esp-toolchain.json now carries
    toolchain-xtensa-esp-elf/14.2.0_20260121/win64 with the esp32s3 slice:
    108,967,431 B vs 413,859,845 B whole (−73.7%; the Windows bundle is a zip of a
    1.4 GB tree). The whole bundle is mirrored bucket-first and byte-identical to the
    tools.json pin (82cbe035…), both objects range-verified after upload, and
    --check re-hashes the shard (Index descriptor 5ac459de…, 5,073 B). Chips stay
    additive: esp32/esp32s2 keep the whole-archive fallback.

    Proof, run 42547282445,
    all three legs green:

    win64 (windows-latest)   slice flash 356075 / ram 74919   (build succeeded in 51.2s)
                             whole flash 356075 / ram 74919   (build succeeded in 175.1s)
    macos-15 / ubuntu-24.04-arm   previous hosts, unchanged legs: success
    

    Both halves of the contract asserted, not just sizes: a …+esp32s3 chip-scoped
    install directory and no whole xtensa-esp-elf archive in the slice build's
    cache.

    Two things worth recording:

    1. The proof harness had to become host-agnostic rather than Windows-only: job-level
      shell: bash (Git Bash on the runner), a matrix-driven daemon name
      (fbuild-daemon.exe), and a "no whole archive" assertion keyed on the vendor
      asset name — the Windows bundle is a .zip, while a registry platform zip in
      the same cache is legitimate. The file is still named
      esp32s3-arm64-slice-proof.yml because workflow_dispatch resolves the
      workflow id on the default branch, and renaming would 404 every dispatch.
    2. Per-host status now: linux-amd64 (esp32/esp32s2/esp32s3), linux-arm64,
      macos-arm64, win64 (esp32s3). Remaining: whole-archive fallback by design
      for linux-armel/armhf/i686 (not worth the bytes, per this issue) and for
      macos (Intel) — that one could be added the same way if anyone is still on
      Intel macOS. Leaving this open for that call.
  6. zackees commented on Nov 9, 2026

    @zackees
    MemberAuthor

    Intel macos: done — listed and proven (PR #1968, merged f38dd493).

    site/mirror/shards/esp-toolchain.json now carries
    toolchain-xtensa-esp-elf/14.2.0_20260121/macos with the esp32s3 slice:
    99,848,668 B vs the 177,355,744 B vendor package (-43.7%). Intel macOS resolves
    macos (not macos-arm64) from detect_platform(), so that is the key those
    clients download. Whole bundle mirrored bucket-first (sha 02e5e342… == the
    metadata pin), both objects range-verified, --check matches the Index descriptor.

    Proof, run 42557951888,
    macos-15-intel (x86_64) leg green alongside linux-arm64 / macos-arm64 / win64:

    macos (macos-15-intel)   slice  flash 356075 / ram 74919  (build succeeded in 337.7s)
                             whole  flash 356075 / ram 74919  (build succeeded in 303.8s)
    

    The leg also requires a +esp32s3 chip-scoped install and no whole
    xtensa-esp-elf archive in the slice cache — sizes alone were never accepted as
    proof. (Wall times here are runner/network variance, not a claim of speedup; the
    install-time win on this host is still the smaller download.)

    Every host this issue scoped is now published and proven: linux-amd64,
    linux-arm64, macos-arm64, macos, win64 (Windows resolves win64, never
    the vendor's win32 — see the previous comment). Closing as complete.
    linux-armel / linux-armhf / linux-i686 remain unsliced on purpose, as this
    issue itself judged them "almost certainly not worth the bytes"; if one ever
    matters, it is one ci/publish_toolchain_slices.py --host <key> invocation plus
    a leg in esp32s3-arm64-slice-proof.yml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions