diff --git a/.github/workflows/_build-platform.yml b/.github/workflows/_build-platform.yml index 1070727..562d5c5 100644 --- a/.github/workflows/_build-platform.yml +++ b/.github/workflows/_build-platform.yml @@ -44,7 +44,12 @@ # Stage 2 (build): one leg per (python x arch) of this platform: # tools/build_runtime -> ci/check_symbol_provenance.sh -> # tools/boot_smoke -> the runtime-packages--- -# artifact. The build scripts fetch and sha256-verify every input +# artifact. The boot smoke's compute-floor gate is runner-class-relative +# (tebako#1095's follow-up): a sibling step pair first provisions the +# on-system reference python (setup-python at the leg's base version) +# and times tools/compute_reference_probe.py on THIS runner — the +# per-call-rate ratio's denominator. The build scripts fetch and +# sha256-verify every input # themselves (the pinned source tarball, the pinned link unit, the tfs # CLI) — there is NO source-build path for the driver stack here # (contract.yml's link_unit_release comment), so the ruby factory's @@ -685,16 +690,89 @@ jobs: ci/check_symbol_provenance.sh --exe \ "runtime-packages/tebako-runtime-${{ needs.compute.outputs.tebako_version }}-${{ needs.compute.outputs.lang_infix }}${{ matrix.python }}-${{ matrix.host_id }}.exe" + # --- the compute-floor ratio gate's on-system reference --------- + # The boot smoke's compute-floor tripwire is runner-class-relative + # (tools/boot_smoke's header — tebako#1095's closing verdict + # falsified the fleet-calibrated absolute ceiling: python.org's own + # build reads 4.26-6.66 s fib(35) on the current macos-15-intel + # class, where the tebako pair reads 4.270 s against the + # reference's 4.258 s — parity ≈1.00): each leg gates its fib(35) + # best-of-3 as a per-call-rate ratio against an on-system reference + # measured HERE, on the leg's own runner — setup-python at the + # leg's base version (the covenant's on-system provisioner; a jit + # leg's reference is the plain interpreter — the flavor is a build + # flag) timing tools/compute_reference_probe.py (fib(30), the + # MEDIAN of 25 runs — at ~0.1 s a run, a best-of-3 min samples the + # runner's instantaneous state instead of its sustained rate; the + # first full-matrix run false-red two healthy macos-arm64 legs on + # exactly that class, run 45344792366). The container legs measure + # on the ubuntu host — the container shares the host's silicon. A + # loudly skipped windows leg (the rc-107 carve-out above) measures + # nothing. + - name: Provision the on-system reference python (the compute-floor ratio gate) + if: ${{ matrix.os != 'windows' || steps.build-windows.outputs.skipped != 'true' }} + id: refpy + # The manifest can lag the factory's exact micro pins (3.11.16 / + # 3.12.14 are not carried — run 45344792366): the LINE step below + # is the loud fallback, never a silent skip. + continue-on-error: true + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 (the covenant's pin — the same provisioner, tebako#1095's reference arm) + with: + python-version: ${{ matrix.reference_python }} + + - name: Provision the reference at the line (the manifest lacks the micro) + if: ${{ (matrix.os != 'windows' || steps.build-windows.outputs.skipped != 'true') && steps.refpy.outcome == 'failure' }} + id: refpyline + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version: ${{ matrix.reference_line }} + + - name: Measure the on-system compute reference (fib(30) median-of-25) + if: ${{ matrix.os != 'windows' || steps.build-windows.outputs.skipped != 'true' }} + id: computeref + shell: bash + run: | + set -euo pipefail + py=python3 + command -v python3 >/dev/null 2>&1 || py=python + if [ "${{ steps.refpy.outcome }}" = "failure" ]; then + echo "::notice title=compute-floor reference::setup-python carries no ${{ matrix.reference_python }} — the reference rides the ${{ matrix.reference_line }} line's latest micro (the same interpreter generation)" + fi + # The generation assertion: whatever the provisioning resolved, + # the reference must be the SAME major.minor the leg builds — + # anything else is a wiring bug, named, never a quiet ratio. + got=$("$py" -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') + if [ "$got" != "${{ matrix.reference_line }}" ]; then + echo "::error::the reference python is the $got line, expected ${{ matrix.reference_line }} — the provisioning steps resolved the wrong interpreter generation" + exit 1 + fi + probe_out=$("$py" tools/compute_reference_probe.py) + echo "$probe_out" + median=$(awk '/^median: /{print $2}' <<< "$probe_out") + n=$(awk '/^n: /{print $2}' <<< "$probe_out") + if [ -z "$median" ] || [ -z "$n" ]; then + echo "::error::the reference probe emitted no median:/n: lines — the ratio gate has no denominator" + exit 1 + fi + echo "ref_seconds=$median" >> "$GITHUB_OUTPUT" + echo "ref_n=$n" >> "$GITHUB_OUTPUT" + # The boot smoke self-selects the scenario set per platform (the # POSIX set vs the windows bare + named-error trio) and resolves the # exe from TEBAKO_RUNTIME_ROOT. TEBAKO_TFS names the tfs CLI the # build fetched (the fixture-image scenarios pack with it) — inside # the container legs it is the musl/gnu binary matching the image. + # COMPUTE_FLOOR_REFERENCE_SECONDS/N are the sibling step's same-leg + # on-system measurement (the ratio gate's denominator — above). - name: Boot smoke (container legs) if: matrix.container != null + env: + COMPUTE_FLOOR_REFERENCE_SECONDS: ${{ steps.computeref.outputs.ref_seconds }} + COMPUTE_FLOOR_REFERENCE_N: ${{ steps.computeref.outputs.ref_n }} run: | set -euo pipefail docker run --rm -v "${{ github.workspace }}:/mnt/w" -w /mnt/w \ + -e COMPUTE_FLOOR_REFERENCE_SECONDS -e COMPUTE_FLOOR_REFERENCE_N \ "${{ matrix.container }}" bash -c ' set -e export TEBAKO_RUNTIME_ROOT=runtime-packages @@ -706,14 +784,21 @@ jobs: if: matrix.os == 'macos' env: TEBAKO_RUNTIME_ROOT: runtime-packages - # The compute-floor carve-out (tebako-runtime-python#79): the - # x86_64 legs carry the LIVE ~3x slow-compute defect on real - # Intel silicon (fib(35) 4.0-5.7 s vs the healthy 1.1-1.5 s, - # run 44910482094) whose root cause is the product repo's - # (tebako#1095) — warn-only there so the factory stays green - # while the fix ships; every other leg keeps the fail-closed + # The ratio gate's denominator: the sibling step's same-leg + # on-system measurement (above). + COMPUTE_FLOOR_REFERENCE_SECONDS: ${{ steps.computeref.outputs.ref_seconds }} + COMPUTE_FLOOR_REFERENCE_N: ${{ steps.computeref.outputs.ref_n }} + # The compute-floor warn tier (tebako-runtime-python#79): the + # macos-x86_64 legs ride warn-only as insurance while the + # runner-class-relative ratio gate proves itself — this is the + # fleet class whose move falsified the old absolute ceiling + # (tebako#1095's verdict: parity ≈1.00 against the same-leg + # on-system reference). Every other leg keeps the fail-closed # default (tools/boot_smoke's COMPUTE_FLOOR_MODE contract). - # REMOVAL CONDITION: delete this line when tebako#1095 closes. + # REMOVAL CONDITION: revert the x86_64 legs to fail-closed + # (delete this line) once the ratio gate reads green on two + # consecutive runs on the current fleet — the gate's own + # per-call-ratio log lines are the evidence. COMPUTE_FLOOR_MODE: ${{ matrix.arch == 'x86_64' && 'warn' || 'fail' }} run: | set -euo pipefail @@ -726,6 +811,9 @@ jobs: shell: msys2 {0} env: TEBAKO_RUNTIME_ROOT: runtime-packages + # The ratio gate's denominator (the sibling step, above). + COMPUTE_FLOOR_REFERENCE_SECONDS: ${{ steps.computeref.outputs.ref_seconds }} + COMPUTE_FLOOR_REFERENCE_N: ${{ steps.computeref.outputs.ref_n }} run: | set -euo pipefail TEBAKO_TFS=$(echo .build/downloads/tfs/*/tfs-*) diff --git a/README.md b/README.md index 41a8898..d35d8e2 100644 --- a/README.md +++ b/README.md @@ -475,11 +475,16 @@ platform ships). reports the JIT capability under `PYTHON_JIT=1`, a plain line reports its absence), the `compute-floor` tripwire (a slow BUILD ships green under a boot-only gate — tebako-runtime-python#79; the leg times a - fixed pure-compute loop inside the interpreter and fails past a - generous ceiling — fail-closed everywhere except the macos-x86_64 - legs, which ride warn-only via `COMPUTE_FLOOR_MODE=warn` while the - live defect's root cause ships in the product repo, tebako#1095, and - revert to fail-closed once it closes), and on windows the + fixed pure-compute loop inside the interpreter and gates it as a + per-call-rate ratio (≤1.5x) against a same-leg on-system reference — + the workflow's sibling step provisions setup-python at the leg's base + version and times `tools/compute_reference_probe.py` (fib(30), the + median of 25 runs) on the same runner; tebako#1095's verdict falsified the + old absolute ceiling, which no x86_64 CPython meets on the current + macos-15-intel class — fail-closed everywhere except the macos-x86_64 + legs, which ride warn-only via `COMPUTE_FLOOR_MODE=warn` as insurance + while the ratio gate proves itself, reverting to fail-closed after + two consecutive green runs on the current fleet), and on windows the `alias-closure` self-containment proof (static-import-only pair, the image's declared PE closure, and every boot under a PATH scrubbed to the Windows system directories) diff --git a/contract.yml b/contract.yml index 75f2983..f4dec85 100644 --- a/contract.yml +++ b/contract.yml @@ -115,6 +115,17 @@ macos_deployment_target: "14.0" # GCC's 4-byte padding no longer ships a pre-rename aws-lc export # directive into the windows leg's link (this repo's #53). Contract # unchanged (2). +# KNOWN-BAD (fleet, tebako#1095's side finding): the published v0.3.0 +# pair — this factory's 0.3.0 runtime, link unit v2.8.49 — reproducibly +# WEDGES on the current macos-15-intel fleet, never reaching the +# interpreter (3/3 reproductions: a >=40-minute hang in run 45324096740, +# hard-killed at the 420 s bound in runs 45330380303/45338794570). The +# v0.2.0 (v2.3.2) and v0.3.5 (v2.8.78) pairs boot unaffected on the same +# runners, so the line the factory builds today is clear; the note +# stands for old-line consumers — published pairs stay installable +# forever (spec 05 §2's era law), and a catalog/mop-up rerun of the +# v0.3.0 line would relink the same wedging unit. Old-line consumers on +# that fleet resolve v0.3.5+. # v2.8.53: the lazy mount at both TFS layers (tebako#848) — the preload # shim's TEBAKO_TFS_MOUNTS builder state-detects a LAZY_SEEDING env image # and mounts its caching range source, so a fresh lazy line serves the diff --git a/scripts/compute_matrix.rb b/scripts/compute_matrix.rb index 741bc78..6162d2b 100755 --- a/scripts/compute_matrix.rb +++ b/scripts/compute_matrix.rb @@ -63,6 +63,21 @@ # the build re-verifies it against the # extracted source's Tools/jit/_llvm.py # (the parity arm — PythonBuild's gate) +# reference_python — the on-system reference interpreter's +# version for the compute-floor ratio +# gate's sibling step (the line's +# base_version — a jit leg's reference is +# the PLAIN interpreter of the same +# version; the flavor is a build flag). +# PythonVersion owns the -jit grammar, so +# this flow replaces any workflow-side +# suffix strip (ecosystem SSOT invariant). +# reference_line — the reference's major.minor line +# ("3.14"): the provisioning fallback +# when setup-python's manifest carries no +# exact micro (it lags the factory's pins +# on the older lines), and the measure +# step's generation assertion. # container — the tpkg-builder image ref with # contract.yml's container_version tag # applied, null for the runner-native legs @@ -306,6 +321,8 @@ def usage_error(message) # platform is the runner's, never the artifact's. sign_tool_host_id: (os == "linux-musl" ? "linux-gnu-#{arch}" : host_id), jit_llvm: line.jit? ? line.jit_llvm_major.to_s : "", + reference_python: line.base_version, + reference_line: line.major_minor.join("."), container: container, link_unit_pid: LINK_UNIT_PID.fetch([os, arch]) } diff --git a/tools/boot_smoke b/tools/boot_smoke index fea7722..460c44b 100755 --- a/tools/boot_smoke +++ b/tools/boot_smoke @@ -67,27 +67,51 @@ # the pair runs a fixed pure-compute loop (fib(35), # no I/O in the loop) timed INSIDE the interpreter # (time.perf_counter, best of three — boot/mount -# cost and one-off scheduling noise are excluded), -# and the best run must land under a generous -# ceiling. The ceiling is a regression tripwire, -# never a benchmark (the covenant owns the honest -# tax): healthy legs measured ≈1.1-1.5 s worst-case -# across the matrix (covenant run 44204925939's -# fib(40) rates, rescaled), and the defective -# macos-x86_64 leg's fib(40) ≈54-67 s (covenant run -# 42525964214) rescales to ≈4.8 s at this N — -# 4.0 s separates them with headroom both ways. -# The measured times print unconditionally, so a -# green leg's rate lives in the log. Modes -# (COMPUTE_FLOOR_MODE): "fail" (the default) trips -# the leg; "warn" — armed by the workflow on the -# macos-x86_64 legs ALONE, where the defect is -# LIVE on real Intel silicon (fib(35) 4.0-5.7 s -# across the catalog, run 44910482094) while the -# root cause ships in the product repo -# (tebako#1095) — prints a ::warning:: and keeps -# the leg green. REMOVAL CONDITION: those legs -# revert to fail-closed when tebako#1095 closes. +# cost and one-off scheduling noise are excluded). +# The gate is RUNNER-CLASS-RELATIVE, never an +# absolute seconds ceiling: tebako#1095's closing +# verdict showed the old fleet-calibrated 4.0 s +# ceiling is unachievable on the current +# macos-15-intel class by ANY x86_64 CPython — +# python.org's own build reads 4.26-6.66 s there +# (runs 45324096740/45330380303/45338794570), with +# the tebako pair at parity (4.270 s vs the +# reference's 4.258 s, ratio ≈ 1.00). The reference +# is measured SAME-LEG: the workflow provisions the +# on-system python (actions/setup-python at the +# leg's base version — the covenant's on-system +# provisioner) as a sibling step and times +# tools/compute_reference_probe.py (fib(30), the +# MEDIAN of 25 runs — at ~0.1 s a run a best-of-3 +# min samples the runner's instantaneous state, +# not its sustained rate: the first full-matrix +# run's reference windows spread 29% within +# themselves and false-red two healthy macos-arm64 +# legs, run 45344792366; the covenant's cells gate +# on medians for the same reason), handing the +# measurement down as +# COMPUTE_FLOOR_REFERENCE_SECONDS / +# COMPUTE_FLOOR_REFERENCE_N. The recursive fib's +# call count is exact per N (T(n) = 2*F(n+1) - 1), +# so the two Ns normalize to per-call rates and the +# ratio is a property of the built interpreter +# against the reference on THIS runner — a fleet +# move shifts both arms together. The gate: ratio +# <= 1.5x (a regression tripwire, never a +# benchmark — the covenant owns the honest tax). +# The measured times and the ratio print +# unconditionally, so a green leg's rate lives in +# the log. Modes (COMPUTE_FLOOR_MODE): "fail" (the +# default) trips the leg; "warn" — armed by the +# workflow on the macos-x86_64 legs ALONE, the +# fleet class the stale-ceiling false-reds landed +# on — prints a ::warning:: and keeps the leg +# green while the ratio gate proves itself. +# REMOVAL CONDITION: those legs revert to +# fail-closed once the ratio gate reads green on +# two consecutive runs on the current fleet (the +# gate's own output is the evidence; the stale +# absolute ceiling is gone, never reinstated). # The flags arm is fail-closed in every mode (a # mis-flagged build is a recipe bug, not this # defect class). [all] @@ -220,13 +244,16 @@ MATERIALIZE_BOOT_TIMEOUT = 300 # or pathological one. SOCKET_PROBE_TIMEOUT = 120 # The compute-floor scenario (the header's tebako-runtime-python#79 -# block): fib(COMPUTE_FIB_N) inner-timed, best of COMPUTE_FIB_RUNS. The -# ceiling carries ~3x headroom over the healthy matrix's measured worst -# leg and still catches the #79 defect class (≈4.8 s at this N); a named -# failure, never a flake-shape benchmark bound. +# block): fib(COMPUTE_FIB_N) inner-timed, best of COMPUTE_FIB_RUNS, +# gated as a per-call-rate RATIO against the same-leg on-system +# reference — never an absolute seconds ceiling (the header block's +# runner-class math; tebako#1095's verdict exonerated every tebako +# layer and falsified the fleet-calibrated 4.0 s ceiling the current +# macos-15-intel class moved past). A named failure, never a +# flake-shape benchmark bound. COMPUTE_FIB_N = 35 COMPUTE_FIB_RUNS = 3 -COMPUTE_FLOOR_SECONDS = 4.0 +COMPUTE_FLOOR_MAX_RATIO = 1.5 IMAGE_SUFFIXES = %w[.tfs .dwarfs].freeze MARKER_SUFFIXES = %w[.abi .sha256 .origin .yaml .dll].freeze NON_EXECUTABLE_SUFFIXES = (IMAGE_SUFFIXES + MARKER_SUFFIXES).freeze @@ -248,13 +275,16 @@ end # The compute-floor scenario's mode (its header block): "fail" — the # default, and every leg's shape but one — trips the leg on a breached -# floor; "warn" prints the measurement + a workflow-command ::warning:: +# ratio; "warn" prints the measurement + a workflow-command ::warning:: # and keeps the leg green. The workflow arms "warn" on the macos-x86_64 -# legs ALONE: the live tebako-runtime-python#79 slow-compute defect -# (root cause tebako#1095, the product repo's) would otherwise red every -# factory run until the fix ships. REMOVAL CONDITION: those legs revert -# to fail-closed when tebako#1095 closes. Any other value is a named -# error, never a silent fallback. +# legs ALONE: that is the fleet class the stale absolute ceiling +# false-red on every leg after the runner-class move (tebako#1095's +# verdict exonerated the runtime — parity ≈1.00 against the same-leg +# on-system reference), and the warn tier rides as insurance while the +# ratio gate proves itself. REMOVAL CONDITION: those legs revert to +# fail-closed once the ratio gate reads green on two consecutive runs +# on the current fleet. Any other value is a named error, never a +# silent fallback. COMPUTE_FLOOR_MODE = ENV.fetch("COMPUTE_FLOOR_MODE", "fail") unless %w[fail warn].include?(COMPUTE_FLOOR_MODE) usage_error("COMPUTE_FLOOR_MODE=#{COMPUTE_FLOOR_MODE.inspect} — known: fail (the default), warn") @@ -505,6 +535,18 @@ def windows_system_path "#{root}\\System32;#{root};#{root}\\System32\\Wbem" end +# The naive recursive fib's exact call count — T(n) = 2*F(n+1) - 1 +# (T(0) = T(1) = 1, T(n) = 1 + T(n-1) + T(n-2)). The compute-floor gate +# divides each arm's best by its probe's call count, so the tebako arm's +# fib(35) and the reference arm's fib(30) compare as per-call rates and +# the ratio is a property of the interpreter on the runner class, never +# of the workload sizes. +def fib_calls(n) + a, b = 0, 1 + (n + 1).times { a, b = b, a + b } + 2 * a - 1 +end + KNOWN_SCENARIOS = %w[bare boot payload entrypoint bad-mount materialize-boot alias-closure socket-timeout mp-spawn e-flag mount-root-override mount-root-malformed override-ungranted jit compute-floor].freeze @@ -598,8 +640,9 @@ def run_scenarios(executable, platform, selected, tfs:, line:) # rubocop:disable # call-dominated (fib — the covenant's steady.cpu shape) and timed # INSIDE the interpreter (time.perf_counter around each run): the # boot/mount cost and the harness never enter the measurement, and - # best-of-N drops one-off scheduling noise. The ceiling is a - # tripwire, not a benchmark — the covenant owns the honest ratio. + # best-of-N drops one-off scheduling noise. The gate is a same-leg + # per-call-rate ratio against the on-system reference, not a + # benchmark — the covenant owns the honest tax. # The flags arm pins the hypothesis class itself: a -O0/-Og/debug # build is named outright, before the clock ever runs. unless File.file?(image) @@ -639,19 +682,49 @@ def run_scenarios(executable, platform, selected, tfs:, line:) # rubocop:disable "build ships a slow interpreter green under a boot-only gate (tebako-runtime-python#79)") puts " compute-floor: fib(#{COMPUTE_FIB_N}) #{out[/^runs: (.+)$/, 1]}" best = out[/^best: (\d+(?:\.\d+)?)$/, 1]&.to_f - floor = "compute-floor: fib(#{COMPUTE_FIB_N}) best-of-#{COMPUTE_FIB_RUNS} under #{COMPUTE_FLOOR_SECONDS}s" - detail = "measured best #{best.inspect}s (runs in the log above) — a leg computing at a fraction " \ - "of the matrix's rate is a slow BUILD, never a publishable artifact " \ + # The same-leg on-system reference (the header block): the + # workflow's sibling step times tools/compute_reference_probe.py + # under setup-python at the leg's base version on THIS runner + # (the median of its 25 runs — the seconds-scale sustained-rate + # statistic; the tebako arm's 4 s runs self-average, so its + # best-of-3 stands) and hands the measurement down. Missing or + # malformed is a WIRING failure — named here, never a silently + # degraded gate; a local run gets the exact remediation. + ref_seconds = ENV.fetch("COMPUTE_FLOOR_REFERENCE_SECONDS", nil).to_s + ref_n = ENV.fetch("COMPUTE_FLOOR_REFERENCE_N", nil).to_s + unless ref_seconds.match?(/\A\d+(?:\.\d+)?\z/) && ref_seconds.to_f.positive? && + ref_n.match?(/\A\d+\z/) && ref_n.to_i.positive? + check("compute-floor: the same-leg on-system reference rides the env", false, + "COMPUTE_FLOOR_REFERENCE_SECONDS=#{ref_seconds.inspect} " \ + "COMPUTE_FLOOR_REFERENCE_N=#{ref_n.inspect} — the ratio gate needs the sibling " \ + "step's measurement on this runner; locally: python3 tools/compute_reference_probe.py, " \ + "then export both vars off its median:/n: lines") + next + end + reference = ref_seconds.to_f + reference_n = ref_n.to_i + ratio = best.nil? ? nil : (best / fib_calls(COMPUTE_FIB_N)) / (reference / fib_calls(reference_n)) + ratio_text = ratio.nil? ? "n/a" : format("%.3f", ratio) + puts " compute-floor: reference fib(#{reference_n}) median #{reference}s on-system — " \ + "per-call ratio #{ratio_text} (limit #{COMPUTE_FLOOR_MAX_RATIO}x)" + floor = "compute-floor: per-call rate within #{COMPUTE_FLOOR_MAX_RATIO}x the same-leg " \ + "on-system reference" + detail = "fib(#{COMPUTE_FIB_N}) best #{best.inspect}s vs the reference's fib(#{reference_n}) " \ + "median #{reference}s (runs in the log above) — per-call ratio #{ratio_text}, limit " \ + "#{COMPUTE_FLOOR_MAX_RATIO}x; a leg computing at a fraction of the reference's rate " \ + "is a slow BUILD, never a publishable artifact " \ "(tebako-runtime-python#79)\nstdout: #{out}\nstderr: #{err}" - if best.nil? || best > COMPUTE_FLOOR_SECONDS + if ratio.nil? || ratio > COMPUTE_FLOOR_MAX_RATIO if COMPUTE_FLOOR_MODE == "warn" # The warn tier (the header block + the mode comment): the - # defect is LIVE on this leg's class, the root cause is the - # product repo's — the measurement and a workflow-command - # warning carry it, the leg stays green. - puts "::warning title=compute-floor::fib(#{COMPUTE_FIB_N}) best #{best.inspect}s past the " \ - "#{COMPUTE_FLOOR_SECONDS}s tripwire — the live tebako-runtime-python#79 slow-build defect " \ - "(root cause tebako#1095); this leg rides warn-only until tebako#1095 closes" + # stale-ceiling false-red class lives on this leg's fleet — + # the measurement and a workflow-command warning carry a + # breach, the leg stays green while the ratio gate proves + # itself on the current fleet. + puts "::warning title=compute-floor::fib(#{COMPUTE_FIB_N}) best #{best.inspect}s at " \ + "#{ratio_text}x the same-leg on-system reference (limit #{COMPUTE_FLOOR_MAX_RATIO}x) — " \ + "the tebako-runtime-python#79 slow-build class; this leg rides warn-only until the " \ + "ratio gate reads green on two consecutive runs" puts "warn #{floor}: #{detail}" else check(floor, false, detail) diff --git a/tools/compute_reference_probe.py b/tools/compute_reference_probe.py new file mode 100644 index 0000000..2f60aec --- /dev/null +++ b/tools/compute_reference_probe.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +# frozen_string_literal: true + +# The on-system compute reference probe — the denominator of +# tools/boot_smoke's compute-floor ratio gate (the runner-class-relative +# tripwire; tebako#1095's follow-up). The build workflow runs this probe +# as a SIBLING STEP on the leg's own runner, under the on-system +# reference interpreter (actions/setup-python at the leg's base python +# version — the covenant's on-system provisioner), and hands the +# measurement to the boot smoke as COMPUTE_FLOOR_REFERENCE_SECONDS / +# COMPUTE_FLOOR_REFERENCE_N. An absolute seconds ceiling calibrated on +# one fleet cannot survive a runner-class move (the current +# macos-15-intel class runs EVERY x86_64 CPython — tebako's and +# python.org's alike — past the old 4.0 s ceiling; tebako#1095's closing +# verdict); the per-call-rate ratio against a same-leg reference is the +# honest gate. +# +# The workload is the boot smoke's own shape at a smaller N (fib(30), +# timed INSIDE the interpreter — provisioning, interpreter startup, and +# the harness never enter the measurement). The recursive fib's call +# count is an exact constant per N (T(n) = 2*F(n+1) - 1), so the boot +# smoke normalizes the two Ns to per-call rates before comparing — the +# ratio is a property of the built interpreter against the reference on +# the SAME runner class, never of the fleet's absolute rate. +# +# The statistic is the MEDIAN of 25 runs (best printed for the log): +# fib(30) is ~0.1 s on a healthy runner, and at that scale a best-of-3 +# MIN samples the runner's instantaneous state instead of measuring its +# sustained rate — the first full-matrix run (45344792366) false-red two +# healthy macos-arm64 legs at ratio 1.87/1.95 on reference windows whose +# own three runs spread 29% (0.090/0.116/0.104), minutes of drift away +# from the tebako arm's tight seconds-scale window. The covenant's cells +# gate on medians for the same reason. The tebako arm keeps its fib(35) +# best-of-3 (tebako#1095's follow-up pins it; at 4.5 s a run +# self-averages). 25 runs cost ~3 s on the fast class, ~7 s on the slow +# one — the probe stays tiny. +# +# Usage: +# python3 tools/compute_reference_probe.py +# +# Exit codes: 0 measured · the interpreter's own on any failure. + +import statistics +import sys +import time + +# The reference workload. The workflow's sibling step and tools/boot_smoke +# read these back off the printed n:/runs:/median: lines — they are this +# file's to change, in one place. +N = 30 +RUNS = 25 + + +def fib(n): + return n if n < 2 else fib(n - 1) + fib(n - 2) + + +def one(): + t0 = time.perf_counter() + fib(N) + return time.perf_counter() - t0 + + +def main(): + import sysconfig + + print("COMPUTE-REFERENCE") + print("python:", sys.version.split()[0], "at", sys.executable) + # The build identity, for the apples-to-apples read against the + # factory build's own opt:/CFLAGS report (tools/boot_smoke's compute + # probe): a per-call gap that survives a stable window is a BUILD + # difference (PGO, the tail-calling interpreter, computed gotos), + # and these lines name it in the leg's log. + print("configure:", (sysconfig.get_config_var("CONFIGURE_ARGS") or "")) + print("opt:", (sysconfig.get_config_var("OPT") or ""), + "|", (sysconfig.get_config_var("CFLAGS") or "")) + runs = [one() for _ in range(RUNS)] + print("n:", N) + print("runs:", " ".join(f"{r:.3f}" for r in runs)) + print("best:", f"{min(runs):.3f}") + print("median:", f"{statistics.median(runs):.3f}") + return 0 + + +if __name__ == "__main__": + sys.exit(main())