@@ -76,7 +76,8 @@ sub main
76
76
77
77
execute(" cd $sycl_dir && find -iname '*.cpp' | grep -vw 'Inputs' | sort" );
78
78
my @list = split ( " \n " , $command_output );
79
- execute(" rm -rf $config_folder && mkdir $config_folder " );
79
+ # execute("rm -rf $config_folder && mkdir $config_folder");
80
+ execute(" mv $config_folder $config_folder .old && mkdir $config_folder " );
80
81
81
82
my $tests = {};
82
83
my %subsuite_tests ;
@@ -110,8 +111,7 @@ sub main
110
111
$tests -> { $name } = $r ;
111
112
112
113
print ( Dumper( $r ));
113
- my $xml_text = gen_test( $r );
114
- print2file( $xml_text , " ./$config_folder /$name .xml" );
114
+ gen_test($r , " $name .xml" );
115
115
116
116
# Save tests for subsuites
117
117
foreach my $subsuite (sort keys %{ $feature_subsuite {$feature_folder } }) {
@@ -131,6 +131,8 @@ sub main
131
131
print " \n The number of tests in $subsuite_name : " ;
132
132
print scalar keys %{ $subsuite_tests {$subsuite } };
133
133
}
134
+
135
+ execute(" rm -rf $config_folder .old" );
134
136
}
135
137
136
138
sub gen_suite
@@ -166,9 +168,9 @@ sub gen_suite
166
168
} else {
167
169
if ($subsuite ne " " ) {
168
170
# For subsuite
169
- $xml -> {files } = { file => [ { path => ' double_test.list' }, { path => ' cmake' }, { path => ' tools' }, { path => ' CMakeLists.txt' }, { path => ' litsupport' }, { path => ' lit.cfg' }, { path => ' lit.site.cfg.in' }, { path => ' SYCL' }, { path => " $feature_folder /$subsuite " , dst => " SYCL_${subsuite} /$subsuite " }, { path => ' $INFO_TDRIVE/ref/lit' }, { path => $config_folder }]};
171
+ $xml -> {files } = { file => [ { path => ' suite_generator_sycl.pl ' }, { path => ' double_test.list' }, { path => ' cmake' }, { path => ' tools' }, { path => ' CMakeLists.txt' }, { path => ' litsupport' }, { path => ' lit.cfg' }, { path => ' lit.site.cfg.in' }, { path => ' SYCL' }, { path => " $feature_folder /$subsuite " , dst => " SYCL_${subsuite} /$subsuite " }, { path => ' $INFO_TDRIVE/ref/lit' }, { path => $config_folder }]};
170
172
} else {
171
- $xml -> {files } = { file => [ { path => ' double_test.list' }, { path => ' cmake' }, { path => ' tools' }, { path => ' CMakeLists.txt' }, { path => ' litsupport' }, { path => ' lit.cfg' }, { path => ' lit.site.cfg.in' }, { path => ' SYCL' }, { path => $feature_folder }, { path => ' $INFO_TDRIVE/ref/lit' }, { path => $config_folder }, { path => ' setenv.list' }]};
173
+ $xml -> {files } = { file => [ { path => ' suite_generator_sycl.pl ' }, { path => ' double_test.list' }, { path => ' cmake' }, { path => ' tools' }, { path => ' CMakeLists.txt' }, { path => ' litsupport' }, { path => ' lit.cfg' }, { path => ' lit.site.cfg.in' }, { path => ' SYCL' }, { path => $feature_folder }, { path => ' $INFO_TDRIVE/ref/lit' }, { path => $config_folder }, { path => ' setenv.list' }]};
172
174
}
173
175
}
174
176
@@ -248,14 +250,14 @@ sub token2feature
248
250
if (substr ($ut , 0, 1) eq ' !' ) {
249
251
my $subtoken = substr ($ut , 1);
250
252
foreach my $feature (@all_gpu_features ) {
251
- if ($subtoken eq " $lit_feature_prefix$feature " or $subtoken eq " aspect-fp64 " and $feature eq " double " ) {
253
+ if ($subtoken eq " $lit_feature_prefix$feature " ) {
252
254
push (@tokens , " !$feature " );
253
255
last ;
254
256
}
255
257
}
256
258
} else {
257
259
foreach my $feature (@all_gpu_features ) {
258
- if ($ut eq " $lit_feature_prefix$feature " or $ut eq " aspect-fp64 " and $feature eq " double " ) {
260
+ if ($ut eq " $lit_feature_prefix$feature " ) {
259
261
push (@tokens , $feature );
260
262
last ;
261
263
}
@@ -270,7 +272,7 @@ sub token2feature
270
272
if (substr ($rt , 0, 1) eq ' !' ) {
271
273
my $subtoken = substr ($rt , 1);
272
274
foreach my $feature (@all_gpu_features ) {
273
- if ($subtoken eq " $lit_feature_prefix$feature " or $subtoken eq " aspect-fp64 " and $feature eq " double " ) {
275
+ if ($subtoken eq " $lit_feature_prefix$feature " ) {
274
276
my $seen = 0;
275
277
foreach my $ref (@tokens ) {
276
278
my $ref_token = $ref ;
@@ -287,7 +289,7 @@ sub token2feature
287
289
} else {
288
290
foreach my $feature (@all_gpu_features ) {
289
291
# if (grep(/\Q$lit_feature_prefix$rt/, @all_gpu_features)) {
290
- if ($rt eq " $lit_feature_prefix$feature " or $rt eq " aspect-fp64 " and $feature eq " double " ) {
292
+ if ($rt eq " $lit_feature_prefix$feature " ) {
291
293
my $seen = 0;
292
294
foreach my $ref (@tokens ) {
293
295
my $ref_token = $ref ;
@@ -321,6 +323,7 @@ sub feature2rule
321
323
{
322
324
my $xml_ref = shift ;
323
325
my $features_ref = shift ;
326
+ my $test_xml = shift ;
324
327
325
328
if (scalar @${features_ref} ) {
326
329
$$xml_ref -> {rules } = { optlevelRule => []};
@@ -329,12 +332,25 @@ sub feature2rule
329
332
foreach my $feature (@{$features_ref }) {
330
333
push (@{$$xml_ref -> {rules }{optlevelRule }}, { GPUFeature => " $feature " , excludeOptlevelNameString => ' gpu' });
331
334
}
335
+
336
+ # CMPLRTST-16836: after the 'double' type tests are splitted done, this workaround can be removed.
337
+ if (-f " config_sycl.old/$test_xml " ) {
338
+ my @lines = read_file(" config_sycl.old/$test_xml " );
339
+ foreach my $line (@lines ) {
340
+ if ($line =~ m /\Q GPUFeature="!double"/ ) {
341
+ push (@{$$xml_ref -> {rules }{optlevelRule }}, { GPUFeature => " !double" , excludeOptlevelNameString => ' gpu' });
342
+ last ;
343
+ }
344
+ }
345
+ }
332
346
}
333
347
334
348
sub translate_gpu_feature
335
349
{
336
350
my $r = shift ;
337
351
my $xml_ref = shift ;
352
+ my $test_xml = shift ;
353
+
338
354
my $f = $r -> {fullpath };
339
355
my @gpu_features = ();
340
356
@@ -355,31 +371,35 @@ sub translate_gpu_feature
355
371
}
356
372
357
373
@gpu_features = token2feature($r , \@require_tokens , \@unsupported_tokens );
358
- feature2rule($xml_ref , \@gpu_features );
374
+ feature2rule($xml_ref , \@gpu_features , $test_xml );
359
375
}
360
376
361
377
sub requires2rule
362
378
{
363
379
my $r = shift ;
364
380
my $xml_ref = shift ;
381
+ my $test_xml = shift ;
365
382
366
- translate_gpu_feature($r , $xml_ref );
383
+ translate_gpu_feature($r , $xml_ref , $test_xml );
367
384
}
368
385
369
386
sub gen_test
370
387
{
371
388
my $r = shift ;
389
+ my $test_xml = shift ;
390
+
372
391
my $f = $r -> {fullpath };
373
392
my $xml = {};
374
393
$xml -> {driverID } = ' llvm_test_suite_sycl' ;
375
394
$xml -> {name } = " $r ->{name}" ;
376
395
$xml -> {description } = { content => " WARNING: DON'T UPDATE THIS FILE MANUALLY!!!\n This config file auto-generated by suite_generator_sycl.pl." };
377
396
378
- requires2rule($r , \$xml );
397
+ requires2rule($r , \$xml , $test_xml );
379
398
380
399
print2file( " $r ->{path}/$r ->{short_name}.cpp" , " ./$config_folder /$r ->{name}.info" );
381
400
382
- return XMLout( $xml , xmldecl => ' <?xml version="1.0" encoding="UTF-8" ?>' , RootName => ' test' );
401
+ my $xml_text = XMLout( $xml , xmldecl => ' <?xml version="1.0" encoding="UTF-8" ?>' , RootName => ' test' );
402
+ print2file( $xml_text , " $config_folder /$test_xml " );
383
403
}
384
404
385
405
sub file2str
@@ -413,6 +433,24 @@ sub dump2file
413
433
print2file( Dumper( $r ), $file );
414
434
}
415
435
436
+ sub read_file
437
+ {
438
+ my $f = shift ;
439
+
440
+ my $fd ;
441
+ open $fd , $f or die " Failed to open for reading: $f : $! " ;
442
+ # binmode as some our source files have utf-8 symbold and perl issues warnings like:
443
+ # Malformed UTF-8 character (unexpected continuation byte 0x96, with no preceding start byte) in pattern match (m//)
444
+ # at /home/cmplr/icl_tools/omirochn/git/filter-intel-feature.pl line 242.
445
+ binmode $fd ;# , ':utf8';
446
+ my @in = <$fd >;
447
+ close $fd or die " Failed to close after reading: $f : $! " ;
448
+
449
+ # remove the BOM character at the begining of a file, because this tool will insert Intel header in front of this line.
450
+ $in [0] =~ s / ^\xEF\xBB\xBF // if scalar (@in );
451
+ return @in ;
452
+ }
453
+
416
454
sub execute
417
455
{
418
456
my $cmd = shift ;
@@ -472,5 +510,3 @@ sub execute
472
510
copy(" $suite_name .xml" , " $valgrind_suite_name .xml" );
473
511
print " \n\n Finish the generation of $valgrind_suite_name Successfully.\n " ;
474
512
}
475
-
476
-
0 commit comments