Commit c81ec47
authored
[eudsl-python-extras] add support for partially specialized/evaled generics (#260)
This PR adds support for "partially specialized generics". I.e.,
```python
@func
def maxpool2d[
kernel_size_0, kernel_size_1, stride_0, stride_1, dilation_0, dilation_1, dtype
](
input: "T.memref(S, S, S, S, dtype)",
output: "T.memref(S, S, S, S, dtype)",
):
....
kernel_sizes = [2, 3]
strides = [4, 5]
dilations = [6, 7]
maxpool2d_k_dtype = maxpool2d[
kernel_sizes[0],
kernel_sizes[1],
strides[0],
strides[1],
dilations[0],
dilations[1],
# NOTE: missing dtype
]
# fill in dtype
maxpool2d_k_f32 = maxpool2d_k_dtype[T.f32()].emit()
maxpool2d_k_f64 = maxpool2d_k_dtype[T.f64()].emit()
```
produces
```mlir
func.func @maxpool2d_int_2_int_3_int_4_int_5_int_6_int_7_type_f32(%arg0: memref<?x?x?x?xf32>, %arg1: memref<?x?x?x?xf32>) { ... }
func.func @maxpool2d_int_2_int_3_int_4_int_5_int_6_int_7_type_f64(%arg0: memref<?x?x?x?xf64>, %arg1: memref<?x?x?x?xf64>) { ... }
```1 parent 4536799 commit c81ec47
File tree
5 files changed
+973
-713
lines changed- .github/workflows
- projects/eudsl-python-extras
- examples
- mlir/extras/dialects
- tests
- dialect
5 files changed
+973
-713
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
397 | 400 | | |
398 | 401 | | |
399 | 402 | | |
| |||
0 commit comments