1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//! Type relations on ops.
//!
//! Every op declares its type contract via composable
//! [`TypeRelation`]s — a small set of high-coverage predicates
//! (`SameElementType`, `Elementwise`, `BroadcastShape`,
//! `ReduceOver`) plus a `Custom` escape hatch. The compiler's
//! TypeSolver walks the graph, instantiates each relation as a
//! constraint node, and resolves every value's TypeNode via a
//! bipartite worklist (TVM Relay shape).
//!
//! Coverage strategy: a library of trait predicates (MLIR pattern)
//! handles ~90% of ops. The remaining ~10% (Reshape, Gather, Concat,
//! anything with structural type effects) use `Custom`. Adding a
//! new op = declaring its `type_relations` in `atomic_opset()`.
use TypeNode;
/// Reference to a port position on an op's input/output list.
/// Indices into `AtomicOpDecl.inputs` / `outputs`.
/// Outcome of running a relation against the solver's current type
/// nodes. The solver's worklist treats each variant differently:
/// `Refined` requeues dependents, `Satisfied` removes the relation,
/// `Defer` parks it for later, `Failed` aborts the solve.
/// One type relation declared on an op. The TypeSolver instantiates
/// each as a constraint node linked to its participating type
/// variables via back-edges.
/// Context passed to a `Custom` relation's `run` function. Borrows
/// from the solver; exposes a read-only view of each participating
/// port's current type resolution. Concrete shape lands when the
/// TypeSolver (T4) materializes.