@@ -10,7 +10,7 @@ constraints/bounds in the system for that operation (e.g., the output of a
10
10
valuable constraints that could be captured even without full knowledge of the
11
11
shape.
12
12
13
- Type inference is currently modelled executionally for op creation using the
13
+ Type inference is currently modelled executionally for operation creation using the
14
14
[ ` InferTypeOpInterface ` ] [ InferTypeOpInterface ] , while
15
15
` InferShapedTypeOpInterface ` is used to implement the shape and element type
16
16
inference. The return type can often be deduced from the deduced return shape
@@ -27,7 +27,7 @@ Initially the shape inference will be declaratively specified using:
27
27
* Constraints on the operands of an operation directly. For example
28
28
constraining the input type to be tensor/vector elements or that the
29
29
elemental type be of a specific type (e.g., output of computing the size
30
- of a value is of elemental type ` i1 ` ) or class (e.g., float like).
30
+ of a value is of elemental type ` i1 ` ) or class (e.g., float- like).
31
31
* Constraints across operands and results of an operation.
32
32
33
33
- For example, specifying equality constraints on type/constituents of a
@@ -41,7 +41,7 @@ exceptional case.
41
41
## Testing
42
42
43
43
Shape inference is currently tested alongside type inference by
44
- ` TestReturnTypeDriver ` in the test dialect. The driver performs two checks:
44
+ ` TestReturnTypeDriver ` in the test dialect. This driver performs two checks:
45
45
46
46
1 . Verification that the return types specified matches the infered types. This
47
47
explicit check will be removed and made part of Op verification instead.
@@ -63,7 +63,7 @@ This will focus on the shape functions (e.g., determine the rank and dimensions
63
63
of the output shape). As shown in the shaped container type, shape will be one
64
64
of 3 components, the others being elemental type and attribute (which is
65
65
currently left open with the intention of supporting extensions such as layouts
66
- or bounded shapes). This allows for decoupling of these:
66
+ or bounded shapes at a later point ). This allows for decoupling of these:
67
67
68
68
* Not all the information is needed for all analysis;
69
69
* Not all shape functions need to provide all the information (e.g., one could
@@ -73,16 +73,16 @@ or bounded shapes). This allows for decoupling of these:
73
73
representation of an operation;
74
74
75
75
An argument could be made that these are metadata function instead of shape
76
- functions, with some considering shape and elemental type different and some as
76
+ functions, with some considering shape and elemental types different and some considering them both as
77
77
part of shape. But ` shape function ` is IMHO descriptive and metadata can span
78
78
too large a range of potential uses/values.
79
79
80
80
### Requirements
81
81
82
- The requirements for the shape inference functions are shaped by the
82
+ The requirements for the shape inference functions are determined by the
83
83
requirements of shape inference, but we believe the requirements below still
84
- allow freedom to consider different shape inference approaches and so we don't
85
- constrain to a particular shape inference approach here.
84
+ allow freedom to consider different shape inference approaches and so we do not
85
+ impose a particular shape inference approach here.
86
86
87
87
#### Shape inference functions
88
88
@@ -104,8 +104,8 @@ constrain to a particular shape inference approach here.
104
104
guaranteed to pass.
105
105
* Ideally all would eventually (see section
106
106
[ Inlining shape checking] ( #inline ) ) be elided.
107
- * Only report error guaranteed to occur at runtime, if an error is only
108
- possible rather use runtime assertion to fail and produce an error
107
+ * Only reporting errors which are guaranteed to occur at runtime. If an error is only
108
+ possible ( rather than guaranteed) then we use a runtime assertion to fail and produce an error
109
109
message with the invariant violated.
110
110
111
111
* Shape functions usable by compiler and runtime.
@@ -130,7 +130,7 @@ constrain to a particular shape inference approach here.
130
130
131
131
* Shape inference functions are expressible at runtime
132
132
133
- * User can define a shape function for a new op dynamically at runtime,
133
+ * User can define a shape function for a new operation dynamically at runtime,
134
134
this allows for vendors to describe an operation and shape function
135
135
dynamically.
136
136
@@ -140,10 +140,10 @@ constrain to a particular shape inference approach here.
140
140
information)
141
141
142
142
* Shape functions should be cheap to invoke on each kernel launch.
143
- * Shape function dictated by arguments (operands, attributes and regions)
143
+ * Shape function can be dictated by arguments (operands, attributes and regions)
144
144
only (e.g., same operands as the corresponding operation could be
145
145
constructed & invoked with).
146
- * Shape information that need higher-level/graph information should use
146
+ * Shape information that needs higher-level/graph information should use
147
147
richer types (e.g., ` TensorList<F32> ` );
148
148
* The function should be invocable before/while constructing an op (e.g.,
149
149
can't rely on the op being constructed).
@@ -157,19 +157,19 @@ constrain to a particular shape inference approach here.
157
157
determining the shape & then post to be able to actually consume the
158
158
output of the file).
159
159
160
- * The shape function op dialect should interop with non shape dialect ops .
160
+ * The shape function operation dialect should be interoperable with non- shape function dialect operations .
161
161
162
- * There may be a common set of ops that satisfy most uses (e.g., merge,
162
+ * There may be a common set of operations that satisfy most uses (e.g., merge,
163
163
equal_type, arithmetic expressions, slice, concat, pattern matching on
164
164
attributes such as padding etc.) that will be discovered and could cover
165
- a large percentage of the use cases. And among these there will be some
165
+ a large percentage of the use cases. Among these there will be some
166
166
which carry extra semantic info that could be used for symbolic
167
167
constraints (e.g., checking equality of two dimensions resulting in
168
168
setting an equality constraint) and higher-order interpretation for
169
169
constraint solving.
170
170
171
- It is therefore beneficial to reuse operations but not required.
172
- Especially as for statically known shapes, arbitrary arithmetic
171
+ It is therefore beneficial (but not required) to reuse operations,
172
+ especially as for statically known shapes, arbitrary arithmetic
173
173
computations could still be performed. This means that the computations
174
174
performed statically may or may not be supported by an arbitrary solver,
175
175
but would still be allowed.
@@ -239,7 +239,7 @@ operations).
239
239
240
240
### Possibly Asked Questions
241
241
242
- #### What about ODS specifications of ops ?
242
+ #### What about ODS specifications of operations ?
243
243
244
244
In ODS we have been recording the constraints for the operands & attributes of
245
245
an operation. Where these are sufficient to constrain the output shape (e.g.,
@@ -251,7 +251,7 @@ serialization approach).
251
251
#### Why not extract the shape function from reference implementation?
252
252
253
253
This could be done in future! The extracted shape function would use the shape
254
- inference dialect, so we are starting there. Especially for ops described in a
254
+ inference dialect, so we are starting there. Especially for operations described in a
255
255
structured way, one could autogenerate the shape function.
256
256
257
257
#### How/in what language will the shape functions be authored?
0 commit comments