Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit ac7792d

Browse files
TaoLvpengzhao-intel
authored andcommitted
[mkldnn-v1.0] Enable more checks for MXNET_USE_MKLDNN (#16520)
* open USE_MKLDNN check * trigger ci * ci
1 parent f7f4959 commit ac7792d

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/c_api/c_api.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ int MXNDArrayGetData(NDArrayHandle handle,
627627
void **out_pdata) {
628628
API_BEGIN();
629629
NDArray *arr = static_cast<NDArray*>(handle);
630-
#if MXNET_USE_MKLDNN == 1
630+
#if MXNET_USE_MKLDNN == 100
631631
if (arr->IsMKLDNNData()) {
632632
arr->Reorder2DefaultAsync();
633633
arr->WaitToRead();

src/common/utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#include <limits>
4848

4949
#include "../operator/mxnet_op.h"
50-
#if MXNET_USE_MKLDNN == 1
50+
#if MXNET_USE_MKLDNN == 100
5151
#include "../operator/nn/mkldnn/mkldnn_base-inl.h"
5252
#endif
5353

@@ -484,7 +484,7 @@ inline void LogStorageFallback(const nnvm::NodeAttrs& attrs,
484484
"0 to suppress this warning.";
485485
os << "\nStorage type fallback detected:\n" << op_str << warning;
486486
LogOnce(os.str());
487-
#if MXNET_USE_MKLDNN == 1
487+
#if MXNET_USE_MKLDNN == 100
488488
if (!MKLDNNEnvSet()) common::LogOnce("MXNET_MKLDNN_ENABLED flag is off. "
489489
"You can re-enable by setting MXNET_MKLDNN_ENABLED=1");
490490
if (GetMKLDNNCacheSize() != -1) common::LogOnce("MXNET_MKLDNN_CACHE_NUM is set."

src/ndarray/ndarray.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ void NDArray::Save(dmlc::Stream *strm) const {
16171617
} else {
16181618
this->WaitToRead();
16191619
nd_cpu = *this;
1620-
#if MXNET_USE_MKLDNN == 1
1620+
#if MXNET_USE_MKLDNN == 100
16211621
if (nd_cpu.IsMKLDNNData()) {
16221622
nd_cpu = nd_cpu.Reorder2Default();
16231623
}

src/operator/tensor/matrix_op-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ inline bool SliceForwardInferStorageType(const nnvm::NodeAttrs& attrs,
541541
}
542542

543543
if (in_stype == kDefaultStorage) {
544-
#if MXNET_USE_MKLDNN == 1
544+
#if MXNET_USE_MKLDNN == 100
545545
if (dev_mask == Context::kCPU && MKLDNNEnvSet()
546546
&& SupportMKLDNNSlice(param)) {
547547
dispatched = storage_type_assign(&out_stype, kDefaultStorage,

src/operator/tensor/matrix_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ void SliceExCPU(const nnvm::NodeAttrs& attrs,
425425
auto in_stype = inputs[0].storage_type();
426426
if (in_stype == kCSRStorage) {
427427
SliceCsrImpl<cpu>(param, ctx, inputs[0], req[0], outputs[0]);
428-
#if MXNET_USE_MKLDNN == 1
428+
#if MXNET_USE_MKLDNN == 100
429429
} else if (in_stype == kDefaultStorage) {
430430
if (SupportMKLDNN(inputs[0])) {
431431
MKLDNNSlice(param, ctx, inputs[0], req[0], outputs[0]);
@@ -488,7 +488,7 @@ Example::
488488
.set_attr<nnvm::FGradient>("FGradient", ElemwiseGradUseNone{"_backward_slice"})
489489
.set_attr<FCompute>("FCompute<cpu>", SliceOpForward<cpu>)
490490
.set_attr<FComputeEx>("FComputeEx<cpu>", SliceExCPU)
491-
#if MXNET_USE_MKLDNN == 1
491+
#if MXNET_USE_MKLDNN == 100
492492
.set_attr<bool>("TIsMKLDNN", true)
493493
#endif
494494
.add_argument("data", "NDArray-or-Symbol", "Source input")

src/storage/cpu_device_storage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class CPUDeviceStorage {
5353
/*!
5454
* \brief Alignment of allocation.
5555
*/
56-
#if MXNET_USE_MKLDNN == 1
56+
#if MXNET_USE_MKLDNN == 100
5757
// MKLDNN requires special alignment. 64 is used by the MKLDNN library in
5858
// memory allocation.
5959
static constexpr size_t alignment_ = kMKLDNNAlign;

0 commit comments

Comments
 (0)