summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2019-11-02 14:39:31 -0500
committerGitHub <noreply@github.com>2019-11-02 14:39:31 -0500
commit573789f067e1715c06bf450ddddc063f5879340d (patch)
treef02b6bbd6293dcb27c8c9cf8774e9d8063d8d8d9 /var
parentc43e6839d444b4053fbef77f4feebfa8a95b9fe2 (diff)
downloadspack-573789f067e1715c06bf450ddddc063f5879340d.tar.gz
spack-573789f067e1715c06bf450ddddc063f5879340d.tar.bz2
spack-573789f067e1715c06bf450ddddc063f5879340d.tar.xz
spack-573789f067e1715c06bf450ddddc063f5879340d.zip
Add QNNPACK package (#13549)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/py-torch/package.py3
-rw-r--r--var/spack/repos/builtin/packages/qnnpack/package.py83
2 files changed, 85 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/py-torch/package.py b/var/spack/repos/builtin/packages/py-torch/package.py
index 8fec773e3d..fbd628637a 100644
--- a/var/spack/repos/builtin/packages/py-torch/package.py
+++ b/var/spack/repos/builtin/packages/py-torch/package.py
@@ -122,7 +122,6 @@ class PyTorch(PythonPackage):
depends_on('mkl', when='+mkldnn')
# TODO: add dependency: https://github.com/Maratyszcza/NNPACK
depends_on('nnpack', when='+nnpack')
- # TODO: add dependency: https://github.com/pytorch/QNNPACK
depends_on('qnnpack', when='+qnnpack')
depends_on('mpi', when='+distributed')
depends_on('nccl', when='+nccl')
@@ -201,6 +200,8 @@ class PyTorch(PythonPackage):
enable_or_disable('nnpack')
enable_or_disable('qnnpack')
+ # Never use vendored copy of QNNPACK
+ env.set('USE_PYTORCH_QNNPACK=OFF')
enable_or_disable('distributed')
enable_or_disable('nccl')
diff --git a/var/spack/repos/builtin/packages/qnnpack/package.py b/var/spack/repos/builtin/packages/qnnpack/package.py
new file mode 100644
index 0000000000..19977490fd
--- /dev/null
+++ b/var/spack/repos/builtin/packages/qnnpack/package.py
@@ -0,0 +1,83 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class Qnnpack(CMakePackage):
+ """QNNPACK (Quantized Neural Networks PACKage) is a mobile-optimized
+ library for low-precision high-performance neural network inference.
+ QNNPACK provides implementation of common neural network operators on
+ quantized 8-bit tensors."""
+
+ homepage = "https://github.com/pytorch/QNNPACK"
+ git = "https://github.com/pytorch/QNNPACK.git"
+
+ version('master', branch='master')
+
+ depends_on('cmake@3.5:', type='build')
+
+ resource(
+ name='cpuinfo',
+ git='https://github.com/Maratyszcza/cpuinfo.git',
+ destination='deps',
+ placement='cpuinfo'
+ )
+ resource(
+ name='fp16',
+ git='https://github.com/Maratyszcza/FP16.git',
+ destination='deps',
+ placement='fp16'
+ )
+ resource(
+ name='fxdiv',
+ git='https://github.com/Maratyszcza/FXdiv.git',
+ destination='deps',
+ placement='fxdiv'
+ )
+ resource(
+ name='googlebenchmark',
+ url='https://github.com/google/benchmark/archive/v1.4.1.zip',
+ sha256='61ae07eb5d4a0b02753419eb17a82b7d322786bb36ab62bd3df331a4d47c00a7',
+ destination='deps',
+ placement='googlebenchmark',
+ )
+ resource(
+ name='googletest',
+ url='https://github.com/google/googletest/archive/release-1.8.0.zip',
+ sha256='f3ed3b58511efd272eb074a3a6d6fb79d7c2e6a0e374323d1e6bcbcc1ef141bf',
+ destination='deps',
+ placement='googletest',
+ )
+ resource(
+ name='psimd',
+ git='https://github.com/Maratyszcza/psimd.git',
+ destination='deps',
+ placement='psimd'
+ )
+ resource(
+ name='pthreadpool',
+ git='https://github.com/Maratyszcza/pthreadpool.git',
+ destination='deps',
+ placement='pthreadpool'
+ )
+
+ def cmake_args(self):
+ return [
+ '-DCPUINFO_SOURCE_DIR={0}'.format(
+ join_path(self.stage.source_path, 'deps/cpuinfo')),
+ '-DFP16_SOURCE_DIR={0}'.format(
+ join_path(self.stage.source_path, 'deps/fp16')),
+ '-DFXDIV_SOURCE_DIR={0}'.format(
+ join_path(self.stage.source_path, 'deps/fxdiv')),
+ '-DPSIMD_SOURCE_DIR={0}'.format(
+ join_path(self.stage.source_path, 'deps/psimd')),
+ '-DPTHREADPOOL_SOURCE_DIR={0}'.format(
+ join_path(self.stage.source_path, 'deps/pthreadpool')),
+ '-DGOOGLEBENCHMARK_SOURCE_DIR={0}'.format(
+ join_path(self.stage.source_path, 'deps/googlebenchmark')),
+ '-DGOOGLETEST_SOURCE_DIR={0}'.format(
+ join_path(self.stage.source_path, 'deps/googletest')),
+ ]