@@ -38,38 +38,44 @@ int main() {
38
38
39
39
// reqd_work_group_size is OpenCL specific.
40
40
if (OCLBackend) {
41
- if (OCLVersion[0 ] == ' 1' || (OCLVersion[0 ] == ' 2' && OCLVersion[2 ] == ' 0' )) {
42
- // parallel_for, (16, 16, 16) global, (8, 8, 8) local, reqd_wg_size(4, 4, 4)
43
- // -> fail
44
- try {
45
- Q.submit ([&](handler &CGH) {
46
- CGH.parallel_for <class ReqdWGSizeNegativeA >(
47
- nd_range<3 >(range<3 >(16 , 16 , 16 ), range<3 >(8 , 8 , 8 )),
48
- [=](nd_item<3 >) { reqd_wg_size_helper (); });
49
- });
50
- Q.wait_and_throw ();
51
- std::cerr << " Test case ReqdWGSizeNegativeA failed: no exception has been "
52
- " thrown\n " ;
53
- return 1 ; // We shouldn't be here, exception is expected
54
- } catch (nd_range_error &E) {
55
- if (string_class (E.what ()).find (
56
- " Specified local size doesn't match the required work-group size "
57
- " specified in the program source" ) == string_class::npos) {
41
+ if (OCLVersion[0 ] == ' 1' ||
42
+ (OCLVersion[0 ] == ' 2' && OCLVersion[2 ] == ' 0' )) {
43
+ // parallel_for, (16, 16, 16) global, (8, 8, 8) local, reqd_wg_size(4, 4,
44
+ // 4)
45
+ // -> fail
46
+ try {
47
+ Q.submit ([&](handler &CGH) {
48
+ CGH.parallel_for <class ReqdWGSizeNegativeA >(
49
+ nd_range<3 >(range<3 >(16 , 16 , 16 ), range<3 >(8 , 8 , 8 )),
50
+ [=](nd_item<3 >) { reqd_wg_size_helper (); });
51
+ });
52
+ Q.wait_and_throw ();
53
+ std::cerr
54
+ << " Test case ReqdWGSizeNegativeA failed: no exception has been "
55
+ " thrown\n " ;
56
+ return 1 ; // We shouldn't be here, exception is expected
57
+ } catch (nd_range_error &E) {
58
+ if (string_class (E.what ()).find (" Specified local size doesn't match "
59
+ " the required work-group size "
60
+ " specified in the program source" ) ==
61
+ string_class::npos) {
62
+ std::cerr
63
+ << " Test case ReqdWGSizeNegativeA failed: unexpected exception: "
64
+ << E.what () << std::endl;
65
+ return 1 ;
66
+ }
67
+ } catch (runtime_error &E) {
58
68
std::cerr
59
69
<< " Test case ReqdWGSizeNegativeA failed: unexpected exception: "
60
70
<< E.what () << std::endl;
61
71
return 1 ;
72
+ } catch (...) {
73
+ std::cerr
74
+ << " Test case ReqdWGSizeNegativeA failed: something unexpected "
75
+ " has been caught"
76
+ << std::endl;
77
+ return 1 ;
62
78
}
63
- } catch (runtime_error &E) {
64
- std::cerr << " Test case ReqdWGSizeNegativeA failed: unexpected exception: "
65
- << E.what () << std::endl;
66
- return 1 ;
67
- } catch (...) {
68
- std::cerr << " Test case ReqdWGSizeNegativeA failed: something unexpected "
69
- " has been caught"
70
- << std::endl;
71
- return 1 ;
72
- }
73
79
74
80
// parallel_for, (16, 16, 16) global, null local, reqd_wg_size(4, 4, 4) //
75
81
// -> fail
@@ -84,9 +90,10 @@ int main() {
84
90
" thrown\n " ;
85
91
return 1 ; // We shouldn't be here, exception is expected
86
92
} catch (nd_range_error &E) {
87
- if (string_class (E.what ()).find (
88
- " OpenCL 1.x and 2.0 requires to pass local size argument even if "
89
- " required work-group size was specified in the program source" ) ==
93
+ if (string_class (E.what ()).find (" OpenCL 1.x and 2.0 requires to pass "
94
+ " local size argument even if "
95
+ " required work-group size was "
96
+ " specified in the program source" ) ==
90
97
string_class::npos) {
91
98
std::cerr
92
99
<< " Test case ReqdWGSizeNegativeB failed: unexpected exception: "
@@ -99,9 +106,10 @@ int main() {
99
106
<< E.what () << std::endl;
100
107
return 1 ;
101
108
} catch (...) {
102
- std::cerr << " Test case ReqdWGSizeNegativeB failed: something unexpected "
103
- " has been caught"
104
- << std::endl;
109
+ std::cerr
110
+ << " Test case ReqdWGSizeNegativeB failed: something unexpected "
111
+ " has been caught"
112
+ << std::endl;
105
113
return 1 ;
106
114
}
107
115
}
@@ -118,12 +126,14 @@ int main() {
118
126
});
119
127
Q.wait_and_throw ();
120
128
} catch (nd_range_error &E) {
121
- std::cerr << " Test case ReqdWGSizePositiveA failed: unexpected exception: "
122
- << E.what () << std::endl;
129
+ std::cerr
130
+ << " Test case ReqdWGSizePositiveA failed: unexpected exception: "
131
+ << E.what () << std::endl;
123
132
return 1 ;
124
133
} catch (runtime_error &E) {
125
- std::cerr << " Test case ReqdWGSizePositiveA failed: unexpected exception: "
126
- << E.what () << std::endl;
134
+ std::cerr
135
+ << " Test case ReqdWGSizePositiveA failed: unexpected exception: "
136
+ << E.what () << std::endl;
127
137
return 1 ;
128
138
} catch (...) {
129
139
std::cerr << " Test case ReqdWGSizePositiveA failed: something unexpected "
@@ -233,8 +243,12 @@ int main() {
233
243
return 1 ; // We shouldn't be here, exception is expected
234
244
}
235
245
} catch (nd_range_error &E) {
236
- if ((string_class (E.what ()).find (" Local workgroup size cannot be greater than global range in any dimension" ) == string_class::npos) &&
237
- (string_class (E.what ()).find (" Non-uniform work-groups are not supported by the target device" ) == string_class::npos)) {
246
+ if ((string_class (E.what ()).find (" Local workgroup size cannot be greater "
247
+ " than global range in any dimension" ) ==
248
+ string_class::npos) &&
249
+ (string_class (E.what ()).find (" Non-uniform work-groups are not "
250
+ " supported by the target device" ) ==
251
+ string_class::npos)) {
238
252
std::cerr
239
253
<< " Test case OpenCL1XNegativeA2 failed: unexpected exception: "
240
254
<< E.what () << std::endl;
@@ -271,8 +285,12 @@ int main() {
271
285
return 1 ; // We shouldn't be here, exception is expected
272
286
}
273
287
} catch (nd_range_error &E) {
274
- if ((string_class (E.what ()).find (" Local workgroup size cannot be greater than global range in any dimension" ) == string_class::npos) &&
275
- (string_class (E.what ()).find (" Non-uniform work-groups are not supported by the target device" ) == string_class::npos)) {
288
+ if ((string_class (E.what ()).find (" Local workgroup size cannot be greater "
289
+ " than global range in any dimension" ) ==
290
+ string_class::npos) &&
291
+ (string_class (E.what ()).find (" Non-uniform work-groups are not "
292
+ " supported by the target device" ) ==
293
+ string_class::npos)) {
276
294
std::cerr
277
295
<< " Test case OpenCL1XNegativeB2 failed: unexpected exception: "
278
296
<< E.what () << std::endl;
@@ -308,9 +326,11 @@ int main() {
308
326
return 1 ; // We shouldn't be here, exception is expected
309
327
} catch (nd_range_error &E) {
310
328
if ((string_class (E.what ()).find (
311
- " Total number of work-items in a work-group cannot exceed " +
312
- std::to_string (MaxDeviceWGSize)) == string_class::npos) &&
313
- (string_class (E.what ()).find (" Non-uniform work-groups are not supported by the target device" ) == string_class::npos)) {
329
+ " Total number of work-items in a work-group cannot exceed " +
330
+ std::to_string (MaxDeviceWGSize)) == string_class::npos) &&
331
+ (string_class (E.what ()).find (" Non-uniform work-groups are not "
332
+ " supported by the target device" ) ==
333
+ string_class::npos)) {
314
334
std::cerr
315
335
<< " Test case OpenCL1XNegativeC failed: unexpected exception: "
316
336
<< E.what () << std::endl;
@@ -488,9 +508,11 @@ int main() {
488
508
} catch (nd_range_error &E) {
489
509
if (string_class (E.what ()).find (
490
510
" Local workgroup size greater than global range size. "
491
- " Non-uniform work-groups are not allowed by default. Underlying "
511
+ " Non-uniform work-groups are not allowed by default. "
512
+ " Underlying "
492
513
" OpenCL 2.x implementation supports this feature and to enable "
493
- " it, build device program with -cl-std=CL2.0" ) == string_class::npos) {
514
+ " it, build device program with -cl-std=CL2.0" ) ==
515
+ string_class::npos) {
494
516
std::cerr
495
517
<< " Test case OpenCL2XNegativeB2 failed: unexpected exception: "
496
518
<< E.what () << std::endl;
@@ -502,9 +524,10 @@ int main() {
502
524
<< E.what () << std::endl;
503
525
return 1 ;
504
526
} catch (...) {
505
- std::cerr << " Test case OpenCL2XNegativeB2 failed: something unexpected "
506
- " has been caught"
507
- << std::endl;
527
+ std::cerr
528
+ << " Test case OpenCL2XNegativeB2 failed: something unexpected "
529
+ " has been caught"
530
+ << std::endl;
508
531
return 1 ;
509
532
}
510
533
@@ -545,9 +568,10 @@ int main() {
545
568
<< E.what () << std::endl;
546
569
return 1 ;
547
570
} catch (...) {
548
- std::cerr << " Test case OpenCL2XNegativeC2 failed: something unexpected "
549
- " has been caught"
550
- << std::endl;
571
+ std::cerr
572
+ << " Test case OpenCL2XNegativeC2 failed: something unexpected "
573
+ " has been caught"
574
+ << std::endl;
551
575
return 1 ;
552
576
}
553
577
}
@@ -645,9 +669,12 @@ int main() {
645
669
} catch (nd_range_error &E) {
646
670
if (string_class (E.what ()).find (
647
671
" Global_work_size not evenly divisible by local_work_size. "
648
- " Non-uniform work-groups are not allowed by when -cl-uniform-work-group-size flag is used. Underlying "
649
- " OpenCL 2.x implementation supports this feature, but it is being "
650
- " disabled by -cl-uniform-work-group-size build flag" ) == string_class::npos) {
672
+ " Non-uniform work-groups are not allowed by when "
673
+ " -cl-uniform-work-group-size flag is used. Underlying "
674
+ " OpenCL 2.x implementation supports this feature, but it is "
675
+ " being "
676
+ " disabled by -cl-uniform-work-group-size build flag" ) ==
677
+ string_class::npos) {
651
678
std::cerr
652
679
<< " Test case OpenCL2XNegativeD failed: unexpected exception: "
653
680
<< E.what () << std::endl;
@@ -692,9 +719,12 @@ int main() {
692
719
} catch (nd_range_error &E) {
693
720
if (string_class (E.what ()).find (
694
721
" Global_work_size not evenly divisible by local_work_size. "
695
- " Non-uniform work-groups are not allowed by when -cl-uniform-work-group-size flag is used. Underlying "
696
- " OpenCL 2.x implementation supports this feature, but it is being "
697
- " disabled by -cl-uniform-work-group-size build flag" ) == string_class::npos) {
722
+ " Non-uniform work-groups are not allowed by when "
723
+ " -cl-uniform-work-group-size flag is used. Underlying "
724
+ " OpenCL 2.x implementation supports this feature, but it is "
725
+ " being "
726
+ " disabled by -cl-uniform-work-group-size build flag" ) ==
727
+ string_class::npos) {
698
728
std::cerr
699
729
<< " Test case OpenCL2XNegativeE failed: unexpected exception: "
700
730
<< E.what () << std::endl;
@@ -713,10 +743,10 @@ int main() {
713
743
}
714
744
}
715
745
716
- // Local Size larger than Global, -cl-std=CL2.0 -cl-uniform-work-group-size flag used
717
- // CL_INVALID_WORK_GROUP_SIZE if local_work_size is specified as larger
718
- // than the global size, then a different error string is used.
719
- // This is a sub-case of the more general 'non-uniform work group'
746
+ // Local Size larger than Global, -cl-std=CL2.0 -cl-uniform-work-group-size
747
+ // flag used CL_INVALID_WORK_GROUP_SIZE if local_work_size is specified as
748
+ // larger than the global size, then a different error string is used. This
749
+ // is a sub-case of the more general 'non-uniform work group'
720
750
{
721
751
program P (Q.get_context ());
722
752
P.build_with_kernel_type <class OpenCL2XNegativeD2 >(
@@ -742,9 +772,12 @@ int main() {
742
772
} catch (nd_range_error &E) {
743
773
if (string_class (E.what ()).find (
744
774
" Local workgroup size greater than global range size. "
745
- " Non-uniform work-groups are not allowed by when -cl-uniform-work-group-size flag is used. Underlying "
746
- " OpenCL 2.x implementation supports this feature, but it is being "
747
- " disabled by -cl-uniform-work-group-size build flag" ) == string_class::npos) {
775
+ " Non-uniform work-groups are not allowed by when "
776
+ " -cl-uniform-work-group-size flag is used. Underlying "
777
+ " OpenCL 2.x implementation supports this feature, but it is "
778
+ " being "
779
+ " disabled by -cl-uniform-work-group-size build flag" ) ==
780
+ string_class::npos) {
748
781
std::cerr
749
782
<< " Test case OpenCL2XNegativeD2 failed: unexpected exception: "
750
783
<< E.what () << std::endl;
@@ -756,9 +789,10 @@ int main() {
756
789
<< E.what () << std::endl;
757
790
return 1 ;
758
791
} catch (...) {
759
- std::cerr << " Test case OpenCL2XNegativeD2 failed: something unexpected "
760
- " has been caught"
761
- << std::endl;
792
+ std::cerr
793
+ << " Test case OpenCL2XNegativeD2 failed: something unexpected "
794
+ " has been caught"
795
+ << std::endl;
762
796
return 1 ;
763
797
}
764
798
}
@@ -789,9 +823,12 @@ int main() {
789
823
} catch (nd_range_error &E) {
790
824
if (string_class (E.what ()).find (
791
825
" Local workgroup size greater than global range size. "
792
- " Non-uniform work-groups are not allowed by when -cl-uniform-work-group-size flag is used. Underlying "
793
- " OpenCL 2.x implementation supports this feature, but it is being "
794
- " disabled by -cl-uniform-work-group-size build flag" ) == string_class::npos) {
826
+ " Non-uniform work-groups are not allowed by when "
827
+ " -cl-uniform-work-group-size flag is used. Underlying "
828
+ " OpenCL 2.x implementation supports this feature, but it is "
829
+ " being "
830
+ " disabled by -cl-uniform-work-group-size build flag" ) ==
831
+ string_class::npos) {
795
832
std::cerr
796
833
<< " Test case OpenCL2XNegativeE2 failed: unexpected exception: "
797
834
<< E.what () << std::endl;
@@ -803,9 +840,10 @@ int main() {
803
840
<< E.what () << std::endl;
804
841
return 1 ;
805
842
} catch (...) {
806
- std::cerr << " Test case OpenCL2XNegativeE2 failed: something unexpected "
807
- " has been caught"
808
- << std::endl;
843
+ std::cerr
844
+ << " Test case OpenCL2XNegativeE2 failed: something unexpected "
845
+ " has been caught"
846
+ << std::endl;
809
847
return 1 ;
810
848
}
811
849
}
0 commit comments