Skip to content

Commit bfbd876

Browse files
committed
support more GPU features and sycl2020 features in test driver.
1 parent 7bf575c commit bfbd876

File tree

1 file changed

+56
-18
lines changed

1 file changed

+56
-18
lines changed

llvm_test_suite_sycl.pl

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
BEGIN
2+
{
3+
use lib $ENV{ICS_PERLLIB};
4+
}
5+
use icpuid;
6+
17
use File::Basename;
28
use File::Copy;
39

@@ -34,6 +40,10 @@ sub gpu {
3440
$gpus = [ $gpus ] if ref($gpus) ne "ARRAY";
3541
my $current_gpu = $ENV{'CURRENT_GPU_DEVICE'};
3642
if (!defined $current_gpu) {
43+
my @avaliable_gpu_features = get_gpu_features();
44+
foreach my $gpu (@{$gpus}) {
45+
return 1 if (grep(/$gpu/i, @avaliable_gpu_features));
46+
}
3747
return 0;
3848
} else {
3949
$current_gpu =~ tr/,//d; # e.g. gen9,/gen9/double/,GEN9
@@ -582,6 +592,8 @@ sub do_run
582592
my $jobset = "-j 8";
583593
my $zedebug = "";
584594
my $gpu_opts = "";
595+
my $sycl2020_aspects = "";
596+
my $sycl2020_non_aspect_features = "";
585597

586598
if ( is_ats() ) {
587599
$python = "/usr/bin/python3";
@@ -605,12 +617,45 @@ sub do_run
605617
$timeset = "--timeout 0";
606618
}
607619

608-
if (gpu(['dg1','ats'])) {
609-
$gpu_opts .= "-Dgpu-intel-dg1=1";
610-
} elsif (gpu(['dg2'])) {
611-
$gpu_opts .= "-Dgpu-intel-dg2=1";
612-
} elsif (gpu(['pvc'])) {
613-
$gpu_opts .= "-Dgpu-intel-pvc=1";
620+
# Detail lit-feature-checks in https://github.com/intel/llvm-test-suite/tree/intel/SYCL#lit-feature-checks
621+
# Platform names that appear in external user interactions (e.g. command-line arguments) should be all lowercase, with dashes (-).
622+
# Platform names that appear in external user interactions in Open Source (OS) version of SW tools must come from any of the following URL:
623+
# https://github.com/intel-innersource/drivers.gpu.specification.platforms/blob/generated_cs/gen/templates/doc/listing.md#listing-of-all-known-gpu-platforms
624+
# FAMILY
625+
if (gpu(['gen9'])) {
626+
$gpu_opts .= " -Dgpu-intel-gen9=1 ";
627+
}
628+
if (gpu(['gen11'])) {
629+
$gpu_opts .= " -Dgpu-intel-gen11=1 ";
630+
}
631+
if (gpu(['gen12'])) {
632+
$gpu_opts .= " -Dgpu-intel-gen12=1 ";
633+
}
634+
# DEVICE
635+
if (gpu(['ats'])) {
636+
$gpu_opts .= " -Dgpu-intel-ats=1 ";
637+
}
638+
if (gpu(['atsm'])) {
639+
$gpu_opts .= " -Dgpu-intel-ats-m=1 ";
640+
}
641+
if (gpu(['dg1'])) {
642+
$gpu_opts .= " -Dgpu-intel-dg1=1 ";
643+
}
644+
if (gpu(['dg2'])) {
645+
$gpu_opts .= " -Dgpu-intel-acm=1 ";
646+
}
647+
if (gpu(['pvc'])) {
648+
$gpu_opts .= " -Dgpu-intel-pvc=1 ";
649+
}
650+
651+
# SYCL 2020 device aspects: https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:device-aspects
652+
# ASPECT
653+
if ($current_optset !~ m/gpu/ or gpu(['double'])) {
654+
$sycl2020_aspects .= " -Daspect-fp64=1 ";
655+
}
656+
# SUPPORTS
657+
if (gpu(['subdevice'])) {
658+
$sycl2020_non_aspect_features .= " -Dsupports-subdevice=1 ";
614659
}
615660

616661
my $backward_compatibility_opts = "";
@@ -627,9 +672,9 @@ sub do_run
627672

628673
set_tool_path();
629674
if ($is_dynamic_suite == 1 or is_suite()) {
630-
execute("$python $lit -a $backward_compatibility_opts $gpu_opts $matrix $zedebug $jobset . $timeset > $run_all_lf 2>&1");
675+
execute("$python $lit -a $backward_compatibility_opts $sycl2020_aspects $sycl2020_non_aspect_features $gpu_opts $matrix $zedebug $jobset . $timeset > $run_all_lf 2>&1");
631676
} else {
632-
execute("$python $lit -a $gpu_opts $matrix $zedebug $path $timeset");
677+
execute("$python $lit -a $sycl2020_aspects $sycl2020_non_aspect_features $gpu_opts $matrix $zedebug $path $timeset");
633678
}
634679
}
635680

@@ -1061,19 +1106,11 @@ sub print2file
10611106
}
10621107

10631108
sub is_ats {
1064-
my $current_gpu = $ENV{'CURRENT_GPU_DEVICE'};
1065-
if (defined $current_gpu && $current_gpu =~ m/ats/i) {
1066-
return 1;
1067-
}
1068-
return 0;
1109+
return gpu("ats");
10691110
}
10701111

10711112
sub is_pvc {
1072-
my $current_gpu = $ENV{'CURRENT_GPU_DEVICE'};
1073-
if (defined $current_gpu && $current_gpu =~ m/pvc/i) {
1074-
return 1;
1075-
}
1076-
return 0;
1113+
return gpu("pvc");
10771114
}
10781115

10791116
sub append2file
@@ -1106,3 +1143,4 @@ sub CleanupTest {
11061143

11071144
1;
11081145

1146+

0 commit comments

Comments
 (0)