1 ! Test optional fusing of forall assignments in the scheduling analysis
2 ! from lower-hlfir-ordered-assignments pass. Assignments are fused in the
3 ! same loop nest if they are given the same run id.
5 ! RUN: bbc -hlfir -o - -pass-pipeline="builtin.module(lower-hlfir-ordered-assignments{fuse-assignments=false})" --debug-only=flang-ordered-assignment -flang-dbg-order-assignment-schedule-only %s 2>&1 | FileCheck %s --check-prefix NOFUSE
7 ! RUN: bbc -hlfir -o - -pass-pipeline="builtin.module(lower-hlfir-ordered-assignments{fuse-assignments=true})" --debug-only=flang-ordered-assignment -flang-dbg-order-assignment-schedule-only %s 2>&1 | FileCheck %s --check-prefix FUSE
11 subroutine fusable_assign_easy(x
, y
, z
)
12 integer :: x(:), y(:), z(:)
18 !NOFUSE-LABEL: ------------ scheduling forall in _QPfusable_assign_easy ------------
19 !NOFUSE-NEXT: run 1 evaluate: forall/region_assign1
20 !NOFUSE-NEXT: run 2 evaluate: forall/region_assign2
22 !FUSE-LABEL: ------------ scheduling forall in _QPfusable_assign_easy ------------
23 !FUSE-NEXT: run 1 evaluate: forall/region_assign1
24 !FUSE-NEXT: run 1 evaluate: forall/region_assign2
26 subroutine fusable_assign(x
, y
, z
)
27 integer :: x(:), y(:), z(:)
33 !NOFUSE-LABEL: ------------ scheduling forall in _QPfusable_assign ------------
34 !NOFUSE-NEXT: run 1 evaluate: forall/region_assign1
35 !NOFUSE-NEXT: run 2 evaluate: forall/region_assign2
37 !FUSE-LABEL: ------------ scheduling forall in _QPfusable_assign ------------
38 !FUSE-NEXT: run 1 evaluate: forall/region_assign1
39 !FUSE-NEXT: run 1 evaluate: forall/region_assign2
41 subroutine unfusable_assign_1(x
, y
, z
)
42 integer :: x(:), y(:), z(:)
48 !NOFUSE-LABEL: ------------ scheduling forall in _QPunfusable_assign_1 ------------
49 !NOFUSE-NEXT: run 1 evaluate: forall/region_assign1
50 !NOFUSE-NEXT: run 2 evaluate: forall/region_assign2
52 !FUSE-LABEL: ------------ scheduling forall in _QPunfusable_assign_1 ------------
53 !FUSE-NEXT: run 1 evaluate: forall/region_assign1
54 !FUSE-NEXT: conflict: R/W: <block argument> of type '!fir.box<!fir.array<?xi32>>' at index: 0 W:<block argument> of type '!fir.box<!fir.array<?xi32>>' at index: 0
55 !FUSE-NEXT: run 2 evaluate: forall/region_assign2
57 subroutine unfusable_assign_2(x
, y
)
64 !NOFUSE-LABEL: ------------ scheduling forall in _QPunfusable_assign_2 ------------
65 !NOFUSE-NEXT: run 1 evaluate: forall/region_assign1
66 !NOFUSE-NEXT: run 2 evaluate: forall/region_assign2
68 !FUSE-LABEL: ------------ scheduling forall in _QPunfusable_assign_2 ------------
69 !FUSE-NEXT: run 1 evaluate: forall/region_assign1
70 !FUSE-NEXT: conflict: R/W: <block argument> of type '!fir.box<!fir.array<?xi32>>' at index: 0 W:<block argument> of type '!fir.box<!fir.array<?xi32>>' at index: 0
71 !FUSE-NEXT: run 2 evaluate: forall/region_assign2
73 subroutine unfusable_assign_3(x
, y
, z
)
74 integer :: x(:, :), y(:, :), z(:, :)
76 forall(j
=1:z(i
, i
)) x(i
, j
) = y(i
, j
)
80 !NOFUSE-LABEL: ------------ scheduling forall in _QPunfusable_assign_3 ------------
81 !NOFUSE-NEXT: run 1 evaluate: forall/forall1/region_assign1
82 !NOFUSE-NEXT: run 2 evaluate: forall/region_assign1
84 !FUSE-LABEL: ------------ scheduling forall in _QPunfusable_assign_3 ------------
85 !FUSE-NEXT: run 1 evaluate: forall/forall1/region_assign1
86 !FUSE-NEXT: conflict: R/W: <block argument> of type '!fir.box<!fir.array<?x?xi32>>' at index: 2 W:<block argument> of type '!fir.box<!fir.array<?x?xi32>>' at index: 2
87 !FUSE-NEXT: run 2 evaluate: forall/region_assign1
89 subroutine unfusable_assign_4(x
, y
, z
)
90 integer :: x(:, :), y(:, :), z(:, :)
93 forall(j
=1:x(i
, i
)) z(i
, j
) = y(i
, j
)
96 !NOFUSE-LABEL: ------------ scheduling forall in _QPunfusable_assign_4 ------------
97 !NOFUSE-NEXT: run 1 evaluate: forall/region_assign1
98 !NOFUSE-NEXT: run 2 evaluate: forall/forall1/region_assign1
100 !FUSE-LABEL: ------------ scheduling forall in _QPunfusable_assign_4 ------------
101 !FUSE-NEXT: run 1 evaluate: forall/region_assign1
102 !FUSE-NEXT: conflict: R/W: <block argument> of type '!fir.box<!fir.array<?x?xi32>>' at index: 0 W:<block argument> of type '!fir.box<!fir.array<?x?xi32>>' at index: 0
103 !FUSE-NEXT: run 2 evaluate: forall/forall1/region_assign1