@@ -57,11 +57,7 @@ int main() {
57
57
[=](id<1 > i) { accTmp[i] *= 2 ; });
58
58
});
59
59
60
- // KernelThree specifies a requirement on KernelOne. To avoid circular
61
- // dependencies between two fusions, the fusion for q1 needs to cancelled.
62
- assert (!fw1.is_in_fusion_mode () &&
63
- " Queue should not be in fusion mode anymore" );
64
-
60
+ assert (fw1.is_in_fusion_mode () && " Queue should be in fusion mode" );
65
61
assert (fw2.is_in_fusion_mode () && " Queue should be in fusion mode" );
66
62
67
63
q1.submit ([&](handler &cgh) {
@@ -72,13 +68,17 @@ int main() {
72
68
dataSize, [=](id<1 > i) { accOut[i] = accTmp[i] * accIn3[i]; });
73
69
});
74
70
75
- // KernelTwo specifies a requirement on KernelThree, which leads to
76
- // cancellation of the fusion for q2.
71
+ // KernelTwo specifies a requirement on KernelThree, which had already
72
+ // specified a requirement on KernelOne. Therefore, a cyclic dependency
73
+ // between the kernel fused from (KernelOne, KernelTwo) and KernelThree
74
+ // would arise, so fusion needs to be cancelled for q1/fw1.
75
+ fw1.complete_fusion ({ext::codeplay::experimental::property::no_barriers{}});
76
+
77
+ // As KernelTwo has been enqueued for execution, it's synchronization with
78
+ // KernelThree leads to the fusion for q2/fw2 to also be cancelled.
77
79
assert (!fw2.is_in_fusion_mode () &&
78
80
" Queue should not be in fusion mode anymore" );
79
81
80
- fw1.complete_fusion ({ext::codeplay::experimental::property::no_barriers{}});
81
-
82
82
fw2.cancel_fusion ();
83
83
}
84
84
@@ -90,5 +90,5 @@ int main() {
90
90
return 0 ;
91
91
}
92
92
93
- // CHECK: WARNING: Aborting fusion because of requirement from a different fusion
93
+ // CHECK: WARNING: Aborting fusion because it would create a circular dependency
94
94
// CHECK-NEXT: WARNING: Aborting fusion because synchronization with one of the kernels in the fusion list was requested
0 commit comments