Merge pull request #814 from ncos/master

Added KNC test target support for alloy.py (--only-targets='knc')
This commit is contained in:
Dmitry Babokin
2014-07-08 15:09:04 +04:00
3 changed files with 47 additions and 9 deletions

View File

@@ -231,6 +231,7 @@ def build_LLVM(version_LLVM, revision, folder, tarball, debug, selfbuild, extra,
def check_targets(): def check_targets():
answer = [] answer = []
answer_generic = [] answer_generic = []
answer_knc = []
answer_sde = [] answer_sde = []
# check what native targets do we have # check what native targets do we have
if current_OS != "Windows": if current_OS != "Windows":
@@ -242,6 +243,7 @@ def check_targets():
AVX = ["avx1-i32x4", "avx1-i32x8", "avx1-i32x16", "avx1-i64x4"] AVX = ["avx1-i32x4", "avx1-i32x8", "avx1-i32x16", "avx1-i64x4"]
AVX11 = ["avx1.1-i32x8","avx1.1-i32x16","avx1.1-i64x4"] AVX11 = ["avx1.1-i32x8","avx1.1-i32x16","avx1.1-i64x4"]
AVX2 = ["avx2-i32x8", "avx2-i32x16", "avx2-i64x4"] AVX2 = ["avx2-i32x8", "avx2-i32x16", "avx2-i64x4"]
targets = [["AVX2", AVX2, False], ["AVX1.1", AVX11, False], ["AVX", AVX, False], ["SSE4", SSE4, False], ["SSE2", SSE2, False]] targets = [["AVX2", AVX2, False], ["AVX1.1", AVX11, False], ["AVX", AVX, False], ["SSE4", SSE4, False], ["SSE2", SSE2, False]]
f_lines = take_lines("check_isa.exe", "first") f_lines = take_lines("check_isa.exe", "first")
for i in range(0,5): for i in range(0,5):
@@ -250,6 +252,10 @@ def check_targets():
answer = targets[j][1] + answer answer = targets[j][1] + answer
targets[j][2] = True targets[j][2] = True
break break
# generate targets for KNC
if current_OS == "Linux":
answer_knc = ["knc"]
if current_OS != "Windows": if current_OS != "Windows":
answer_generic = ["generic-4", "generic-16", "generic-8", "generic-1", "generic-32", "generic-64"] answer_generic = ["generic-4", "generic-16", "generic-8", "generic-1", "generic-32", "generic-64"]
# now check what targets we have with the help of SDE # now check what targets we have with the help of SDE
@@ -269,7 +275,7 @@ def check_targets():
error("you haven't got sde neither in SDE_HOME nor in your PATH.\n" + error("you haven't got sde neither in SDE_HOME nor in your PATH.\n" +
"To test all platforms please set SDE_HOME to path containing SDE.\n" + "To test all platforms please set SDE_HOME to path containing SDE.\n" +
"Please refer to http://www.intel.com/software/sde for SDE download information.", 2) "Please refer to http://www.intel.com/software/sde for SDE download information.", 2)
return [answer, answer_generic, answer_sde] return [answer, answer_generic, answer_sde, answer_knc]
# here we have SDE # here we have SDE
f_lines = take_lines(sde_exists + " -help", "all") f_lines = take_lines(sde_exists + " -help", "all")
for i in range(0,len(f_lines)): for i in range(0,len(f_lines)):
@@ -281,7 +287,7 @@ def check_targets():
answer_sde = answer_sde + [["-ivb", "avx1.1-i32x8"], ["-ivb", "avx1.1-i32x16"], ["-ivb", "avx1.1-i64x4"]] answer_sde = answer_sde + [["-ivb", "avx1.1-i32x8"], ["-ivb", "avx1.1-i32x16"], ["-ivb", "avx1.1-i64x4"]]
if targets[0][2] == False and "hsw" in f_lines[i]: if targets[0][2] == False and "hsw" in f_lines[i]:
answer_sde = answer_sde + [["-hsw", "avx2-i32x8"], ["-hsw", "avx2-i32x16"], ["-hsw", "avx2-i64x4"]] answer_sde = answer_sde + [["-hsw", "avx2-i32x8"], ["-hsw", "avx2-i32x16"], ["-hsw", "avx2-i64x4"]]
return [answer, answer_generic, answer_sde] return [answer, answer_generic, answer_sde, answer_knc]
def build_ispc(version_LLVM, make): def build_ispc(version_LLVM, make):
current_path = os.getcwd() current_path = os.getcwd()
@@ -313,6 +319,7 @@ def build_ispc(version_LLVM, make):
def execute_stability(stability, R, print_version): def execute_stability(stability, R, print_version):
stability1 = copy.deepcopy(stability) stability1 = copy.deepcopy(stability)
b_temp = run_tests.run_tests(stability1, [], print_version) b_temp = run_tests.run_tests(stability1, [], print_version)
temp = b_temp[0] temp = b_temp[0]
time = b_temp[1] time = b_temp[1]
@@ -370,6 +377,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
print_debug("\n\nStability validation run\n\n", False, "") print_debug("\n\nStability validation run\n\n", False, "")
stability = options_for_drivers() stability = options_for_drivers()
# stability constant options # stability constant options
stability.save_bin = False
stability.random = False stability.random = False
stability.ispc_flags = "" stability.ispc_flags = ""
stability.compiler_exe = None stability.compiler_exe = None
@@ -388,7 +396,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
stability.no_opt = False stability.no_opt = False
stability.wrapexe = "" stability.wrapexe = ""
# prepare parameters of run # prepare parameters of run
[targets_t, targets_generic_t, sde_targets_t] = check_targets() [targets_t, targets_generic_t, sde_targets_t, targets_knc_t] = check_targets()
rebuild = True rebuild = True
opts = [] opts = []
archs = [] archs = []
@@ -414,10 +422,13 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
rebuild = False rebuild = False
else: else:
common.check_tools(1) common.check_tools(1)
if only_targets != "": if only_targets != "":
only_targets += " " only_targets += " "
only_targets = only_targets.replace("generic "," generic-4 generic-16 ") only_targets = only_targets.replace("generic "," generic-4 generic-16 ")
only_targets_t = only_targets.split(" ") only_targets_t = only_targets.split(" ")
for i in only_targets_t: for i in only_targets_t:
if i == "": if i == "":
continue continue
@@ -434,11 +445,17 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
if i in sde_targets_t[j][1]: if i in sde_targets_t[j][1]:
sde_targets.append(sde_targets_t[j]) sde_targets.append(sde_targets_t[j])
err = False err = False
for j in range(0,len(targets_knc_t)):
if i in targets_knc_t[j]:
targets.append(targets_knc_t[j])
err = False
if err == True: if err == True:
error("You haven't sde for target " + i, 1) error("You haven't sde for target " + i, 1)
else: else:
targets = targets_t + targets_generic_t[:-4] targets = targets_t + targets_generic_t[:-4]
sde_targets = sde_targets_t sde_targets = sde_targets_t
if "build" in only: if "build" in only:
targets = [] targets = []
sde_targets = [] sde_targets = []
@@ -451,6 +468,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
if len(LLVM) == 0: if len(LLVM) == 0:
LLVM = [newest_LLVM, "trunk"] LLVM = [newest_LLVM, "trunk"]
gen_archs = ["x86-64"] gen_archs = ["x86-64"]
knc_archs = ["x86-64"]
need_LLVM = check_LLVM(LLVM) need_LLVM = check_LLVM(LLVM)
for i in range(0,len(need_LLVM)): for i in range(0,len(need_LLVM)):
build_LLVM(need_LLVM[i], "", "", "", False, False, False, True, False, make) build_LLVM(need_LLVM[i], "", "", "", False, False, False, True, False, make)
@@ -467,6 +485,8 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
stability.wrapexe = "" stability.wrapexe = ""
if "generic" in targets[j]: if "generic" in targets[j]:
arch = gen_archs arch = gen_archs
elif "knc" in targets[j]:
arch = knc_archs
else: else:
arch = archs arch = archs
for i1 in range(0,len(arch)): for i1 in range(0,len(arch)):
@@ -592,7 +612,11 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
msg.attach(text) msg.attach(text)
attach_mail_file(msg, alloy_build, "alloy_build.log") attach_mail_file(msg, alloy_build, "alloy_build.log")
s = smtplib.SMTP(smtp_server) s = smtplib.SMTP(smtp_server)
s.sendmail('ISPC_test_system', options.notify.split(" "), msg.as_string())
print "Sending an e-mail with logs:", options.notify
for name in options.notify.split(" "):
print "Sending to: ", name
s.sendmail('ISPC_test_system', name, msg.as_string())
s.quit() s.quit()
def Main(): def Main():
@@ -707,7 +731,10 @@ if __name__ == '__main__':
"Stability validation run with LLVM 3.2, 3.3; -O0; x86,\nupdate fail_db.txt with passes and fails\n\talloy.py -r --only='3.2 -O0 stability 3.3 x86' --update-errors=FP\n" + "Stability validation run with LLVM 3.2, 3.3; -O0; x86,\nupdate fail_db.txt with passes and fails\n\talloy.py -r --only='3.2 -O0 stability 3.3 x86' --update-errors=FP\n" +
"Try to build compiler with all LLVM\n\talloy.py -r --only=build\n" + "Try to build compiler with all LLVM\n\talloy.py -r --only=build\n" +
"Performance validation run with 10 runs of each test and comparing to branch 'old'\n\talloy.py -r --only=performance --compare-with=old --number=10\n" + "Performance validation run with 10 runs of each test and comparing to branch 'old'\n\talloy.py -r --only=performance --compare-with=old --number=10\n" +
"Validation run. Update fail_db.txt with new fails, send results to my@my.com\n\talloy.py -r --update-errors=F --notify='my@my.com'\n") "Validation run. Update fail_db.txt with new fails, send results to my@my.com\n\talloy.py -r --update-errors=F --notify='my@my.com'\n" +
"Test KNC target (not tested when tested all supported targets, so should be set explicitly via --only-targets)\n\talloy.py -r --only='satbility' --only-targets='knc'\n")
num_threads="%s" % multiprocessing.cpu_count() num_threads="%s" % multiprocessing.cpu_count()
parser = MyParser(usage="Usage: alloy.py -r/-b [options]", epilog=examples) parser = MyParser(usage="Usage: alloy.py -r/-b [options]", epilog=examples)
parser.add_option('-b', '--build-llvm', dest='build_llvm', parser.add_option('-b', '--build-llvm', dest='build_llvm',

View File

@@ -36,6 +36,16 @@ import sys
import os import os
import errno import errno
import shutil import shutil
class ExecutionStatGatherer:
def __init__(self):
optimizations = ['O0', 'O2']
architectures = ['x86', 'x86-64']
all_est_targets = ['sse2-i32x4', 'sse2-i32x8', 'sse4-i32x4', 'sse4-i32x8', 'sse4-i16x8',
'sse4-i8x16', 'avx1-i32x8', 'avx1-i32x16', 'avx1.1-i32x8',
'avx1.1-i32x16', 'avx2-i32x8', 'avx2-i32x16', 'generic-x1',
'generic-x4', 'generic-x8', 'generic-x16', 'generic-x32',
'generic-x64', 'knc']
def write_to_file(filename, line): def write_to_file(filename, line):
f = open(filename, 'a') f = open(filename, 'a')

View File

@@ -64,8 +64,8 @@ def run_command(cmd):
sp = subprocess.Popen(arg_list, stdin=None, sp = subprocess.Popen(arg_list, stdin=None,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
except: except:
print_debug("ERROR: The child (%s) raised an esception: %s\n" % (cmd, sys.exc_info()[1]), s, run_tests_log) print_debug("ERROR: The child (%s) raised an exception: %s\n" % (cmd, sys.exc_info()[1]), s, run_tests_log)
raise raise
out = sp.communicate() out = sp.communicate()
@@ -320,7 +320,7 @@ def run_tasks_from_queue(queue, queue_ret, queue_skip, total_tests_arg, max_test
os.chdir(tmpdir) os.chdir(tmpdir)
else: else:
olddir = "" olddir = ""
compile_error_files = [ ] compile_error_files = [ ]
run_error_files = [ ] run_error_files = [ ]
skip_files = [ ] skip_files = [ ]
@@ -347,7 +347,8 @@ def run_tasks_from_queue(queue, queue_ret, queue_skip, total_tests_arg, max_test
try: try:
(compile_error, run_error) = run_test(filename) (compile_error, run_error) = run_test(filename)
except: except:
sys.exit(-1) # This is in case the child has unexpectedly died print_debug("ERROR: run_test function raised an exception: %s\n" % (sys.exc_info()[1]), s, run_tests_log)
sys.exit(-1) # This is in case the child has unexpectedly died or some other exception happened
if compile_error != 0: if compile_error != 0:
compile_error_files += [ filename ] compile_error_files += [ filename ]