Skip to content

Commit 076b09c

Browse files
authored
Merge pull request intel#854 from myler/backward_compatibility_shliclel751
CMPLRTST-15373: support dpcpp backward compatibility testing on Windows.
2 parents 2d0e464 + e696f8a commit 076b09c

File tree

3 files changed

+55
-3
lines changed

3 files changed

+55
-3
lines changed

SYCL/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ configure specific single test execution in the command line:
163163
* **sycl_be** - SYCL backend to be used (opencl, ext_oneapi_level_zero,
164164
ext_oneapi_cuda, ext_oneapi_hip, ext_oneapi_intel_emulator);
165165
* **dump_ir** - if IR dumping is supported for compiler (True, False);
166+
* **compatibility_testing** - forces LIT infra to skip the tests compilation
167+
to support compatibility testing (a SYCL application is built with one
168+
version of SYCL compiler and then run with different SYCL RT version);
166169
* **gpu_aot_target_opts** - defines additional options which are passed to AOT
167170
compilation command line for GPU device. It can be also set by CMake variable
168171
GPU_AOT_TARGET_OPTS. If not specified "-device *" value is used.

SYCL/lit.cfg.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,12 @@
244244
'\nUsing fake sycl/sycl.hpp (which just points to CL/sycl.hpp)')
245245
extra_sycl_include = " " + ("/I" if cl_options else "-I") + config.extra_include
246246

247-
config.substitutions.append( ('%clangxx', ' '+ config.dpcpp_compiler + ' ' + config.cxx_flags + ' ' + arch_flag + extra_sycl_include) )
248-
config.substitutions.append( ('%clang', ' ' + config.dpcpp_compiler + ' ' + config.c_flags + extra_sycl_include) )
247+
if lit_config.params.get('compatibility_testing', False):
248+
config.substitutions.append( ('%clangxx', ' true ') )
249+
config.substitutions.append( ('%clang', ' true ') )
250+
else:
251+
config.substitutions.append( ('%clangxx', ' '+ config.dpcpp_compiler + ' ' + config.cxx_flags + ' ' + arch_flag + extra_sycl_include) )
252+
config.substitutions.append( ('%clang', ' ' + config.dpcpp_compiler + ' ' + config.c_flags + extra_sycl_include) )
249253

250254
config.substitutions.append( ('%threads_lib', config.sycl_threads_lib) )
251255

llvm_test_suite_sycl.pl

+46-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
my $run_all_lf = "$optset_work_dir/run_all.lf";
88

99
my $is_dynamic_suite = 0;
10+
my $prebuilt_buildstamp = "";
1011

1112
# @test_to_run_list stores only the test(s) that will be run
1213
# For example, for "tc -t llvm_test_suite_sycl/aot_cpu,aot_gpu" it will store 2 tests - aot_cpu and aot_gpu
@@ -92,9 +93,48 @@ sub is_suite {
9293
return is_same(\@current_test_list, \@whole_suite_test);
9394
}
9495

96+
sub compatibility_win {
97+
# The backward compatibility testing requires applications that were built by old released compiler
98+
# can be run on new runtime, it is difficult to set the correct environment by ics infra because
99+
# both compiler executables *.exe and compiler libraries *.dll are in the %PATH% environment.
100+
# So, we put pre-built tests on rdrive and use the backward compatibility testing on Windows
101+
my $compiler_path = "";
102+
if (not defined $ENV{BASECOMPILER}) {
103+
$failure_message = "fail to get path of base compiler, requiers option: \"base=1\"";
104+
return $COMPFAIL;
105+
} else {
106+
$compiler_path = $ENV{BASECOMPILER};
107+
}
108+
109+
if ($compiler_path =~ /deploy_(xmain-rel)\/xmainefi2[a-z]{1,}\/([0-9]{8})_([0-9]{6})/) {
110+
$prebuilt_buildstamp = "$2\_$3";
111+
} else {
112+
$failure_message = "fail to get buildstamp of base compiler";
113+
return $COMPFAIL;
114+
}
115+
116+
if (not ($current_optset eq "opt_use_cpu" or $current_optset eq "opt_use_gpu")) {
117+
$failure_message = "backward compatibility testing only supports 1) opt_use_cpu and 2) opt_use_gpu";
118+
return $COMPFAIL;
119+
}
120+
121+
# Always use mainline testbase for both xmain and xmain-rel.
122+
my $prebuilt = "$ENV{ICS_TESTDATA}/mainline/CT-SpecialTests/llvm_test_suite/$prebuilt_buildstamp/win/$current_optset/prebuilt.tar.gz";
123+
execute("tar -xzf $prebuilt");
124+
if ($command_status != 0) {
125+
$failure_message = "fail to extract $prebuilt";
126+
return $COMPFAIL;
127+
}
128+
129+
# Get test list
130+
@test_to_run_list = get_dynamic_test_list();
131+
return $PASS;
132+
}
133+
95134
sub init_test
96135
{
97136
if ($current_suite =~ /compatibility_llvm_test_suite_sycl/) {
137+
return compatibility_win() if (is_windows());
98138
my @folder_list = ("SYCL", $config_folder);
99139
my $folder_not_exist = 0;
100140
my $sparse_file_in_git = ".git/info/sparse-checkout";
@@ -556,9 +596,14 @@ sub do_run
556596
$gpu_opts .= "-Dgpu-intel-dg1=1";
557597
}
558598

599+
my $backward_compatibility_opts = "";
600+
if (is_windows()) {
601+
$backward_compatibility_opts = "-Dcompatibility_testing=1";
602+
}
603+
559604
set_tool_path();
560605
if ($is_dynamic_suite == 1 or is_suite()) {
561-
execute("$python $lit -a $gpu_opts $matrix $zedebug $jobset . $timeset > $run_all_lf 2>&1");
606+
execute("$python $lit -a $backward_compatibility_opts $gpu_opts $matrix $zedebug $jobset . $timeset > $run_all_lf 2>&1");
562607
} else {
563608
execute("$python $lit -a $gpu_opts $matrix $zedebug $path $timeset");
564609
}

0 commit comments

Comments
 (0)