173
|
1 // RUN: mlir-opt %s -test-side-effects -verify-diagnostics
|
|
2
|
|
3 // expected-remark@+1 {{operation has no memory effects}}
|
|
4 %0 = "test.side_effect_op"() {} : () -> i32
|
|
5
|
|
6 // expected-remark@+2 {{found an instance of 'read' on resource '<Default>'}}
|
|
7 // expected-remark@+1 {{found an instance of 'free' on resource '<Default>'}}
|
|
8 %1 = "test.side_effect_op"() {effects = [
|
|
9 {effect="read"}, {effect="free"}
|
|
10 ]} : () -> i32
|
|
11
|
|
12 // expected-remark@+1 {{found an instance of 'write' on resource '<Test>'}}
|
|
13 %2 = "test.side_effect_op"() {effects = [
|
|
14 {effect="write", test_resource}
|
|
15 ]} : () -> i32
|
|
16
|
|
17 // expected-remark@+1 {{found an instance of 'allocate' on a value, on resource '<Test>'}}
|
|
18 %3 = "test.side_effect_op"() {effects = [
|
|
19 {effect="allocate", on_result, test_resource}
|
|
20 ]} : () -> i32
|
221
|
21
|
|
22 // expected-remark@+1 {{found an instance of 'read' on a symbol '@foo_ref', on resource '<Test>'}}
|
|
23 "test.side_effect_op"() {effects = [
|
|
24 {effect="read", on_reference = @foo_ref, test_resource}
|
|
25 ]} : () -> i32
|
|
26
|
|
27 // No _memory_ effects, but a parametric test effect.
|
|
28 // expected-remark@+2 {{operation has no memory effects}}
|
|
29 // expected-remark@+1 {{found a parametric effect with affine_map<(d0, d1) -> (d1, d0)>}}
|
|
30 %4 = "test.side_effect_op"() {
|
|
31 effect_parameter = affine_map<(i, j) -> (j, i)>
|
|
32 } : () -> i32
|
|
33
|
|
34 // Check with this unregistered operation to test the fallback on the dialect.
|
|
35 // expected-remark@+1 {{found a parametric effect with affine_map<(d0, d1) -> (d1, d0)>}}
|
|
36 %5 = "test.unregistered_side_effect_op"() {
|
|
37 effect_parameter = affine_map<(i, j) -> (j, i)>
|
|
38 } : () -> i32
|