File size: 2,818 Bytes
8b7c501 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
#!/usr/bin/env python
import confu
parser = confu.standard_parser("FP16 configuration script")
parser.add_argument("--compare", dest="compare", action="store_true",
help="Enable performance comparison with other half-precision implementations")
def main(args):
options = parser.parse_args(args)
build = confu.Build.from_options(options)
build.export_cpath("include", ["fp16.h"])
with build.options(source_dir="test", extra_include_dirs="test", deps=[build.deps.googletest, build.deps.psimd]):
fp16_tables = build.cxx("tables.cc")
build.unittest("ieee-to-fp32-bits",
[build.cxx("ieee-to-fp32-bits.cc"), fp16_tables])
build.unittest("ieee-to-fp32-value",
[build.cxx("ieee-to-fp32-value.cc"), fp16_tables])
build.unittest("ieee-from-fp32-value",
[build.cxx("ieee-from-fp32-value.cc"), fp16_tables])
build.unittest("alt-to-fp32-bits",
[build.cxx("alt-to-fp32-bits.cc"), fp16_tables])
build.unittest("alt-to-fp32-value",
[build.cxx("alt-to-fp32-value.cc"), fp16_tables])
build.unittest("alt-from-fp32-value",
[build.cxx("alt-from-fp32-value.cc"), fp16_tables])
if build.target.is_x86_64:
stubs = build.peachpy("peachpy/stubs.py")
build.unittest("alt-xmm-to-fp32-ymm-avx", [build.cxx("peachpy/alt-xmm-to-fp32-xmm-avx.cc"), stubs])
build.unittest("alt-xmm-to-fp32-ymm-avx2", [build.cxx("peachpy/alt-xmm-to-fp32-ymm-avx2.cc"), stubs])
if not build.target.is_emscripten:
build.unittest("ieee-to-fp32-psimd", build.cxx("ieee-to-fp32-psimd.cc"))
build.unittest("alt-to-fp32-psimd", build.cxx("alt-to-fp32-psimd.cc"))
build.unittest("ieee-to-fp32x2-psimd", build.cxx("ieee-to-fp32x2-psimd.cc"))
build.unittest("alt-to-fp32x2-psimd", build.cxx("alt-to-fp32x2-psimd.cc"))
build.unittest("bitcasts", build.cxx("bitcasts.cc"))
macros = ["BENCHMARK_HAS_NO_INLINE_ASSEMBLY"]
if options.compare:
macros.append("FP16_COMPARATIVE_BENCHMARKS")
with build.options(source_dir="bench", extra_include_dirs=".", macros=macros,
deps=[build.deps.googlebenchmark, build.deps.psimd]):
build.benchmark("ieee-element-bench", build.cxx("ieee-element.cc"))
build.benchmark("alt-element-bench", build.cxx("alt-element.cc"))
build.benchmark("from-ieee-array-bench", build.cxx("from-ieee-array.cc"))
build.benchmark("from-alt-array-bench", build.cxx("from-alt-array.cc"))
build.benchmark("to-ieee-array-bench", build.cxx("to-ieee-array.cc"))
build.benchmark("to-alt-array-bench", build.cxx("to-alt-array.cc"))
return build
if __name__ == "__main__":
import sys
main(sys.argv[1:]).generate()
|