mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
fix torch.config can't respect USE_MKLDNN flag issue (#75001)
Fixes https://github.com/pytorch/pytorch/issues/74949, which reports that torch.config can't respect USE_MKLDNN flag. Pull Request resolved: https://github.com/pytorch/pytorch/pull/75001 Approved by: https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
4655c3bace
commit
86b86202b5
@ -2054,7 +2054,7 @@ if(BUILD_PYTHON)
|
|||||||
|
|
||||||
target_link_libraries(caffe2_pybind11_state PRIVATE
|
target_link_libraries(caffe2_pybind11_state PRIVATE
|
||||||
torch_library python::python pybind::pybind11)
|
torch_library python::python pybind::pybind11)
|
||||||
if(CAFFE2_USE_MKLDNN)
|
if(USE_MKLDNN)
|
||||||
target_link_libraries(caffe2_pybind11_state PRIVATE caffe2::mkldnn)
|
target_link_libraries(caffe2_pybind11_state PRIVATE caffe2::mkldnn)
|
||||||
endif()
|
endif()
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
if(CAFFE2_USE_MKLDNN)
|
if(USE_MKLDNN)
|
||||||
message(STATUS "Including IDEEP operators")
|
message(STATUS "Including IDEEP operators")
|
||||||
|
|
||||||
# ---[ CPU files.
|
# ---[ CPU files.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "caffe2/core/context_gpu.h"
|
#include "caffe2/core/context_gpu.h"
|
||||||
#include "caffe2/core/operator.h"
|
#include "caffe2/core/operator.h"
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
||||||
#include <caffe2/ideep/utils/ideep_operator.h>
|
#include <caffe2/ideep/utils/ideep_operator.h>
|
||||||
#endif
|
#endif
|
||||||
@ -25,7 +25,7 @@ REGISTER_CPU_OPERATOR(CTC, CTCOp<float, CPUContext>);
|
|||||||
OPERATOR_SCHEMA(CTC).NumInputs(3, 4).NumOutputs(2, 3);
|
OPERATOR_SCHEMA(CTC).NumInputs(3, 4).NumOutputs(2, 3);
|
||||||
// .EnforceInputOutputGradient({{0, 0}});
|
// .EnforceInputOutputGradient({{0, 0}});
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(CTC, IDEEPFallbackOp<CTCOp<float, CPUContext>>);
|
REGISTER_IDEEP_OPERATOR(CTC, IDEEPFallbackOp<CTCOp<float, CPUContext>>);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ static_assert(
|
|||||||
#cmakedefine CAFFE2_USE_GOOGLE_GLOG
|
#cmakedefine CAFFE2_USE_GOOGLE_GLOG
|
||||||
#cmakedefine CAFFE2_USE_LITE_PROTO
|
#cmakedefine CAFFE2_USE_LITE_PROTO
|
||||||
#cmakedefine CAFFE2_USE_MKL
|
#cmakedefine CAFFE2_USE_MKL
|
||||||
#cmakedefine CAFFE2_USE_MKLDNN
|
#cmakedefine USE_MKLDNN
|
||||||
#cmakedefine CAFFE2_USE_NVTX
|
#cmakedefine CAFFE2_USE_NVTX
|
||||||
#cmakedefine CAFFE2_USE_ITT
|
#cmakedefine CAFFE2_USE_ITT
|
||||||
#cmakedefine CAFFE2_USE_TRT
|
#cmakedefine CAFFE2_USE_TRT
|
||||||
@ -81,7 +81,7 @@ static_assert(
|
|||||||
{"USE_EIGEN_FOR_BLAS", "${CAFFE2_USE_EIGEN_FOR_BLAS}"}, \
|
{"USE_EIGEN_FOR_BLAS", "${CAFFE2_USE_EIGEN_FOR_BLAS}"}, \
|
||||||
{"USE_LITE_PROTO", "${CAFFE2_USE_LITE_PROTO}"}, \
|
{"USE_LITE_PROTO", "${CAFFE2_USE_LITE_PROTO}"}, \
|
||||||
{"USE_MKL", "${CAFFE2_USE_MKL}"}, \
|
{"USE_MKL", "${CAFFE2_USE_MKL}"}, \
|
||||||
{"USE_MKLDNN", "${CAFFE2_USE_MKLDNN}"}, \
|
{"USE_MKLDNN", "${USE_MKLDNN}"}, \
|
||||||
{"USE_NVTX", "${CAFFE2_USE_NVTX}"}, \
|
{"USE_NVTX", "${CAFFE2_USE_NVTX}"}, \
|
||||||
{"USE_ITT", "${CAFFE2_USE_ITT}"}, \
|
{"USE_ITT", "${CAFFE2_USE_ITT}"}, \
|
||||||
{"USE_TRT", "${CAFFE2_USE_TRT}"}, \
|
{"USE_TRT", "${CAFFE2_USE_TRT}"}, \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
if(CAFFE2_USE_MKLDNN)
|
if(USE_MKLDNN)
|
||||||
message(STATUS "Including IDEEP operators")
|
message(STATUS "Including IDEEP operators")
|
||||||
|
|
||||||
# ---[ CPU files.
|
# ---[ CPU files.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "caffe2/image/image_input_op.h"
|
#include "caffe2/image/image_input_op.h"
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
||||||
#include <caffe2/ideep/utils/ideep_operator.h>
|
#include <caffe2/ideep/utils/ideep_operator.h>
|
||||||
#endif
|
#endif
|
||||||
@ -160,7 +160,7 @@ The dimension of the output image will always be cropxcrop
|
|||||||
|
|
||||||
NO_GRADIENT(ImageInput);
|
NO_GRADIENT(ImageInput);
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(ImageInput, IDEEPFallbackOp<ImageInputOp<CPUContext>>);
|
REGISTER_IDEEP_OPERATOR(ImageInput, IDEEPFallbackOp<ImageInputOp<CPUContext>>);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "caffe2/core/context.h"
|
#include "caffe2/core/context.h"
|
||||||
#include "caffe2/core/operator.h"
|
#include "caffe2/core/operator.h"
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
||||||
#include <caffe2/ideep/utils/ideep_operator.h>
|
#include <caffe2/ideep/utils/ideep_operator.h>
|
||||||
#endif
|
#endif
|
||||||
@ -97,7 +97,7 @@ REGISTER_CPU_OPERATOR(CreateMutex, CreateMutexOp);
|
|||||||
REGISTER_CPU_OPERATOR(AtomicFetchAdd, AtomicFetchAddOp<int32_t>);
|
REGISTER_CPU_OPERATOR(AtomicFetchAdd, AtomicFetchAddOp<int32_t>);
|
||||||
REGISTER_CPU_OPERATOR(AtomicFetchAdd64, AtomicFetchAddOp<int64_t>);
|
REGISTER_CPU_OPERATOR(AtomicFetchAdd64, AtomicFetchAddOp<int64_t>);
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(
|
REGISTER_IDEEP_OPERATOR(
|
||||||
CreateMutex,
|
CreateMutex,
|
||||||
IDEEPFallbackOp<CreateMutexOp, SkipIndices<0>>);
|
IDEEPFallbackOp<CreateMutexOp, SkipIndices<0>>);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
||||||
#include <caffe2/ideep/utils/ideep_operator.h>
|
#include <caffe2/ideep/utils/ideep_operator.h>
|
||||||
#endif
|
#endif
|
||||||
@ -89,7 +89,7 @@ bool BatchPermutationGradientOp<float, CPUContext>::RunOnDevice() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(
|
REGISTER_IDEEP_OPERATOR(
|
||||||
BatchPermutation,
|
BatchPermutation,
|
||||||
IDEEPFallbackOp<BatchPermutationOp<float, CPUContext>>);
|
IDEEPFallbackOp<BatchPermutationOp<float, CPUContext>>);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "caffe2/operators/distance_op.h"
|
#include "caffe2/operators/distance_op.h"
|
||||||
#include "caffe2/core/types.h"
|
#include "caffe2/core/types.h"
|
||||||
#include "caffe2/utils/eigen_utils.h"
|
#include "caffe2/utils/eigen_utils.h"
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
||||||
#include <caffe2/ideep/utils/ideep_operator.h>
|
#include <caffe2/ideep/utils/ideep_operator.h>
|
||||||
#endif
|
#endif
|
||||||
@ -420,7 +420,7 @@ REGISTER_CPU_OPERATOR(L1Distance, L1DistanceOp<float, CPUContext>);
|
|||||||
REGISTER_CPU_OPERATOR(
|
REGISTER_CPU_OPERATOR(
|
||||||
L1DistanceGradient,
|
L1DistanceGradient,
|
||||||
L1DistanceGradientOp<float, CPUContext>);
|
L1DistanceGradientOp<float, CPUContext>);
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(
|
REGISTER_IDEEP_OPERATOR(
|
||||||
L1DistanceGradient,
|
L1DistanceGradient,
|
||||||
IDEEPFallbackOp<L1DistanceGradientOp<float, CPUContext>>);
|
IDEEPFallbackOp<L1DistanceGradientOp<float, CPUContext>>);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "caffe2/utils/math.h"
|
#include "caffe2/utils/math.h"
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include "caffe2/ideep/operators/operator_fallback_ideep.h"
|
#include "caffe2/ideep/operators/operator_fallback_ideep.h"
|
||||||
#include "caffe2/ideep/utils/ideep_operator.h"
|
#include "caffe2/ideep/utils/ideep_operator.h"
|
||||||
#endif
|
#endif
|
||||||
@ -165,7 +165,7 @@ REGISTER_CPU_GRADIENT_OPERATOR(
|
|||||||
ResizeNearest3DGradient,
|
ResizeNearest3DGradient,
|
||||||
ResizeNearest3DGradientOp<float, CPUContext>);
|
ResizeNearest3DGradientOp<float, CPUContext>);
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(
|
REGISTER_IDEEP_OPERATOR(
|
||||||
ResizeNearest3D,
|
ResizeNearest3D,
|
||||||
IDEEPFallbackOp<ResizeNearest3DOp<float, CPUContext>>);
|
IDEEPFallbackOp<ResizeNearest3DOp<float, CPUContext>>);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "caffe2/utils/cpu_neon.h"
|
#include "caffe2/utils/cpu_neon.h"
|
||||||
#include "caffe2/utils/math.h"
|
#include "caffe2/utils/math.h"
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include "caffe2/ideep/operators/operator_fallback_ideep.h"
|
#include "caffe2/ideep/operators/operator_fallback_ideep.h"
|
||||||
#include "caffe2/ideep/utils/ideep_operator.h"
|
#include "caffe2/ideep/utils/ideep_operator.h"
|
||||||
#endif
|
#endif
|
||||||
@ -297,7 +297,7 @@ REGISTER_CPU_GRADIENT_OPERATOR(
|
|||||||
ResizeNearestGradient,
|
ResizeNearestGradient,
|
||||||
ResizeNearestGradientOp<float, CPUContext>);
|
ResizeNearestGradientOp<float, CPUContext>);
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(
|
REGISTER_IDEEP_OPERATOR(
|
||||||
ResizeNearest,
|
ResizeNearest,
|
||||||
IDEEPFallbackOp<ResizeNearestOp<float, CPUContext>>);
|
IDEEPFallbackOp<ResizeNearestOp<float, CPUContext>>);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "caffe2/utils/cpu_neon.h"
|
#include "caffe2/utils/cpu_neon.h"
|
||||||
#include "caffe2/utils/math.h"
|
#include "caffe2/utils/math.h"
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
||||||
#include <caffe2/ideep/utils/ideep_operator.h>
|
#include <caffe2/ideep/utils/ideep_operator.h>
|
||||||
#endif
|
#endif
|
||||||
@ -584,7 +584,7 @@ OPERATOR_SCHEMA(BRGNCHWCToPackedInt8BGRAStylizerDeprocess)
|
|||||||
.NumInputs(2)
|
.NumInputs(2)
|
||||||
.NumOutputs(1);
|
.NumOutputs(1);
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(
|
REGISTER_IDEEP_OPERATOR(
|
||||||
BRGNCHWCToPackedInt8BGRAStylizerDeprocess,
|
BRGNCHWCToPackedInt8BGRAStylizerDeprocess,
|
||||||
IDEEPFallbackOp<BRGNCHWCToPackedInt8BGRAStylizerDeprocessOp, SkipIndices<0>>);
|
IDEEPFallbackOp<BRGNCHWCToPackedInt8BGRAStylizerDeprocessOp, SkipIndices<0>>);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "caffe2/opt/optimize_ideep.h"
|
#include "caffe2/opt/optimize_ideep.h"
|
||||||
#include "caffe2/opt/converter.h"
|
#include "caffe2/opt/converter.h"
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include <cpuinfo.h>
|
#include <cpuinfo.h>
|
||||||
#include "caffe2/ideep/ideep_utils.h"
|
#include "caffe2/ideep/ideep_utils.h"
|
||||||
#endif
|
#endif
|
||||||
@ -11,7 +11,7 @@ namespace opt {
|
|||||||
|
|
||||||
using namespace nom;
|
using namespace nom;
|
||||||
|
|
||||||
#ifndef CAFFE2_USE_MKLDNN
|
#ifndef USE_MKLDNN
|
||||||
void OptimizeForMkldnn(
|
void OptimizeForMkldnn(
|
||||||
repr::NNModule* nn,
|
repr::NNModule* nn,
|
||||||
caffe2::Workspace* ws,
|
caffe2::Workspace* ws,
|
||||||
@ -1012,7 +1012,7 @@ void OptimizeForMkldnn(
|
|||||||
setPoolingInferenceMode(nn);
|
setPoolingInferenceMode(nn);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CAFFE2_USE_MKLDNN
|
#endif // USE_MKLDNN
|
||||||
|
|
||||||
} // namespace opt
|
} // namespace opt
|
||||||
} // namespace caffe2
|
} // namespace caffe2
|
||||||
|
@ -7,7 +7,7 @@ set(Caffe2_CPU_PYTHON_SRCS
|
|||||||
"/pybind_state_int8.cc"
|
"/pybind_state_int8.cc"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(CAFFE2_USE_MKLDNN)
|
if(USE_MKLDNN)
|
||||||
set(Caffe2_CPU_PYTHON_SRCS
|
set(Caffe2_CPU_PYTHON_SRCS
|
||||||
${Caffe2_CPU_PYTHON_SRCS}
|
${Caffe2_CPU_PYTHON_SRCS}
|
||||||
"/pybind_state_ideep.cc"
|
"/pybind_state_ideep.cc"
|
||||||
|
@ -1057,11 +1057,11 @@ void addGlobalMethods(py::module& m) {
|
|||||||
m.attr("has_mkldnn") = py::bool_(false);
|
m.attr("has_mkldnn") = py::bool_(false);
|
||||||
|
|
||||||
m.attr("use_mkldnn") = py::bool_(
|
m.attr("use_mkldnn") = py::bool_(
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
true
|
true
|
||||||
#else // CAFFE2_USE_MKLDNN
|
#else // USE_MKLDNN
|
||||||
false
|
false
|
||||||
#endif // CAFFE2_USE_MKLDNN
|
#endif // USE_MKLDNN
|
||||||
);
|
);
|
||||||
|
|
||||||
// if the binary is built with USE_ROCM, this is a ROCm build
|
// if the binary is built with USE_ROCM, this is a ROCm build
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "caffe2/core/operator.h"
|
#include "caffe2/core/operator.h"
|
||||||
#include "caffe2/queue/blobs_queue.h"
|
#include "caffe2/queue/blobs_queue.h"
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
||||||
#include <caffe2/ideep/utils/ideep_operator.h>
|
#include <caffe2/ideep/utils/ideep_operator.h>
|
||||||
#endif
|
#endif
|
||||||
@ -42,7 +42,7 @@ class CreateBlobsQueueDBOp : public Operator<CPUContext> {
|
|||||||
|
|
||||||
REGISTER_CPU_OPERATOR(CreateBlobsQueueDB, CreateBlobsQueueDBOp<CPUContext>);
|
REGISTER_CPU_OPERATOR(CreateBlobsQueueDB, CreateBlobsQueueDBOp<CPUContext>);
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(
|
REGISTER_IDEEP_OPERATOR(
|
||||||
CreateBlobsQueueDB,
|
CreateBlobsQueueDB,
|
||||||
IDEEPFallbackOp<CreateBlobsQueueDBOp<CPUContext>, SkipIndices<0>>);
|
IDEEPFallbackOp<CreateBlobsQueueDBOp<CPUContext>, SkipIndices<0>>);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "caffe2/sgd/iter_op.h"
|
#include "caffe2/sgd/iter_op.h"
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
#include <caffe2/ideep/operators/operator_fallback_ideep.h>
|
||||||
#include <caffe2/ideep/utils/ideep_operator.h>
|
#include <caffe2/ideep/utils/ideep_operator.h>
|
||||||
#endif
|
#endif
|
||||||
@ -28,7 +28,7 @@ void MutexDeserializer::Deserialize(const BlobProto& /* unused */, Blob* blob) {
|
|||||||
REGISTER_CPU_OPERATOR(Iter, IterOp<CPUContext>);
|
REGISTER_CPU_OPERATOR(Iter, IterOp<CPUContext>);
|
||||||
REGISTER_CPU_OPERATOR(AtomicIter, AtomicIterOp<CPUContext>);
|
REGISTER_CPU_OPERATOR(AtomicIter, AtomicIterOp<CPUContext>);
|
||||||
|
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(AtomicIter, IDEEPFallbackOp<AtomicIterOp<CPUContext>>);
|
REGISTER_IDEEP_OPERATOR(AtomicIter, IDEEPFallbackOp<AtomicIterOp<CPUContext>>);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1771,7 +1771,6 @@ if(NOT INTERN_BUILD_MOBILE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(AT_MKLDNN_ENABLED 0)
|
set(AT_MKLDNN_ENABLED 0)
|
||||||
set(CAFFE2_USE_MKLDNN OFF)
|
|
||||||
if(USE_MKLDNN)
|
if(USE_MKLDNN)
|
||||||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
message(WARNING
|
message(WARNING
|
||||||
@ -1787,11 +1786,11 @@ if(NOT INTERN_BUILD_MOBILE)
|
|||||||
set(AT_MKLDNN_ENABLED 1)
|
set(AT_MKLDNN_ENABLED 1)
|
||||||
include_directories(AFTER SYSTEM ${MKLDNN_INCLUDE_DIR})
|
include_directories(AFTER SYSTEM ${MKLDNN_INCLUDE_DIR})
|
||||||
if(BUILD_CAFFE2_OPS)
|
if(BUILD_CAFFE2_OPS)
|
||||||
set(CAFFE2_USE_MKLDNN ON)
|
|
||||||
list(APPEND Caffe2_DEPENDENCY_LIBS caffe2::mkldnn)
|
list(APPEND Caffe2_DEPENDENCY_LIBS caffe2::mkldnn)
|
||||||
endif(BUILD_CAFFE2_OPS)
|
endif(BUILD_CAFFE2_OPS)
|
||||||
else()
|
else()
|
||||||
message(WARNING "MKLDNN could not be found.")
|
message(WARNING "MKLDNN could not be found.")
|
||||||
|
caffe2_update_option(USE_MKLDNN OFF)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message("disabling MKLDNN because USE_MKLDNN is not set")
|
message("disabling MKLDNN because USE_MKLDNN is not set")
|
||||||
|
@ -142,7 +142,7 @@ function(caffe2_print_configuration_summary)
|
|||||||
message(STATUS " USE_FFTW : ${USE_FFTW}")
|
message(STATUS " USE_FFTW : ${USE_FFTW}")
|
||||||
message(STATUS " USE_MKL : ${CAFFE2_USE_MKL}")
|
message(STATUS " USE_MKL : ${CAFFE2_USE_MKL}")
|
||||||
message(STATUS " USE_MKLDNN : ${USE_MKLDNN}")
|
message(STATUS " USE_MKLDNN : ${USE_MKLDNN}")
|
||||||
if(${CAFFE2_USE_MKLDNN})
|
if(${USE_MKLDNN})
|
||||||
message(STATUS " USE_MKLDNN_ACL : ${USE_MKLDNN_ACL}")
|
message(STATUS " USE_MKLDNN_ACL : ${USE_MKLDNN_ACL}")
|
||||||
message(STATUS " USE_MKLDNN_CBLAS : ${USE_MKLDNN_CBLAS}")
|
message(STATUS " USE_MKLDNN_CBLAS : ${USE_MKLDNN_CBLAS}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -17,7 +17,7 @@ if(BUILD_CAFFE2_OPS)
|
|||||||
|
|
||||||
torch_set_target_props(caffe2_detectron_ops_gpu)
|
torch_set_target_props(caffe2_detectron_ops_gpu)
|
||||||
target_link_libraries(caffe2_detectron_ops_gpu PRIVATE torch ${OpenMP_link})
|
target_link_libraries(caffe2_detectron_ops_gpu PRIVATE torch ${OpenMP_link})
|
||||||
if(CAFFE2_USE_MKLDNN)
|
if(USE_MKLDNN)
|
||||||
target_link_libraries(caffe2_detectron_ops_gpu PRIVATE caffe2::mkldnn)
|
target_link_libraries(caffe2_detectron_ops_gpu PRIVATE caffe2::mkldnn)
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS caffe2_detectron_ops_gpu DESTINATION lib)
|
install(TARGETS caffe2_detectron_ops_gpu DESTINATION lib)
|
||||||
@ -33,7 +33,7 @@ if(BUILD_CAFFE2_OPS)
|
|||||||
${Detectron_HIP_SRCS})
|
${Detectron_HIP_SRCS})
|
||||||
torch_set_target_props(caffe2_detectron_ops_hip)
|
torch_set_target_props(caffe2_detectron_ops_hip)
|
||||||
target_compile_options(caffe2_detectron_ops_hip PRIVATE ${HIP_CXX_FLAGS})
|
target_compile_options(caffe2_detectron_ops_hip PRIVATE ${HIP_CXX_FLAGS})
|
||||||
if(CAFFE2_USE_MKLDNN)
|
if(USE_MKLDNN)
|
||||||
target_link_libraries(caffe2_detectron_ops_hip PRIVATE caffe2::mkldnn)
|
target_link_libraries(caffe2_detectron_ops_hip PRIVATE caffe2::mkldnn)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(caffe2_detectron_ops_hip PRIVATE torch)
|
target_link_libraries(caffe2_detectron_ops_hip PRIVATE torch)
|
||||||
@ -46,7 +46,7 @@ if(BUILD_CAFFE2_OPS)
|
|||||||
endif()
|
endif()
|
||||||
torch_set_target_props(caffe2_detectron_ops)
|
torch_set_target_props(caffe2_detectron_ops)
|
||||||
target_link_libraries(caffe2_detectron_ops PRIVATE torch ${OpenMP_link})
|
target_link_libraries(caffe2_detectron_ops PRIVATE torch ${OpenMP_link})
|
||||||
if(CAFFE2_USE_MKLDNN)
|
if(USE_MKLDNN)
|
||||||
target_link_libraries(caffe2_detectron_ops PRIVATE caffe2::mkldnn)
|
target_link_libraries(caffe2_detectron_ops PRIVATE caffe2::mkldnn)
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS caffe2_detectron_ops DESTINATION lib)
|
install(TARGETS caffe2_detectron_ops DESTINATION lib)
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "upsample_nearest_op.h"
|
#include "upsample_nearest_op.h"
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
#include "caffe2/ideep/operators/operator_fallback_ideep.h"
|
#include "caffe2/ideep/operators/operator_fallback_ideep.h"
|
||||||
#include "caffe2/ideep/utils/ideep_operator.h"
|
#include "caffe2/ideep/utils/ideep_operator.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace caffe2 {
|
namespace caffe2 {
|
||||||
#ifdef CAFFE2_USE_MKLDNN
|
#ifdef USE_MKLDNN
|
||||||
REGISTER_IDEEP_OPERATOR(
|
REGISTER_IDEEP_OPERATOR(
|
||||||
UpsampleNearest,
|
UpsampleNearest,
|
||||||
IDEEPFallbackOp<UpsampleNearestOp<float, CPUContext>>);
|
IDEEPFallbackOp<UpsampleNearestOp<float, CPUContext>>);
|
||||||
|
@ -119,7 +119,7 @@ if(USE_SYSTEM_ONNX)
|
|||||||
target_link_libraries(test_jit PRIVATE onnx_proto onnx)
|
target_link_libraries(test_jit PRIVATE onnx_proto onnx)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CAFFE2_USE_MKLDNN)
|
if(USE_MKLDNN)
|
||||||
target_link_libraries(test_jit PRIVATE caffe2::mkldnn)
|
target_link_libraries(test_jit PRIVATE caffe2::mkldnn)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user