You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2022/03/10 15:48:40 UTC

[GitHub] [incubator-mxnet] bgawrych opened a new pull request #20952: Restore quantized RNN to master

bgawrych opened a new pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952


   ## Description ##
   Restoring qunatized RNN: https://github.com/apache/incubator-mxnet/pull/20759
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1070622413


   Jenkins CI successfully triggered : [website, unix-cpu, windows-gpu, centos-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1080313937


   Jenkins CI successfully triggered : [unix-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bgawrych commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bgawrych commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1085896760


   @mxnet-bot run ci [windows-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bgawrych commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bgawrych commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1075154467


   @mxnet-bot run ci [unix-cpu, windows-gpu, clang]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1083049009


   Jenkins CI successfully triggered : [unix-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bartekkuncer commented on a change in pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bartekkuncer commented on a change in pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#discussion_r836261653



##########
File path: src/operator/quantization/dnnl/dnnl_quantized_rnn.cc
##########
@@ -0,0 +1,365 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+/*!
+ * \file dnnl_quantized_rnn.cc
+ * \brief Common functions for quantized recurrent neural network
+ * \author Zixuan Wei
+ */
+
+#if MXNET_USE_ONEDNN == 1
+
+#include "operator/quantization/quantization_utils.h"
+#include "operator/quantization/dnnl/dnnl_quantized_rnn-inl.h"
+
+namespace mxnet {
+namespace op {
+
+std::vector<float> GetDNNLRnnWeightsQParams(const DNNLRnnFullParam& full_param, float* w_ptr) {
+  const int nthreads            = mxnet::engine::OpenMP::Get()->GetRecommendedOMPThreadCount();
+  const RNNParam& default_param = full_param.default_param;
+  const LayerParamVector& layer_params = full_param.layer_params;
+
+  const DNNLRnnLayerParam& layer_param0 = layer_params.at(0);
+  const size_t w_size0                  = layer_param0.single_w_size;
+  const size_t wx_size0                 = 4 * layer_param0.state_size * layer_param0.input_size;

Review comment:
       Magic number.

##########
File path: src/operator/nn/dnnl/dnnl_rnn.cc
##########
@@ -449,11 +482,19 @@ void DNNLRnnForward::SetNewDataMem(void* x,
   auto& cpu_engine      = CpuEngine::Get()->get_engine();
   dnnl_args_map_t& args = net_args_;
 
+  int src_dtype = dtype;
+  int dst_dtype = dtype;
+  if (param_.quantized) {
+    src_dtype = mshadow::kUint8;

Review comment:
       RNN does not support int8?

##########
File path: src/operator/quantization/quantized_rnn-inl.h
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+/*!
+ * \file quantized_rnn-inl.h

Review comment:
       Is this file necessary?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bgawrych commented on a change in pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bgawrych commented on a change in pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#discussion_r836391588



##########
File path: src/operator/quantization/quantized_rnn-inl.h
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+/*!
+ * \file quantized_rnn-inl.h

Review comment:
       it is used by two other .cc files, so yes

##########
File path: src/operator/quantization/dnnl/dnnl_quantized_rnn.cc
##########
@@ -0,0 +1,365 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+/*!
+ * \file dnnl_quantized_rnn.cc
+ * \brief Common functions for quantized recurrent neural network
+ * \author Zixuan Wei
+ */
+
+#if MXNET_USE_ONEDNN == 1
+
+#include "operator/quantization/quantization_utils.h"
+#include "operator/quantization/dnnl/dnnl_quantized_rnn-inl.h"
+
+namespace mxnet {
+namespace op {
+
+std::vector<float> GetDNNLRnnWeightsQParams(const DNNLRnnFullParam& full_param, float* w_ptr) {
+  const int nthreads            = mxnet::engine::OpenMP::Get()->GetRecommendedOMPThreadCount();
+  const RNNParam& default_param = full_param.default_param;
+  const LayerParamVector& layer_params = full_param.layer_params;
+
+  const DNNLRnnLayerParam& layer_param0 = layer_params.at(0);
+  const size_t w_size0                  = layer_param0.single_w_size;
+  const size_t wx_size0                 = 4 * layer_param0.state_size * layer_param0.input_size;

Review comment:
       done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bgawrych commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bgawrych commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1078940326


   @mxnet-bot run ci [unix-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1085896848


   Jenkins CI successfully triggered : [windows-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bgawrych commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bgawrych commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1083048910


   @mxnet-bot run ci [unix-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1075154536


   Jenkins CI successfully triggered : [clang, unix-cpu, windows-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bgawrych commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bgawrych commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1080313880


   @mxnet-bot run ci [unix-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bgawrych commented on a change in pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bgawrych commented on a change in pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#discussion_r836368834



##########
File path: src/operator/nn/dnnl/dnnl_rnn.cc
##########
@@ -449,11 +482,19 @@ void DNNLRnnForward::SetNewDataMem(void* x,
   auto& cpu_engine      = CpuEngine::Get()->get_engine();
   dnnl_args_map_t& args = net_args_;
 
+  int src_dtype = dtype;
+  int dst_dtype = dtype;
+  if (param_.quantized) {
+    src_dtype = mshadow::kUint8;

Review comment:
       Now it does - seems like int8 is supported since 2.3 (https://oneapi-src.github.io/oneDNN/v2.2/dev_guide_rnn.html / https://oneapi-src.github.io/oneDNN/v2.3/dev_guide_rnn.html)
   
   New task can be opened for int8 implementation and checking if it is worth




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1080411621


   Jenkins CI successfully triggered : [windows-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bgawrych commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bgawrych commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1070621893


   @mxnet-bot run ci [centos-cpu, unix-cpu, website, windows-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] bgawrych commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
bgawrych commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1080411446


   @mxnet-bot run ci [windows-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20952: Restore quantized RNN to master

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20952:
URL: https://github.com/apache/incubator-mxnet/pull/20952#issuecomment-1078940470


   Jenkins CI successfully triggered : [unix-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org