@@ -14,7 +14,6 @@ func.func @_QPsub1() {
14
14
return
15
15
}
16
16
17
-
18
17
// CHECK-LABEL: func.func @_QPsub1()
19
18
// CHECK: %[[DESC_RT_CALL:.*]] = fir.call @_FortranACUFAllocDesciptor(%{{.*}}, %{{.*}}, %{{.*}}) : (i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>>
20
19
// CHECK: %[[DESC:.*]] = fir.convert %[[DESC_RT_CALL]] : (!fir.ref<!fir.box<none>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
@@ -27,4 +26,37 @@ func.func @_QPsub1() {
27
26
// CHECK: %[[BOX_NONE:.*]] = fir.convert %[[DECL_DESC]]#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>>
28
27
// CHECK: fir.call @_FortranACUFFreeDesciptor(%[[BOX_NONE]], %{{.*}}, %{{.*}}) : (!fir.ref<!fir.box<none>>, !fir.ref<i8>, i32) -> none
29
28
29
+ // Check operations that should not be transformed yet.
30
+ func.func @_QPsub2() {
31
+ %0 = cuf.alloc !fir.array<10xf32> {bindc_name = "a", data_attr = #cuf.cuda<device>, uniq_name = "_QMcuda_varFcuda_alloc_freeEa"} -> !fir.ref<!fir.array<10xf32>>
32
+ cuf.free %0 : !fir.ref<!fir.array<10xf32>> {data_attr = #cuf.cuda<device>}
33
+ return
30
34
}
35
+
36
+ // CHECK-LABEL: func.func @_QPsub2()
37
+ // CHECK: cuf.alloc !fir.array<10xf32>
38
+ // CHECK: cuf.free %{{.*}} : !fir.ref<!fir.array<10xf32>>
39
+
40
+ fir.global @_QMmod1Ea {data_attr = #cuf.cuda<device>} : !fir.box<!fir.heap<!fir.array<?xf32>>> {
41
+ %0 = fir.zero_bits !fir.heap<!fir.array<?xf32>>
42
+ %c0 = arith.constant 0 : index
43
+ %1 = fir.shape %c0 : (index) -> !fir.shape<1>
44
+ %2 = fir.embox %0(%1) : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.heap<!fir.array<?xf32>>>
45
+ fir.has_value %2 : !fir.box<!fir.heap<!fir.array<?xf32>>>
46
+ }
47
+
48
+ func.func @_QPsub3() {
49
+ %0 = fir.address_of(@_QMmod1Ea) : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
50
+ %1:2 = hlfir.declare %0 {data_attr = #cuf.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QMmod1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>)
51
+ %2 = cuf.allocate %1#1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> {data_attr = #cuf.cuda<device>} -> i32
52
+ %3 = cuf.deallocate %1#1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> {data_attr = #cuf.cuda<device>} -> i32
53
+ return
54
+ }
55
+
56
+ // CHECK-LABEL: func.func @_QPsub3()
57
+ // CHECK: cuf.allocate
58
+ // CHECK: cuf.deallocate
59
+
60
+ }
61
+
62
+
0 commit comments