Skip to content

compiler: SO-3 pipeline carrier + spectral producer, and W5.4 executable placement - #626

Merged
gstoner merged 8 commits into
mainfrom
agent/so3-pipeline-carrier
Aug 25, 2026
Merged

gstoner merged 8 commits into
mainfrom
agent/so3-pipeline-carrier

Conversation

@gstoner

@gstoner gstoner commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Integrates a large concurrent change set (developed in the shared tree by the Codex agent) with the SO-3 work on #625, reconciled to one authority and verified end to end on this box.

Stacks on #625 — that PR's branch is this one's base, so this diff is the incoming work plus the reconciliation. Merge #625 first and this cleans up to just the new material.

What lands

SO-3 — one schedule authority (queue order 3 → closed)

  • Pipeline lowering now requires the digest-bound tessera.pipeline_schedule.v1 carrier and stamps its Schedule Object digest onto functions and communication ops. The scalar-plan/options reconstruction path is deleted from PipelineStageInsertion / PipelineScheduleLegality / PMPasses — precisely the duplicate authority the row named.
  • The spectral producer represents fused stages as registered Graph actions, consumes infer_action_dag, binds roles/resources into the content-addressed Schedule Object, and requires that digest at Schedule→Tile instead of re-deriving a policy hash.
  • MegaMoE (from compiler: SO-3 — the MegaMoE producer consumes inferred dependence edges #625) consumes inferred edges with the hand DAG demoted to a fail-closed coverage oracle.

W5.4-RESHARD-1 — executable placement (queue order 5 → closed)

  • Fixed-point placement derives exact mesh-sized local result types and inserts explicit reshard SSA at the consumer boundary using registered tessera.slice local shards rather than same-shaped fake collectives. Plan digest, subgroup, matching rounds, and the nested-region path survive Graph→Schedule→Tile; a deterministic mock-mesh executor consumes that SSA directly.
  • Stated plainly in the queues: mock execution is not RCCL/multi-process evidence and cannot satisfy DIST-NATIVE-1.

Reconciliation done during the merge

Two defects found while verifying

  1. mypy ratchet break in the new mock-mesh executor (a ufunc-typed binding rebound to a lambda table) — fixed.
  2. check-tessera-ir was RED on main for everyone. tests/tessera-ir/phase2/x86_composed_layout_exec.mlir, added by the merged layout work, has no RUN: line and is fixture data owned by tests/unit/test_x86_composed_layout_exec.py; lit reported it Unresolved and failed the target. Marked UNSUPPORTED: true with the reason — its owning pytest still passes, and the suite is green again.

Evidence (Strix Halo)

C++ ninja -C build all targets clean · phase4 lit 6/6 · full IR lit 356 passed / 0 failed / 55 unsupported (green again after the fixture fix) · focused integration across spectral + sharding + pipeline + MegaMoE + composition + dataflow 87 passed · full Python unit suite 12,754 passed / 0 failed (5,958 skip cleanly in a worktree without a build dir — the C++/device lanes were verified in the build tree above) · mypy 0 · ruff clean · dashboards regenerated and in sync.

Note on the incoming set's own log: it recorded that rg is unavailable on this host — /usr/bin/rg (ripgrep 14.1.0) is in fact installed.

🤖 Generated with Claude Code

gstoner and others added 6 commits August 24, 2026 23:29
Queue order 3's first producer adoption. Before this, the R3 composition
candidate executed MegaMoE's hand-written `_action_dependencies` edges
directly. Now:

* `megamoe_graph_function` represents the chunk pipeline as Graph IR
  using REGISTERED semantics — dispatch/combine are the registered
  ordered collectives (`tessera.moe_dispatch`/`moe_combine`), expert
  compute is pure `tessera.matmul` over its own chunk's dispatch result.
  No edges are written here.
* `megamoe_inferred_composition` derives the production edges through
  `infer_action_dag` (W2.1 dataflow + W2.2 effects) and returns the
  candidate, the inferred DAG, and the parity result.
* The hand-authored plan DAG becomes the declared coverage ORACLE (#31):
  `compare_inferred_action_dag` must show generated edges cover every
  hand edge or construction fails closed, so a generation regression can
  never silently weaken the executed schedule. Additional conservative
  edges (the ordered-collective total order) report separately, per the
  SO-3 acceptance clause.
* The candidate carries the content-addressed `ScheduleObject` built
  from the inferred edges; its digest is deterministic across
  constructions.
* `megamoe_issue_order` is the one deterministic topological order every
  consumer indexes (Kahn + (chunk, phase) tie-break).

`composition_candidate_for_megamoe_plan` keeps its signature and now
routes through the inferred path, so `prune_megamoe_overlap_plans` and
every existing consumer are unchanged at the call site.

Tests (test_megamoe_inferred_dag.py): deterministic topological order
with the overlap property visible; registered-collective semantics in
the Graph representation; coverage of the hand oracle with extras
reported; deterministic ScheduleObject digest; a generation-regression
control that drops the collective semantics and must fail closed; and
the pre-existing total-evidence guard.

Gates: MegaMoE + composition + schedule-object suites 65 pass; the
x86/gfx1151/CPU composition conformance lanes 42 pass (numerics
unchanged, per the SO-3 acceptance); mypy 0; ruff clean; dashboards
regenerated.

Note: a concurrent session is editing this worktree (the spectral half
of SO-3 plus pipeline-stage work), so this commit is path-limited to the
MegaMoE slice and the whole-suite figure is not reported here — the
targeted lanes above are the evidence.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
# Conflicts:
#	docs/audit/compiler/INTEGRATED_COMPILER_PLAN.md
…an identity, record cross-backend

P1 (overlap erased) — CONFIRMED and worse than reported. A 12-action
MegaMoE plan inferred all 66 edges of the complete order, so R3 would
estimate and prune overlap plans as sequential pipelines. Measured three
distinct over-conservatisms in the SHARED inference, each fixed with the
sound rule:

1. ordered collectives serialized against every surrounding op. They
   constrain the order OF COLLECTIVES (all ranks issue them in the same
   relative order), not unrelated local work — data through a collective
   is still ordered by SSA/alias/memory edges. Now collective-to-
   collective only.
2. a registered op declaring `aliasing="none"` had its declaration
   discarded whenever it was effectful, so every collective result was
   assumed to alias hidden state and `unknown_alias_fact` became an
   all-pairs barrier. A declared fact now has its consumer (#29/#30).
3. `has_memory_dependence` returned top for ANY effectful pair. A
   registered pure op touches no hidden state, so with a disjoint alias
   set it cannot depend through memory; two pure ops sharing a read-only
   operand (the weights every expert reads) likewise get no alias edge.

Result: 66 → 36 edges, still covering every hand-oracle edge, with the
extras now collective-ordering only. `combine:0 -> compute:1` and
`compute:0 -> compute:1` are gone; `dispatch:0 -> dispatch:1` and
`combine:0 -> combine:1` remain.

An existing test asserted the old blanket rule for collectives; it is
deliberately replaced by an explicit ordering test (positive: collectives
keep relative order; negative: independent local work floats) plus an
alias-gated memory-dependence test. The other three barrier classes keep
their all-pairs assertion unchanged.

P2 (digest identity) — CONFIRMED: action ids and graph shape are functions
of the chunk COUNT, so plans differing in capacities/buffers/token
ranges/in-flight limit content-addressed identically. The schedule object
now binds `plan.artifact_digest`, which already addresses exactly those
fields; `candidate_id` stays the plan id so pruning keys are unchanged.

P1 (cross-backend) — sync key SO3-INFER-EDGES-2026-08-24 in all four
queues: rocm/x86 parity validated (analysis is prune/rank-only; no
generated code or numerics change), nvidia/apple not-applicable-today with
the inherited-on-adoption reason.

Also resolves the merge conflict with #624 by keeping both queue rows.

Gates: composition-cost + graph-dataflow + MegaMoE suites 71 pass; mypy 0;
ruff clean; generated docs in sync.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…' into tmp/so3-merge

# Conflicts:
#	docs/audit/compiler/INTEGRATED_COMPILER_PLAN.md
…ble placement

Integrates a large concurrent change set (developed in the shared tree by
the Codex agent) with the SO-3 work already on this branch, reconciled to
one authority and verified end to end on this box.

SO-3 — one schedule authority (queue order 3, now closed):
* Pipeline lowering requires the digest-bound `tessera.pipeline_schedule.v1`
  carrier and stamps its Schedule Object digest onto functions and
  communication ops. The scalar-plan/options reconstruction path is DELETED
  from PipelineStageInsertion / PipelineScheduleLegality / PMPasses — the
  duplicate authority the row named.
* The spectral producer represents fused stages as registered Graph actions,
  consumes `infer_action_dag`, binds roles/resources into the
  content-addressed Schedule Object, and requires that digest at
  Schedule→Tile instead of re-deriving a policy hash.
* MegaMoE (already on this branch) consumes inferred edges with the hand DAG
  demoted to a fail-closed coverage oracle.

W5.4-RESHARD-1 — executable placement (queue order 5, now closed): fixed-point
placement derives exact mesh-sized local result types and inserts explicit
reshard SSA at the consumer boundary using registered `tessera.slice` local
shards rather than same-shaped fake collectives; plan digest, subgroup,
matching rounds, and the nested-region path survive Graph→Schedule→Tile; a
deterministic mock-mesh executor consumes that SSA directly. Mock execution
is explicitly NOT RCCL/multi-process evidence and cannot satisfy
DIST-NATIVE-1.

Reconciliation performed while merging:
* ONE S5 authority. The incoming set added `NUMERIC-POLICY-CARRIER-1` at a
  new Order 6 and renumbered Orders 5-14, colliding with `NUMPOL-CARRIER-1`
  (queue row 3b) already merged in #624. The merged row is kept, the
  duplicate row and the renumbering are dropped, and the four backend
  entries that referenced the new name now point at row 3b — Orders 4-14
  keep the numbers the plan and audit prose reference.
* Both cross-backend sync keys are preserved in all four queues:
  SCHEDULE-AUTHORITY-RESHARD-2026-08-24 (this work) and
  SO3-INFER-EDGES-2026-08-24 (the inference-semantics correction).

Two defects fixed while verifying:
* mypy ratchet break in the new mock-mesh executor (a ufunc-typed binding
  rebound to a lambda table).
* `tests/tessera-ir/phase2/x86_composed_layout_exec.mlir`, added by the
  merged layout work, has no RUN line and is fixture DATA owned by
  `tests/unit/test_x86_composed_layout_exec.py` — lit reported it Unresolved
  and `check-tessera-ir` was RED on main for everyone. Marked
  `UNSUPPORTED: true` with the reason; its owning pytest still passes.

Evidence (Strix Halo): C++ `ninja -C build` all targets clean; phase4 lit
6/6; full IR lit 356 passed / 0 failed / 55 unsupported (green again after
the fixture fix); focused integration of the spectral, sharding, pipeline,
MegaMoE, composition and dataflow suites 87 passed; full Python unit suite
12754 passed / 0 failed (5958 skip cleanly in a worktree with no build dir —
the C++/device lanes were verified in the build tree above); mypy 0; ruff
clean; generated dashboards regenerated and in sync.

Co-Authored-By: Codex <codex@openai.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 071a28265a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/tessera/compiler/pipeline_planner.py Outdated
Comment thread src/compiler/programming_model/lib/PMPasses.cpp
Comment thread src/transforms/lib/PipelineScheduleLegalityPass.cpp
…verify spectral policy, validate the pipeline carrier

P1 (interleaved dependencies) — CONFIRMED and quantified. Keying the
Schedule Object's dependency lookup by `(rank, micro_batch, phase)` collides
under interleaving, where one rank owns several virtual stages. Measured on
num_stages=4/num_chunks=2: 64 of 128 steps shared a key and 32 of 56
cross-stage forward steps lost their producer edge, so the emitted carrier
permitted a virtual stage to execute before the stage feeding it. Now keyed
by the virtual stage, with the stage count DERIVED from the emitted schedule
(num_stages x num_chunks, not num_stages). Zero missing producer edges
across interleaved 2-chunk, interleaved 3-chunk, and both non-interleaved
configurations.

The silent ordering filter that hid this now FAILS CLOSED for the forward
chain: a producer ordered after its consumer is a defect, not something to
drop.

Doing so surfaced a deeper planner property, recorded rather than papered
over: the interleaved generator emits backward steps in ASCENDING stage
order (num_stages=2/chunks=2, micro-batch 0: stage 0 B at clock 4 ... stage
3 B at clock 7), which is the opposite of gradient flow, so the
backward-downstream edge cannot be expressed in the emitted order. It is
omitted with a named comment instead of claiming an ordering the schedule
does not realize; fixing the generator is its own change.

P1 (spectral policy fail-open) — CONFIRMED. Comparing `artifact_hash` to the
module digest does not bind the attributes the pass then consumes: a cached
or hand-edited program can keep BOTH digest strings and still change
`workspace_bytes` or `native_entry`, which the native launch uses. The
producer now carries the consumed policy as `tessera.spectral_semantic` and
the Schedule->Tile consumer re-verifies workspace_bytes, native_entry, and
normalization against it, failing closed on a mismatch or an absent payload.
Binding the payload into `schedule_digest` itself (so the pair cannot be
co-edited) needs the Schedule Object identity extended — recorded as
follow-up, not claimed here.

P2 (carrier validation) — CONFIRMED. The legality pass called the step array
the executable authority while checking only that it was non-empty. It now
parses the rows and rejects duplicate action ids, malformed rows, dangling
dependencies, a producer the carrier orders no earlier (cycle or
producer-after-consumer), and stages/micro-batches that disagree with the
declared dimensions.

Also: the spectral end-to-end tests were SKIPPING (CI's unit lane is
Python-only, and a worktree has no build), so they had never actually run.
Executed here against a real tessera-opt — 10/10 including the two new
fail-closed proofs.

Gates (Strix Halo): ninja all targets clean; phase4 lit 6/6; full IR lit 356
passed / 0 failed; pipeline + sharding + spectral suites 58 + 10 passed with
tessera-opt live; full Python unit suite 12759 passed / 0 failed; mypy 0;
ruff clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gstoner

gstoner commented Aug 25, 2026

Copy link
Copy Markdown
Owner Author

All three findings verified and fixed in 5662c3e — the first one was worse than reported, and chasing it surfaced a fourth issue.

P1 (interleaved dependencies) — confirmed and quantified. On num_stages=4/num_chunks=2, 64 of 128 steps shared a key and 32 of 56 cross-stage forward steps lost their producer edge, so the carrier genuinely permitted a virtual stage to run before the stage feeding it. Now keyed by the virtual stage, with the stage count derived from the emitted schedule (num_stages × num_chunks — the old stage + 1 < num_stages bound was wrong for interleaving too). Zero missing producer edges across interleaved 2-chunk, 3-chunk, and both non-interleaved configs. The silent ordering filter that hid this now fails closed for the forward chain.

A deeper planner property this exposed, recorded rather than papered over: the interleaved generator emits backward steps in ascending stage order (num_stages=2/chunks=2, micro-batch 0: stage 0 B at clock 4 … stage 3 B at clock 7) — the opposite of gradient flow — so the backward-downstream edge is inexpressible in the emitted order. I omit it with a named comment instead of asserting an ordering the schedule doesn't realize; fixing the generator is its own change, not a review fix.

P1 (spectral fail-open) — confirmed. Fixed as you suggested: the producer now carries the consumed policy as tessera.spectral_semantic, and the Schedule→Tile consumer re-verifies workspace_bytes, native_entry, and normalization against it, failing closed on mismatch or absence. Pinned by a test that changes workspace_bytes while leaving both digests intact. Being precise about the limit: binding the payload into schedule_digest itself (so the pair can't be co-edited) requires extending the Schedule Object identity — recorded as follow-up, not claimed.

P2 (carrier validation) — confirmed and implemented. The legality pass now parses the rows and rejects duplicate ids, malformed rows, dangling dependencies, a producer ordered no earlier (cycle / producer-after-consumer), and stages or micro-batches disagreeing with the declared dimensions.

Fourth issue found while verifying: the spectral end-to-end tests were skipping everywhere — CI's unit lane is Python-only and a worktree has no build — so they had never actually executed. Run here against a real tessera-opt: 10/10, including the two new fail-closed proofs.

Gates: ninja all targets clean · phase4 lit 6/6 · full IR lit 356 passed / 0 failed · pipeline + sharding + spectral suites 58 + 10 with tessera-opt live · full Python unit suite 12,759 passed / 0 failed · mypy 0 · ruff clean.

🤖 Generated with Claude Code

The new spectral fail-closed proofs and the pipeline-carrier regression
tests move spectral_filter's direct-test-reference counts, which the CI
drift gate compares byte-for-byte.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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