add knl-generic and knl-avx512 targets in alloy.py

This commit is contained in:
Anton Mitrokhin
2015-05-21 17:12:39 +03:00
parent a70dcb13d1
commit 7f281a4642
2 changed files with 49 additions and 19 deletions

View File

@@ -273,6 +273,18 @@ def build_LLVM(version_LLVM, revision, folder, tarball, debug, selfbuild, extra,
try_do_LLVM("build LLVM and than install LLVM ", "msbuild INSTALL.vcxproj /V:m /p:Platform=Win32 /p:Configuration=Release /t:rebuild", from_validation) try_do_LLVM("build LLVM and than install LLVM ", "msbuild INSTALL.vcxproj /V:m /p:Platform=Win32 /p:Configuration=Release /t:rebuild", from_validation)
os.chdir(current_path) os.chdir(current_path)
def unsupported_llvm_targets(LLVM_VERSION):
prohibited_list = {"3.2":["knl-avx512"],
"3.3":["knl-avx512"],
"3.4":["knl-avx512"],
"3.5":["knl-avx512"],
"3.6":["knl-avx512"],
"3.7":[],
"trunk":[]}
return prohibited_list[LLVM_VERSION]
def check_targets(): def check_targets():
answer = [] answer = []
answer_generic = [] answer_generic = []
@@ -288,12 +300,13 @@ def check_targets():
try_do_LLVM("build check_ISA", cisa_compiler + " check_isa.cpp -o check_isa.exe", True) try_do_LLVM("build check_ISA", cisa_compiler + " check_isa.cpp -o check_isa.exe", True)
else: else:
try_do_LLVM("build check_ISA", "cl check_isa.cpp", True) try_do_LLVM("build check_ISA", "cl check_isa.cpp", True)
SSE2 = ["sse2-i32x4", "sse2-i32x8"] SSE2 = ["sse2-i32x4", "sse2-i32x8"]
SSE4 = ["sse4-i32x4", "sse4-i32x8", "sse4-i16x8", "sse4-i8x16"] SSE4 = ["sse4-i32x4", "sse4-i32x8", "sse4-i16x8", "sse4-i8x16"]
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"]
KNL = ["knl"] KNL = ["knl-generic", "knl-avx512"]
targets = [["AVX2", AVX2, False], ["AVX1.1", AVX11, False], ["AVX", AVX, False], ["SSE4", SSE4, False], targets = [["AVX2", AVX2, False], ["AVX1.1", AVX11, False], ["AVX", AVX, False], ["SSE4", SSE4, False],
["SSE2", SSE2, False], ["KNL", KNL, False]] ["SSE2", SSE2, False], ["KNL", KNL, False]]
@@ -332,7 +345,7 @@ def check_targets():
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)):
if targets[5][2] == False and "knl" in f_lines[i]: if targets[5][2] == False and "knl" in f_lines[i]:
answer_sde = answer_sde + [["-knl", "knl"]] answer_sde = answer_sde + [["-knl", "knl-generic"], ["-knl", "knl-avx512"]]
if targets[3][2] == False and "wsm" in f_lines[i]: if targets[3][2] == False and "wsm" in f_lines[i]:
answer_sde = answer_sde + [["-wsm", "sse4-i32x4"], ["-wsm", "sse4-i32x8"], ["-wsm", "sse4-i16x8"], ["-wsm", "sse4-i8x16"]] answer_sde = answer_sde + [["-wsm", "sse4-i32x4"], ["-wsm", "sse4-i32x8"], ["-wsm", "sse4-i16x8"], ["-wsm", "sse4-i8x16"]]
if targets[2][2] == False and "snb" in f_lines[i]: if targets[2][2] == False and "snb" in f_lines[i]:
@@ -608,20 +621,25 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
build_ispc(LLVM[i], make) build_ispc(LLVM[i], make)
for j in range(0,len(targets)): for j in range(0,len(targets)):
stability.target = targets[j] stability.target = targets[j]
# the target might be not supported by the chosen llvm version
if (stability.target in unsupported_llvm_targets(LLVM[i])):
print_debug("Warning: target " + stability.target + " is not supported in LLVM " + LLVM[i] + "\n", False, stability_log)
continue
stability.wrapexe = "" stability.wrapexe = ""
# choosing right compiler for a given target # choosing right compiler for a given target
# sometimes clang++ is not avaluable. if --ispc-build-compiler = gcc we will pass in g++ compiler # sometimes clang++ is not avaluable. if --ispc-build-compiler = gcc we will pass in g++ compiler
if options.ispc_build_compiler == "gcc": if options.ispc_build_compiler == "gcc":
stability.compiler_exe = "g++" stability.compiler_exe = "g++"
# but 'knc/knl' target is supported only by icpc, so set explicitly # but 'knc/knl' target is supported only by icpc, so set explicitly
if ("knc" in targets[j]) or ("knl" in targets[j]): if ("knc" in targets[j]) or ("knl-generic" in targets[j]) or ("knl-avx512" in targets[j]):
stability.compiler_exe = "icpc" stability.compiler_exe = "icpc"
# now set archs for targets # now set archs for targets
if "generic" in targets[j]: if "generic" in targets[j]:
arch = gen_archs arch = gen_archs
elif "knc" in targets[j]: elif "knc" in targets[j]:
arch = knc_archs arch = knc_archs
elif "knl" in targets[j]: elif ("knl-generic" in targets[j]) or ("knl-avx512" in targets[j]):
arch = knl_archs arch = knl_archs
else: else:
arch = archs arch = archs
@@ -640,10 +658,15 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
print_version = 0 print_version = 0
for j in range(0,len(sde_targets)): for j in range(0,len(sde_targets)):
stability.target = sde_targets[j][1] stability.target = sde_targets[j][1]
# the target might be not supported by the chosen llvm version
if (stability.target in unsupported_llvm_targets(LLVM[i])):
print_debug("Warning: target " + stability.target + " is not supported in LLVM " + LLVM[i] + "\n", False, stability_log)
continue
stability.wrapexe = os.environ["SDE_HOME"] + "/sde " + sde_targets[j][0] + " -- " stability.wrapexe = os.environ["SDE_HOME"] + "/sde " + sde_targets[j][0] + " -- "
if "knc" in stability.target: if "knc" in stability.target:
arch = knc_archs arch = knc_archs
elif "knl" in stability.target: elif ("knl-generic" in stability.target) or ("knl-avx512" in stability.target):
arch = knl_archs arch = knl_archs
else: else:
arch = archs arch = archs
@@ -902,7 +925,7 @@ if __name__ == '__main__':
"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='stability' --only-targets='knc'\n" + "Test KNC target (not tested when tested all supported targets, so should be set explicitly via --only-targets)\n\talloy.py -r --only='stability' --only-targets='knc'\n" +
"Test KNL target (requires sde)\n\talloy.py -r --only='stability' --only-targets='knl'\n") "Test KNL target (requires sde)\n\talloy.py -r --only='stability' --only-targets='knl-generic knl-avx512'\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)
@@ -952,8 +975,8 @@ if __name__ == '__main__':
run_group.add_option('--update-errors', dest='update', run_group.add_option('--update-errors', dest='update',
help='rewrite fail_db.txt file according to received results (F or FP)', default="") help='rewrite fail_db.txt file according to received results (F or FP)', default="")
run_group.add_option('--only-targets', dest='only_targets', run_group.add_option('--only-targets', dest='only_targets',
help='set list of targets to test. Possible values - all subnames of targets.', help='set list of targets to test. Possible values - all subnames of targets, plus "knc" for "generic" ' +
default="") 'version of knc support, "knl-generic" or "knl-avx512" for "generic"/"native" knl support', default="")
run_group.add_option('--time', dest='time', run_group.add_option('--time', dest='time',
help='display time of testing', default=False, action='store_true') help='display time of testing', default=False, action='store_true')
run_group.add_option('--only', dest='only', run_group.add_option('--only', dest='only',

View File

@@ -165,7 +165,7 @@ def run_test(testname):
if (options.target == "knc"): if (options.target == "knc"):
ispc_cmd = ispc_exe_rel + " --werror --nowrap %s --arch=%s --target=%s" % \ ispc_cmd = ispc_exe_rel + " --werror --nowrap %s --arch=%s --target=%s" % \
(filename, options.arch, "generic-16") (filename, options.arch, "generic-16")
elif (options.target == "knl"): elif (options.target == "knl-generic"):
ispc_cmd = ispc_exe_rel + " --werror --nowrap %s --arch=%s --target=%s" % \ ispc_cmd = ispc_exe_rel + " --werror --nowrap %s --arch=%s --target=%s" % \
(filename, options.arch, "generic-16") (filename, options.arch, "generic-16")
else: else:
@@ -267,7 +267,7 @@ def run_test(testname):
if (options.target == "knc"): if (options.target == "knc"):
cc_cmd = "%s -O2 -I. %s %s test_static.cpp -DTEST_SIG=%d %s -o %s" % \ cc_cmd = "%s -O2 -I. %s %s test_static.cpp -DTEST_SIG=%d %s -o %s" % \
(options.compiler_exe, gcc_arch, "-mmic", match, obj_name, exe_name) (options.compiler_exe, gcc_arch, "-mmic", match, obj_name, exe_name)
elif (options.target == "knl"): elif (options.target == "knl-generic"):
cc_cmd = "%s -O2 -I. %s %s test_static.cpp -DTEST_SIG=%d %s -o %s" % \ cc_cmd = "%s -O2 -I. %s %s test_static.cpp -DTEST_SIG=%d %s -o %s" % \
(options.compiler_exe, gcc_arch, "-xMIC-AVX512", match, obj_name, exe_name) (options.compiler_exe, gcc_arch, "-xMIC-AVX512", match, obj_name, exe_name)
elif (options.target == "knl-avx512"): elif (options.target == "knl-avx512"):
@@ -294,7 +294,7 @@ def run_test(testname):
if (options.target == "knc"): if (options.target == "knc"):
ispc_cmd = ispc_exe_rel + " --woff %s -o %s --arch=%s --target=%s" % \ ispc_cmd = ispc_exe_rel + " --woff %s -o %s --arch=%s --target=%s" % \
(filename, obj_name, options.arch, "generic-16") (filename, obj_name, options.arch, "generic-16")
elif (options.target == "knl"): elif (options.target == "knl-generic"):
ispc_cmd = ispc_exe_rel + " --woff %s -o %s --arch=%s --target=%s" % \ ispc_cmd = ispc_exe_rel + " --woff %s -o %s --arch=%s --target=%s" % \
(filename, obj_name, options.arch, "generic-16") (filename, obj_name, options.arch, "generic-16")
else: else:
@@ -558,7 +558,7 @@ def verify():
"sse4-i8x16", "avx1-i32x4" "avx1-i32x8", "avx1-i32x16", "avx1-i64x4", "avx1.1-i32x8", "sse4-i8x16", "avx1-i32x4" "avx1-i32x8", "avx1-i32x16", "avx1-i64x4", "avx1.1-i32x8",
"avx1.1-i32x16", "avx1.1-i64x4", "avx2-i32x8", "avx2-i32x16", "avx2-i64x4", "avx1.1-i32x16", "avx1.1-i64x4", "avx2-i32x8", "avx2-i32x16", "avx2-i64x4",
"generic-1", "generic-4", "generic-8", "generic-1", "generic-4", "generic-8",
"generic-16", "generic-32", "generic-64", "knc", "knl", "knl-avx512"]] "generic-16", "generic-32", "generic-64", "knc", "knl-generic", "knl-avx512"]]
for i in range (0,len(f_lines)): for i in range (0,len(f_lines)):
if f_lines[i][0] == "%": if f_lines[i][0] == "%":
continue continue
@@ -634,7 +634,7 @@ def run_tests(options1, args, print_version):
global is_generic_target global is_generic_target
is_generic_target = ((options.target.find("generic-") != -1 and is_generic_target = ((options.target.find("generic-") != -1 and
options.target != "generic-1" and options.target != "generic-x1") or options.target != "generic-1" and options.target != "generic-x1") or
options.target == "knc" or options.target == "knl") options.target == "knc" or options.target == "knl-generic")
global is_nvptx_target global is_nvptx_target
is_nvptx_target = (options.target.find("nvptx") != -1) is_nvptx_target = (options.target.find("nvptx") != -1)
@@ -662,14 +662,16 @@ def run_tests(options1, args, print_version):
elif options.target == "knc": elif options.target == "knc":
error("No knc #include specified; using examples/intrinsics/knc.h\n", 2) error("No knc #include specified; using examples/intrinsics/knc.h\n", 2)
options.include_file = "examples/intrinsics/knc.h" options.include_file = "examples/intrinsics/knc.h"
elif options.target == "knl": elif options.target == "knl-generic":
error("No knl #include specified; using examples/intrinsics/knl.h\n", 2) error("No knl #include specified; using examples/intrinsics/knl.h\n", 2)
options.include_file = "examples/intrinsics/knl.h" options.include_file = "examples/intrinsics/knl.h"
if options.compiler_exe == None: if options.compiler_exe == None:
if (options.target == "knc"): if (options.target == "knc"):
options.compiler_exe = "icpc" options.compiler_exe = "icpc"
elif (options.target == "knl"): elif (options.target == "knl-generic"):
options.compiler_exe = "icpc"
elif (options.target == "knl-avx512"):
options.compiler_exe = "icpc" options.compiler_exe = "icpc"
elif is_windows: elif is_windows:
options.compiler_exe = "cl.exe" options.compiler_exe = "cl.exe"
@@ -695,9 +697,6 @@ def run_tests(options1, args, print_version):
ispc_root = "." ispc_root = "."
# checks the required environment otherwise prints an error message # checks the required environment otherwise prints an error message
if ((options.target == "knl-avx512") and (options.wrapexe == "")):
options.wrapexe = "sde -knl -- "
if (options.target == "knc"): if (options.target == "knc"):
options.wrapexe = "micnativeloadex" options.wrapexe = "micnativeloadex"
PATH_dir = string.split(os.getenv("PATH"), os.pathsep) PATH_dir = string.split(os.getenv("PATH"), os.pathsep)
@@ -913,7 +912,7 @@ if __name__ == "__main__":
help=('Set compilation target (sse2-i32x4, sse2-i32x8, sse4-i32x4, sse4-i32x8, ' + help=('Set compilation target (sse2-i32x4, sse2-i32x8, sse4-i32x4, sse4-i32x8, ' +
'sse4-i16x8, sse4-i8x16, avx1-i32x8, avx1-i32x16, avx1.1-i32x8, avx1.1-i32x16, ' + '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, ' + 'avx2-i32x8, avx2-i32x16, generic-x1, generic-x4, generic-x8, generic-x16, ' +
'generic-x32, generic-x64, knc, knl)'), default="sse4") 'generic-x32, generic-x64, knc, knl-generic)'), default="sse4")
parser.add_option('-a', '--arch', dest='arch', parser.add_option('-a', '--arch', dest='arch',
help='Set architecture (arm, x86, x86-64)',default="x86-64") help='Set architecture (arm, x86, x86-64)',default="x86-64")
parser.add_option("-c", "--compiler", dest="compiler_exe", help="C/C++ compiler binary to use to run tests", parser.add_option("-c", "--compiler", dest="compiler_exe", help="C/C++ compiler binary to use to run tests",
@@ -939,5 +938,13 @@ if __name__ == "__main__":
parser.add_option("--save-bin", dest='save_bin', help='compile and create bin, but don\'t execute it', parser.add_option("--save-bin", dest='save_bin', help='compile and create bin, but don\'t execute it',
default=False, action="store_true") default=False, action="store_true")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
# Untill we have the hardware to run testing on:
if ((options.target == "knl-generic") and (options.wrapexe == "")):
options.wrapexe = "sde -knl -- "
if ((options.target == "knl-avx512") and (options.wrapexe == "")):
options.wrapexe = "sde -knl -- "
L = run_tests(options, args, 1) L = run_tests(options, args, 1)
exit(0) exit(0)