[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT/MKL-DNN PATCH v1] Initial port of mkl-dnn to Unikraft
This is our initial port of mkl-dnn to Unikraft as an external library. This library requires c++ and intel-intrinsics support. For example, here's a working example of the list of libraries needed in the application's Makefile: LIBS := $(UK_LIBS)/libunwind:$(UK_LIBS)/compiler-rt:$(UK_LIBS)/libcxxabi: $(UK_LIBS)/libcxx:$(UK_LIBS)/newlib:$(UK_LIBS)/intel-intrinsics: $(UK_LIBS)/mkl-dnn Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx> --- CODING_STYLE.md | 4 + CONTRIBUTING.md | 4 + Config.uk | 6 ++ MAINTAINERS.md | 10 ++ Makefile.uk | 242 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 5 + include/cpuid.h | 158 +++++++++++++++++++++++++++++++ include/mkldnn_version.h | 32 +++++++ 8 files changed, 461 insertions(+) create mode 100644 CODING_STYLE.md create mode 100644 CONTRIBUTING.md create mode 100644 Config.uk create mode 100644 MAINTAINERS.md create mode 100644 Makefile.uk create mode 100644 README.md create mode 100644 include/cpuid.h create mode 100644 include/mkldnn_version.h diff --git a/CODING_STYLE.md b/CODING_STYLE.md new file mode 100644 index 0000000..5730041 --- /dev/null +++ b/CODING_STYLE.md @@ -0,0 +1,4 @@ +Coding Style +============ + +Please refer to the `CODING_STYLE.md` file in the main Unikraft repository. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5f55eca --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,4 @@ +Contributing to Unikraft +======================= + +Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository. diff --git a/Config.uk b/Config.uk new file mode 100644 index 0000000..bf460aa --- /dev/null +++ b/Config.uk @@ -0,0 +1,6 @@ +menuconfig LIBMKLDNN + bool "mkl-dnn - Intel Math Kernel Library for DNNs" + select LIBNOLIBC if !HAVE_LIBC + select LIBCOMPILER_RT + select UKSYSINFO + default n diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000..31453e3 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,10 @@ +Maintainers List +================ + +For notes on how to read this information, please refer to `MAINTAINERS.md` in +the main Unikraft repository. + + NEWLIB-UNIKRAFT + M: Felipe Huici <felipe.huici@xxxxxxxxx> + L: minios-devel@xxxxxxxxxxxxx + F: * diff --git a/Makefile.uk b/Makefile.uk new file mode 100644 index 0000000..54146b9 --- /dev/null +++ b/Makefile.uk @@ -0,0 +1,242 @@ +# libmkl-dnn Makefile.uk +# +# Authors: Felipe Huici <felipe.huici@xxxxxxxxx> +# +# Copyright (c) 2019, NEC Europe Ltd., NEC Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. +# + +################################################################################ +# Library registration +################################################################################ +$(eval $(call addlib_s,libmkldnn,$(CONFIG_LIBMKLDNN))) + +ifeq ($(CONFIG_LIBMKLDNN),y) +ifneq ($(CONFIG_LIBCOMPILER_RT),y) +$(error Require libcompiler_rt) +endif +endif + +################################################################################ +# Sources +################################################################################ +LIBMKLDNN_VERSION=0.19-rc +LIBMKLDNN_URL=https://github.com/intel/mkl-dnn/archive/v$(LIBMKLDNN_VERSION).zip +LIBMKLDNN_PATCHDIR=$(LIBMKLDNN_BASE)/patches +$(eval $(call fetch,libmkldnn,$(LIBMKLDNN_URL))) +$(eval $(call patch,libmkldnn,$(LIBMKLDNN_PATCHDIR),libmkldnn-$(LIBMKLDNN_VERSION))) + +################################################################################ +# Helpers +################################################################################ +LIBMKLDNN_SUBDIR=mkl-dnn-$(LIBMKLDNN_VERSION) +LIBMKLDNN_SRC=$(LIBMKLDNN_ORIGIN)/$(LIBMKLDNN_SUBDIR) + +################################################################################ +# Library includes +################################################################################ +LIBMKL-INCLUDES += -I$(LIBMKLDNN_SRC)/include \ + -I$(LIBMKLDNN_SRC)/src \ + -I$(LIBMKLDNN_SRC)/src/cpu \ + -I$(LIBMKLDNN_SRC)/src/cpu/gemm \ + -I$(LIBMKLDNN_SRC)/src/common \ + -I$(LIBMKLDNN_BASE)/include \ + +CINCLUDES-$(CONFIG_LIBMKLDNN) += $(LIBMKL-INCLUDES) +CXXINCLUDES-$(CONFIG_LIBMKLDNN) += $(LIBMKL-INCLUDES) + +################################################################################ +# Global flags +################################################################################ +LIBMKLDNN-CONFIG_FLAGS = -DCMAKE_BUILD_TYPE=Release \ + -DMKLDNN_ENABLE_CONCURRENT_EXEC=OFF \ + -DMKLDNN_LIBRARY_TYPE=STATIC \ + -DMKLDNN_THREADING=OMP:COMP \ + -DMKLDNN_USE_MKL=NONE \ + -DMKLDNN_VERBOSE=ON \ + -DWITH_EXAMPLE=OFF \ + -DWITH_TEST=OFF + +LIBMKLDNN_CFLAGS-y += $(LIBMKLDNN-CONFIG_FLAGS) +LIBMKLDNN_CXXFLAGS-y += $(LIBMKLDNN-CONFIG_FLAGS) + +################################################################################ +# Suppress Flags +################################################################################ +LIBMKLDNN_SUPPRESS_FLAGS-y += -Wno-unused-parameter \ + -Wno-unused-but-set-parameter \ + -Wno-unknown-pragmas + +LIBMKLDNN_CFLAGS-y += $(LIBMKLDNN_SUPPRESS_FLAGS-y) +LIBMKLDNN_CXXFLAGS-y += $(LIBMKLDNN_SUPPRESS_FLAGS-y) + +################################################################################ +# Library sources - cpu +################################################################################ +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/cpu_barrier.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/cpu_batch_normalization_utils.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/cpu_concat.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/cpu_engine.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/cpu_memory.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/cpu_primitive.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/cpu_reducer.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/cpu_reorder.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/cpu_sum.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm_convolution_utils.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm_inner_product.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm_x8s8s32x_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm_x8s8s32x_inner_product.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx2_1x1_conv_kernel_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx2_1x1_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx2_conv_kernel_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx2_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_common_1x1_conv_kernel.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_common_1x1_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_common_conv_kernel.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_common_conv_winograd_kernel_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_common_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_common_convolution_winograd.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_common_lrn.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_core_fp32_wino_conv_2x3.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_core_fp32_wino_conv_4x3.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_core_fp32_wino_conv_4x3_kernel.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_core_u8s8s32x_wino_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_core_x8s8s32x_1x1_conv_kernel.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_core_x8s8s32x_1x1_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_core_x8s8s32x_conv_kernel.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_core_x8s8s32x_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_avx512_core_x8s8s32x_deconvolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_sse42_1x1_conv_kernel_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_sse42_1x1_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_sse42_conv_kernel_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_sse42_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_transpose_src_utils.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_batch_normalization.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_batch_normalization_s8.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_dw_conv_kernel_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_dw_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_eltwise.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_i8i8_pooling.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_lrn.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_lrn_kernel_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_pool_kernel_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_pooling.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_reorder.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/jit_uni_reorder_utils.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/nchw_pooling.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ncsp_batch_normalization.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/nhwc_pooling.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/nspc_batch_normalization.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ref_batch_normalization.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ref_convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ref_deconvolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ref_eltwise.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ref_inner_product.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ref_lrn.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ref_pooling.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ref_shuffle.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/ref_softmax.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/simple_concat.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/simple_sum.cpp + +################################################################################ +# Library sources - cpu/gemm +################################################################################ +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/gemm.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/gemm_driver.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/gemm_info.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/gemm_utils_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx2_f32_copy_an_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx2_f32_copy_at_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx2_f32_copy_bn_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx2_f32_copy_bt_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx2_kernel_sgemm_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx512_common_gemm_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx512_core_f32_copy_an_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx512_core_f32_copy_at_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx512_core_f32_copy_bn_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx512_core_f32_copy_bt_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/jit_avx_gemm_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/f32/ref_gemm_f32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_gemm_s8u8s32_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_gemv_s8u8s32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_kernel_gemv_s8u8s32_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_an_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_at_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_bn_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_bt_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_sum_an_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_sum_at_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_sum_bn_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_sum_bt_kern.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/ref_gemm_s8x8s32.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/gemm/s8x8s32/simple_gemm_s8s8s32.cpp + +################################################################################ +# Library sources - cpu/rnn +################################################################################ +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/rnn/cell_common.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/rnn/cell_gru.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/rnn/cell_gru_lbr.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/rnn/ref_postgemm_gru.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/rnn/ref_postgemm_gru_lbr.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/rnn/ref_postgemm_lstm.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/rnn/ref_postgemm_rnn.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/rnn/ref_rnn.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/cpu/rnn/rnn_utils.cpp + +################################################################################ +# Library sources - common +################################################################################ +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/batch_normalization.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/convolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/convolution_pd.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/deconvolution.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/eltwise.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/engine.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/inner_product.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/lrn.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/memory.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/memory_desc_wrapper.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/mkldnn_debug.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/pooling.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/primitive.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/primitive_attr.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/primitive_desc.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/primitive_iterator.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/query.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/reorder.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/rnn.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/scratchpad.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/shuffle.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/softmax.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/stream.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/utils.cpp +LIBMKLDNN_SRCS-y += $(LIBMKLDNN_SRC)/src/common/verbose.cpp diff --git a/README.md b/README.md new file mode 100644 index 0000000..8c0f3a0 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +libmkl-dnn for Unikraft +=================== + +Please refer to the `README.md` as well as the documentation in the `doc/` +subdirectory of the main unikraft repository. diff --git a/include/cpuid.h b/include/cpuid.h new file mode 100644 index 0000000..cb75258 --- /dev/null +++ b/include/cpuid.h @@ -0,0 +1,158 @@ +/* Taken from FreeBSD */ + +/*===---- cpuid.h - X86 cpu model detection --------------------------------=== + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + *===-----------------------------------------------------------------------=== + */ + +#if !(__x86_64__ || __i386__) +#error this header is for x86 only +#endif + +/* Features in %ecx for level 1 */ +#define bit_SSE3 0x00000001 +#define bit_PCLMULQDQ 0x00000002 +#define bit_DTES64 0x00000004 +#define bit_MONITOR 0x00000008 +#define bit_DSCPL 0x00000010 +#define bit_VMX 0x00000020 +#define bit_SMX 0x00000040 +#define bit_EIST 0x00000080 +#define bit_TM2 0x00000100 +#define bit_SSSE3 0x00000200 +#define bit_CNXTID 0x00000400 +#define bit_FMA 0x00001000 +#define bit_CMPXCHG16B 0x00002000 +#define bit_xTPR 0x00004000 +#define bit_PDCM 0x00008000 +#define bit_PCID 0x00020000 +#define bit_DCA 0x00040000 +#define bit_SSE41 0x00080000 +#define bit_SSE42 0x00100000 +#define bit_x2APIC 0x00200000 +#define bit_MOVBE 0x00400000 +#define bit_POPCNT 0x00800000 +#define bit_TSCDeadline 0x01000000 +#define bit_AESNI 0x02000000 +#define bit_XSAVE 0x04000000 +#define bit_OSXSAVE 0x08000000 +#define bit_AVX 0x10000000 +#define bit_RDRAND 0x40000000 + +/* Features in %edx for level 1 */ +#define bit_FPU 0x00000001 +#define bit_VME 0x00000002 +#define bit_DE 0x00000004 +#define bit_PSE 0x00000008 +#define bit_TSC 0x00000010 +#define bit_MSR 0x00000020 +#define bit_PAE 0x00000040 +#define bit_MCE 0x00000080 +#define bit_CX8 0x00000100 +#define bit_APIC 0x00000200 +#define bit_SEP 0x00000800 +#define bit_MTRR 0x00001000 +#define bit_PGE 0x00002000 +#define bit_MCA 0x00004000 +#define bit_CMOV 0x00008000 +#define bit_PAT 0x00010000 +#define bit_PSE36 0x00020000 +#define bit_PSN 0x00040000 +#define bit_CLFSH 0x00080000 +#define bit_DS 0x00200000 +#define bit_ACPI 0x00400000 +#define bit_MMX 0x00800000 +#define bit_FXSR 0x01000000 +#define bit_SSE 0x02000000 +#define bit_SSE2 0x04000000 +#define bit_SS 0x08000000 +#define bit_HTT 0x10000000 +#define bit_TM 0x20000000 +#define bit_PBE 0x80000000 + +/* Features in %ebx for level 7 sub-leaf 0 */ +#define bit_FSGSBASE 0x00000001 +#define bit_SMEP 0x00000080 +#define bit_ENH_MOVSB 0x00000200 + +/* PIC on i386 uses %ebx, so preserve it. */ +#if __i386__ +#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \ + __asm(" pushl %%ebx\n" \ + " cpuid\n" \ + " mov %%ebx,%1\n" \ + " popl %%ebx" \ + : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \ + : "0"(__level)) + +#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \ + __asm(" pushl %%ebx\n" \ + " cpuid\n" \ + " mov %%ebx,%1\n" \ + " popl %%ebx" \ + : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \ + : "0"(__level), "2"(__count)) +#else +#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \ + __asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \ + : "0"(__level)) + +#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \ + __asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \ + : "0"(__level), "2"(__count)) +#endif + +static __inline int __get_cpuid (unsigned int __level, unsigned int *__eax, + unsigned int *__ebx, unsigned int *__ecx, + unsigned int *__edx) { + __cpuid(__level, *__eax, *__ebx, *__ecx, *__edx); + return 1; +} + +static __inline int __get_cpuid_max (unsigned int __level, unsigned int *__sig) +{ + unsigned int __eax, __ebx, __ecx, __edx; +#if __i386__ + int __cpuid_supported; + + __asm(" pushfl\n" + " popl %%eax\n" + " movl %%eax,%%ecx\n" + " xorl $0x00200000,%%eax\n" + " pushl %%eax\n" + " popfl\n" + " pushfl\n" + " popl %%eax\n" + " movl $0,%0\n" + " cmpl %%eax,%%ecx\n" + " je 1f\n" + " movl $1,%0\n" + "1:" + : "=r" (__cpuid_supported) : : "eax", "ecx"); + if (!__cpuid_supported) + return 0; +#endif + + __cpuid(__level, __eax, __ebx, __ecx, __edx); + if (__sig) + *__sig = __ebx; + return __eax; +} diff --git a/include/mkldnn_version.h b/include/mkldnn_version.h new file mode 100644 index 0000000..bcfbcc0 --- /dev/null +++ b/include/mkldnn_version.h @@ -0,0 +1,32 @@ +/******************************************************************************* +* Copyright 2019 Intel Corporation +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*******************************************************************************/ + +#ifndef MKLDNN_VERSION_H +#define MKLDNN_VERSION_H + +/* Major version of MKL-DNN */ +#define MKLDNN_VERSION_MAJOR 0 + +/* Minor version of MKL-DNN */ +#define MKLDNN_VERSION_MINOR 19 + +/* Patch version of MKL-DNN */ +#define MKLDNN_VERSION_PATCH 0 + +/* Git Commit Hash of MKL-DNN */ +#define MKLDNN_VERSION_HASH "dd963e5a0f2ff4099b9442e50c38c9cc9bfac29b" + +#endif -- 2.11.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |