Repository navigation
Commit 706dcba
committed
refactor[next]: replace workflow combinators with explicit typed pipelines
The workflow-combinator framework introduced by ADR 0011 had grown to a dozen
abstractions to express what is, in the end, function composition. Measured
against actual use, only `CachedStep` was a deep module; the rest were shallow
wrappers around `Callable[[S], T]`, and the reflection loop in
`NamedStepSequence.__call__` was `Any`-typed, defeating the static typing
ADR 0011 prized.
The named pipelines become plain frozen dataclasses with an explicit, fully
typed `__call__`:
- `backend.Transforms` keeps its input-dependent step *selection* — the `match`
that used to live in `step_order` now lives in `__call__`, where the order is
literally readable — and the `step_order` method is gone.
- `recipes.OTFCompileWorkflow` is renamed `backend.CompilePipeline` (the rename
ADR 0027 deferred to this PR) and spells out its three steps.
- Both take over emitting the `stage_hook` added in the previous PR. Names,
order, count and artifacts are unchanged; the two instrumentation tests that
assert the exact stage sequences pass unmodified, which is the proof.
Steps are now plain callables, named by the `workflow.Step[S, T]` alias, and
customization stays composition-time via `dataclasses.replace`. Deleted:
`Workflow`, `ChainableWorkflowMixin`, `ReplaceEnabledWorkflowMixin`,
`NamedStepSequence`, `MultiWorkflow`, `StepSequence`, `make_step`, `.chain`,
the three adapters in `otf.toolchain`, and the five `adapted_*_factory`
wrappers whose only job was to wrap a function into an adapter. `CachedStep` is
kept as-is. `otf.recipes` and `otf.toolchain` become one-release shims.
Because steps no longer need to be adapter objects, the seven ffront factories
collapse to returning either the bare function or a `CachedStep` around it, and
the three per-step callers in `decorator.py` lose their wrap/unwrap dance.
What ADR 0011's decisions become: named steps with a visible order are now
dataclass fields plus an explicit `__call__`; statically typed composition is
checked end-to-end instead of through an `Any`-typed reflection loop;
customization at composition time is `dataclasses.replace`; and steps still
compose across backends because every existing step already satisfies
`Step[S, T]`.
No behavior change, and — unlike the naming PR — no persistent cache key
rotates: fingerprints embed a class's qualified name and fields but never its
bases, and neither renamed pipeline is reachable from a persistent cache's
fingerprint graph.
Breaking for downstream: subclassing the deleted combinators, overriding
`Transforms.step_order`, `roundtrip.foast_to_gtir_step` (now a data-only step),
and `linter_factory(adapter=...)` (the parameter was accepted and ignored).
Claude-Session: https://claude.ai/code/session_01R8zRtFMhdJ8c96XJYCXkRk1 parent 1c59da0 commit 706dcba
32 files changed
Lines changed: 606 additions & 892 deletions
File tree
- docs
- development/ADRs/next
- user/next/advanced
- src/gt4py/next
- ffront
- past_passes
- instrumentation
- otf
- compilation
- program_processors
- codegens/gtfn
- runners
- dace
- workflow
- tests/next_tests
- integration_tests/feature_tests
- instrumentation_tests
- otf_tests
- unit_tests
- otf_tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
| 121 | + | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 14 | + | |
23 | 15 | | |
24 | 16 | | |
25 | | - | |
26 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
27 | 20 | | |
28 | 21 | | |
29 | 22 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 23 | + | |
42 | 24 | | |
| 25 | + | |
43 | 26 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
47 | 32 | | |
48 | 33 | | |
49 | 34 | | |
| |||
56 | 41 | | |
57 | 42 | | |
58 | 43 | | |
59 | | - | |
| 44 | + | |
60 | 45 | | |
61 | 46 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
65 | 50 | | |
66 | 51 | | |
67 | 52 | | |
68 | 53 | | |
69 | 54 | | |
70 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
71 | 58 | | |
72 | 59 | | |
73 | 60 | | |
| |||
86 | 73 | | |
87 | 74 | | |
88 | 75 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
98 | 81 | | |
99 | 82 | | |
100 | 83 | | |
| |||
103 | 86 | | |
104 | 87 | | |
105 | 88 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
122 | 95 | | |
0 commit comments