From 2b0e6e6e737d3dcff22177199c20d120dae3c640 Mon Sep 17 00:00:00 2001 From: Ciyong Chen Date: Wed, 17 Apr 2019 13:11:04 +0800 Subject: [PATCH 1/2] change size_t to int for supporting OpenMp 2.0 windows build --- .../quantization/mkldnn/mkldnn_quantized_fully_connected.cc | 2 +- src/operator/subgraph/mkldnn/mkldnn_fc.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc b/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc index 71daf2ec2c16..8e227cb36d9b 100644 --- a/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc +++ b/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc @@ -74,7 +74,7 @@ void MKLDNNQuantizedFullyConnectedForward(const nnvm::NodeAttrs &attrs, int32_t *quantized_bias_ptr = quantized_bias.data().dptr(); size_t bias_size = bias.shape().Size(); #pragma omp parallel for num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount()) - for (size_t i = 0; i < bias_size; ++i) { + for (int i = 0; i < static_cast(bias_size); ++i) { quantized_bias_ptr[i] = bias_ptr[i] * bias_int32_rescale; } } diff --git a/src/operator/subgraph/mkldnn/mkldnn_fc.cc b/src/operator/subgraph/mkldnn/mkldnn_fc.cc index 0ec05a2af087..b3886f2b4c3d 100644 --- a/src/operator/subgraph/mkldnn/mkldnn_fc.cc +++ b/src/operator/subgraph/mkldnn/mkldnn_fc.cc @@ -156,7 +156,7 @@ void SgMKLDNNFCOp::Forward(const OpContext &ctx, int32_t *quantized_bias_ptr = cached_bias_.data().dptr(); size_t bias_size = bias.shape().Size(); #pragma omp parallel for num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount()) - for (size_t i = 0; i < bias_size; ++i) { + for (int i = 0; i < static_cast(bias_size); ++i) { quantized_bias_ptr[i] = bias_ptr[i] * bias_int32_rescale; } } From 28043e5f9e4b7591277e285317650a0e349fc732 Mon Sep 17 00:00:00 2001 From: Ciyong Chen Date: Fri, 19 Apr 2019 13:52:55 +0800 Subject: [PATCH 2/2] change int to index_t --- .../quantization/mkldnn/mkldnn_quantized_fully_connected.cc | 2 +- src/operator/subgraph/mkldnn/mkldnn_fc.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc b/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc index 8e227cb36d9b..cf3d789e2882 100644 --- a/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc +++ b/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc @@ -74,7 +74,7 @@ void MKLDNNQuantizedFullyConnectedForward(const nnvm::NodeAttrs &attrs, int32_t *quantized_bias_ptr = quantized_bias.data().dptr(); size_t bias_size = bias.shape().Size(); #pragma omp parallel for num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount()) - for (int i = 0; i < static_cast(bias_size); ++i) { + for (index_t i = 0; i < static_cast(bias_size); ++i) { quantized_bias_ptr[i] = bias_ptr[i] * bias_int32_rescale; } } diff --git a/src/operator/subgraph/mkldnn/mkldnn_fc.cc b/src/operator/subgraph/mkldnn/mkldnn_fc.cc index b3886f2b4c3d..857a27d9a134 100644 --- a/src/operator/subgraph/mkldnn/mkldnn_fc.cc +++ b/src/operator/subgraph/mkldnn/mkldnn_fc.cc @@ -156,7 +156,7 @@ void SgMKLDNNFCOp::Forward(const OpContext &ctx, int32_t *quantized_bias_ptr = cached_bias_.data().dptr(); size_t bias_size = bias.shape().Size(); #pragma omp parallel for num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount()) - for (int i = 0; i < static_cast(bias_size); ++i) { + for (index_t i = 0; i < static_cast(bias_size); ++i) { quantized_bias_ptr[i] = bias_ptr[i] * bias_int32_rescale; } }