Skip to content

Add a batch cost runner for compiled raster graphs, with a live measurement of chained gates - #51

Merged
noelEOS merged 6 commits into
mainfrom
raster/cost-run
Nov 16, 2026
Merged

noelEOS merged 6 commits into
mainfrom
raster/cost-run

Conversation

@noelEOS

@noelEOS noelEOS commented Nov 16, 2026

Copy link
Copy Markdown
Owner

A tool, tools/raster_cost_run.py, that measures what compiled raster graphs cost as batch exports, in EECU-seconds, with the record of one live run: chains of squeeze-excitation gates in one graph against the same chain cut into stages. Tool, tests and evidence only: no block, compiler, converter, record, status, default or graph changes, and no reader documentation.

  • The tool. A case is a module, or a list of stage modules, with its input, grid and bands, compiled with compile_model. Each task exports one graph to one new image asset.
    • plan is offline and deterministic: every task, asset name, request size and hash, the calls by kind with their caps, and the conditions that can remove a task.
    • run submits one task at a time and is resumable. It never resubmits or overwrites, cancels a task at a wall or queue limit, and stops at an EECU budget.
    • compare fetches each saved image once and compares it with float32 PyTorch.
    • report is offline: each task's cost and times, and a reading whose rule is fixed before the run.
  • The cases. The stand-in of the se_chain fixtures, unchanged: residual blocks with a squeeze-excitation gate, on 8 channels, with integer-generated inputs and weights and a seed per case. Gated chains of 1, 2, 4, 8 and 16 blocks, controls of 2 and 8 blocks without the gate, a repeat of the 4-block chain, an 8-block chain as four stages of two, and two chains at 64 × 64.
  • Reuse. The export request, the call guard and the asset, operation and lock checks come from tensor_ee/converter/, unmodified; seven of them are its private helpers, imported by name. The converter's own runner is not reused: it needs a block graph, a plan and a table manifest, and never cancels a task.

Base revision: b20a69b2 (main).

Changes by layer

  • Tools: tools/raster_cost_run.py (new).
  • Tests: tests/test_raster_cost_run.py (new, 35 tests, against a fake client; zero cloud calls).
  • Evidence: docs/evidence/raster-gate-cost-live.json (the tool's report output, unedited).

Checks on the head commit

Run locally on 7a46457 with a clean tree (Python 3.14, all extras, trained checkpoints present):

  • G1: 45 of 45 graphs equal (9 trained, 36 fixtures, none skipped).
  • G1-ext: 19 of 19 graphs equal.
  • Both gates at the base: 45 of 45 and 19 of 19, run on b20a69b2 before the first edit.
  • pytest -q: 4173 passed, 20 skipped.
  • Catalogue check: in sync.
  • --plan se_chain: its planned graph hashes equal those of the live record 20261116T022247Z-se_chain.json.
  • raster_cost_run.py plan --cases base,screen_size,long: 16 tasks, largest request 1,598,313 bytes (limit 9,500,000), zero cloud calls; the 16 request hashes equal those of the revision that ran live.
  • Existing raster selections: the --plan graphs and request counts of calibration, p02, hard_activations, batch_norm, bilinear, grouped_conv, standardize, global_pool_multiply and padded_conv are identical to the base's (checked at 118bb86; the later commit adds only the evidence file).

Not reproduced locally: the hosted jobs on Python 3.11 and 3.12 without extras.

Live run

One run of base,screen_size,long on the clean revision 118bb86: 16 tasks, 16 of 16 verified, no guard tripped, no resume. Calls: exportImage 16, getAsset 34, getOperation 100, createFolder 1, cancelOperation 0, computePixels 16. Limits: budget 1,800 EECU-seconds, 900 s per task, 1,800 s in the queue. Total: 1,530.4 EECU-seconds.

Task, 128 × 128 × 8 unless stated EECU-seconds Run seconds Live: Earth Engine vs float32 PyTorch
input 0.44 11 equal bit for bit
control, 2 blocks 4.09 43 2.38e-07
gated, 1 block 1.18 12 1.19e-07
gated, 2 blocks 3.93 18 2.38e-07
8 gated blocks as 4 stages of 2 4.77, 5.38, 10.78, 4.00 (sum 24.92) 12, 16, 41, 15 2.38e-07, 3.58e-07, 3.58e-07, 4.77e-07
gated, 4 blocks 21.23 31 2.98e-07
gated, 4 blocks, fresh weights 21.22 15 2.38e-07
control, 8 blocks 12.73 37 4.77e-07
gated, 8 blocks 204.53 184 4.77e-07
input, 64 × 64 0.19 14 equal bit for bit
gated, 1 block, 64 × 64 0.85 11 1.19e-07
gated, 8 blocks, 64 × 64 56.57 104 3.58e-07
gated, 16 blocks 1,178.54 353 5.96e-07

The cases have no NumPy mirror in the tool, so the live comparison is with PyTorch only. The cost and the numerical agreement are separate claims.

What the costs show, and what they do not

  • One graph against stages, measured: 8 gated blocks cost 204.5 EECU-seconds as one graph and 24.9 as four stages of two, 8.2 times less.
  • The gates are what costs: 8 blocks without gates cost 12.7.
  • Growth of one graph: 3.3, 5.4, 9.6 and 5.8 times per doubling of the chain. Not linear, not a doubling per gate, and not one power law.
  • Map size: four times the pixels cost 3.6 times more at 8 gates and 1.4 times more at 1 gate.
  • The reading in the record: "not one graph", with Q = 131 against a threshold of 2. Q divides a projection to 26 gated blocks by the best staging, which it takes from the 1-block chain, one small task. With the measured staged run as the staging cost, Q is 29 to 50.
  • Noise: the record's noise figure comes from one repeat (0.05%) and understates the noise of small tasks: the four same-shaped stages cost 4.0 to 10.8, and the 2-block control cost more than the 2-block gated chain. The fixed and per-block costs derived from the controls are not reliable. The comparisons above do not rest on them.

Limitations

  • Stand-in only. 8 channels, two map sizes, inline weights. No statement about any whole model's absolute cost follows; the projection to 26 blocks is on the stand-in.
  • Staging as measured is stages of two blocks in a plain chain. Longer or unequal stages, skips crossing a cut, tasks per chip and wall time per chip were not measured.
  • Not exercised live: a wall or queue limit, so cancelOperation and what a cancelled task reports; a resume; a missing parent folder (one level was created, its parent existed).
  • Private helpers. The tool imports underscore-named helpers from tensor_ee/converter/run.py; a change there can break it, which its tests would show.
  • The record does not carry the revision that ran; it is stated above.

…evels, compare reruns

- The reading gives no decision when the run ended before the costs it needs.
- The 16-block chain runs last, after the screen-size cases.
- Every missing folder level of the asset root is created top down, read again after an
  interruption at its intent.
- compare's cap leaves room for a rerun after a failed fetch.
- An unused import is removed.
The report of one run of tools/raster_cost_run.py (base, screen_size, long) on the
revision before this one: 16 exports, each task's EECU-seconds and times, the comparison
of every saved image with float32 PyTorch, and the reading. Unedited tool output.
@noelEOS
noelEOS enabled auto-merge (squash) November 16, 2026 07:27
@noelEOS
noelEOS merged commit 18e9365 into main Nov 16, 2026
3 checks passed
@noelEOS
noelEOS deleted the raster/cost-run branch November 16, 2026 07:43
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