Repository navigation
Commit ded2e4d
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 retained only to raise,
so a downstream override fails loudly instead of being silently ignored.
- `recipes.OTFCompileWorkflow` becomes `backend.CompilePipeline` and spells out
its three steps; `otf.recipes` and `otf.toolchain` are deleted.
- 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`'s
body is unchanged; it loses only the mixin bases, and with them `.replace` and
`.chain`.
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, with no compatibility aliases: the deleted combinators and the
`otf.recipes` / `otf.toolchain` modules, `.replace()` / `.chain()` on the
classes that kept them via the mixins, 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 658a51e commit ded2e4d
32 files changed
Lines changed: 566 additions & 919 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 | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
| 146 | + | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
| 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 | + | |
50 | 35 | | |
51 | | - | |
| 36 | + | |
52 | 37 | | |
53 | 38 | | |
54 | 39 | | |
| |||
61 | 46 | | |
62 | 47 | | |
63 | 48 | | |
64 | | - | |
| 49 | + | |
65 | 50 | | |
66 | 51 | | |
67 | 52 | | |
| |||
70 | 55 | | |
71 | 56 | | |
72 | 57 | | |
73 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
74 | 61 | | |
75 | 62 | | |
76 | 63 | | |
| |||
89 | 76 | | |
90 | 77 | | |
91 | 78 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
101 | 84 | | |
102 | 85 | | |
103 | 86 | | |
| |||
106 | 89 | | |
107 | 90 | | |
108 | 91 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
125 | 98 | | |
0 commit comments