Merge pull request #1003 from ncos/knl-support
KNL support via generic target.
This commit is contained in:
27
alloy.py
27
alloy.py
@@ -293,8 +293,10 @@ 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"]
|
||||||
|
KNL = ["knl"]
|
||||||
|
|
||||||
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], ["KNL", KNL, 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):
|
||||||
if targets[i][0] in f_lines:
|
if targets[i][0] in f_lines:
|
||||||
@@ -329,6 +331,8 @@ def check_targets():
|
|||||||
# 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)):
|
||||||
|
if targets[5][2] == False and "knl" in f_lines[i]:
|
||||||
|
answer_sde = answer_sde + [["-knl", "knl"]]
|
||||||
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]:
|
||||||
@@ -587,6 +591,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
LLVM = [newest_LLVM, "trunk"]
|
LLVM = [newest_LLVM, "trunk"]
|
||||||
gen_archs = ["x86-64"]
|
gen_archs = ["x86-64"]
|
||||||
knc_archs = ["x86-64"]
|
knc_archs = ["x86-64"]
|
||||||
|
knl_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, options.gcc_toolchain_path)
|
build_LLVM(need_LLVM[i], "", "", "", False, False, False, True, False, make, options.gcc_toolchain_path)
|
||||||
@@ -608,14 +613,16 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
# 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' 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]:
|
if ("knc" in targets[j]) or ("knl" 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]:
|
||||||
|
arch = knl_archs
|
||||||
else:
|
else:
|
||||||
arch = archs
|
arch = archs
|
||||||
for i1 in range(0,len(arch)):
|
for i1 in range(0,len(arch)):
|
||||||
@@ -634,10 +641,16 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
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]
|
||||||
stability.wrapexe = os.environ["SDE_HOME"] + "/sde " + sde_targets[j][0] + " -- "
|
stability.wrapexe = os.environ["SDE_HOME"] + "/sde " + sde_targets[j][0] + " -- "
|
||||||
for i1 in range(0,len(archs)):
|
if "knc" in stability.target:
|
||||||
|
arch = knc_archs
|
||||||
|
elif "knl" in stability.target:
|
||||||
|
arch = knl_archs
|
||||||
|
else:
|
||||||
|
arch = archs
|
||||||
|
for i1 in range(0,len(arch)):
|
||||||
for i2 in range(0,len(opts)):
|
for i2 in range(0,len(opts)):
|
||||||
for i3 in range(dbg_begin,dbg_total):
|
for i3 in range(dbg_begin,dbg_total):
|
||||||
stability.arch = archs[i1]
|
stability.arch = arch[i1]
|
||||||
stability.no_opt = opts[i2]
|
stability.no_opt = opts[i2]
|
||||||
stability.ispc_flags = ispc_flags_tmp
|
stability.ispc_flags = ispc_flags_tmp
|
||||||
if (i3 != 0):
|
if (i3 != 0):
|
||||||
@@ -888,8 +901,8 @@ if __name__ == '__main__':
|
|||||||
"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='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")
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
3583
examples/intrinsics/knl.h
Normal file
3583
examples/intrinsics/knl.h
Normal file
File diff suppressed because it is too large
Load Diff
29
run_tests.py
29
run_tests.py
@@ -165,6 +165,9 @@ 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"):
|
||||||
|
ispc_cmd = ispc_exe_rel + " --werror --nowrap %s --arch=%s --target=%s" % \
|
||||||
|
(filename, options.arch, "generic-16")
|
||||||
else:
|
else:
|
||||||
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, options.target)
|
(filename, options.arch, options.target)
|
||||||
@@ -264,6 +267,9 @@ 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"):
|
||||||
|
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)
|
||||||
else:
|
else:
|
||||||
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, gcc_isa, match, obj_name, exe_name)
|
(options.compiler_exe, gcc_arch, gcc_isa, match, obj_name, exe_name)
|
||||||
@@ -285,6 +291,9 @@ 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"):
|
||||||
|
ispc_cmd = ispc_exe_rel + " --woff %s -o %s --arch=%s --target=%s" % \
|
||||||
|
(filename, obj_name, options.arch, "generic-16")
|
||||||
else:
|
else:
|
||||||
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, options.target)
|
(filename, obj_name, options.arch, options.target)
|
||||||
@@ -546,7 +555,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"]]
|
"generic-16", "generic-32", "generic-64", "knc", "knl"]]
|
||||||
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
|
||||||
@@ -622,7 +631,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")
|
options.target == "knc" or options.target == "knl")
|
||||||
|
|
||||||
global is_nvptx_target
|
global is_nvptx_target
|
||||||
is_nvptx_target = (options.target.find("nvptx") != -1)
|
is_nvptx_target = (options.target.find("nvptx") != -1)
|
||||||
@@ -650,10 +659,15 @@ 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":
|
||||||
|
error("No knl #include specified; using examples/intrinsics/knl.h\n", 2)
|
||||||
|
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"):
|
||||||
|
options.compiler_exe = "icpc"
|
||||||
elif is_windows:
|
elif is_windows:
|
||||||
options.compiler_exe = "cl.exe"
|
options.compiler_exe = "cl.exe"
|
||||||
else:
|
else:
|
||||||
@@ -699,7 +713,7 @@ def run_tests(options1, args, print_version):
|
|||||||
OS = "Linux"
|
OS = "Linux"
|
||||||
|
|
||||||
if not (OS == 'Linux'):
|
if not (OS == 'Linux'):
|
||||||
error ("knc target supported only on Linux", 1)
|
error ("knc target is supported only on Linux", 1)
|
||||||
# if no specific test files are specified, run all of the tests in tests/,
|
# if no specific test files are specified, run all of the tests in tests/,
|
||||||
# failing_tests/, and tests_errors/
|
# failing_tests/, and tests_errors/
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
@@ -890,11 +904,12 @@ if __name__ == "__main__":
|
|||||||
parser.add_option("-f", "--ispc-flags", dest="ispc_flags", help="Additional flags for ispc (-g, -O1, ...)",
|
parser.add_option("-f", "--ispc-flags", dest="ispc_flags", help="Additional flags for ispc (-g, -O1, ...)",
|
||||||
default="")
|
default="")
|
||||||
parser.add_option('-t', '--target', dest='target',
|
parser.add_option('-t', '--target', dest='target',
|
||||||
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, avx2-i32x8, avx2-i32x16, generic-x1, generic-x4, generic-x8, generic-x16, generic-x32, generic-x64, knc)',
|
help=('Set compilation target (sse2-i32x4, sse2-i32x8, sse4-i32x4, sse4-i32x8, ' +
|
||||||
default="sse4")
|
'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, knl)'), default="sse4")
|
||||||
parser.add_option('-a', '--arch', dest='arch',
|
parser.add_option('-a', '--arch', dest='arch',
|
||||||
help='Set architecture (arm, x86, x86-64)',
|
help='Set architecture (arm, x86, x86-64)',default="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",
|
||||||
default=None)
|
default=None)
|
||||||
parser.add_option('-o', '--no-opt', dest='no_opt', help='Disable optimization',
|
parser.add_option('-o', '--no-opt', dest='no_opt', help='Disable optimization',
|
||||||
|
|||||||
Reference in New Issue
Block a user