ZhennanQin commented on a change in pull request #14641: [MKLDNN]Improve 
quantizeV2 and dequantize latency
URL: https://github.com/apache/incubator-mxnet/pull/14641#discussion_r276045369
 
 

 ##########
 File path: src/operator/quantization/quantize_v2.cc
 ##########
 @@ -47,6 +47,22 @@ static bool QuantizeV2StorageType(const nnvm::NodeAttrs& 
attrs, const int dev_ma
   return true;
 }
 
+static OpStatePtr CreateQuantizeV2State(const nnvm::NodeAttrs& attrs, Context 
ctx,
+                                        const std::vector<TShape>& in_shapes,
+                                        const std::vector<int>& in_types) {
+  OpStatePtr state;
+  if (ctx.dev_type == kGPU) {
+    state = OpStatePtr::Create<QuantizeV2Operator<gpu>>(attrs);
 
 Review comment:
   You're right. Making gpu op stateful doesn't bring any help to gpu 
performance. This is because of the limitation of FW, that is, if an op 
registered `FCreateOpState`, then it will be treated as stateful op for all 
backends. `FComputeEx` and `FCompute` will be ignored. Only `FStatefulCompute` 
and `FStatefulComputeEx` are used. To implement `FStatefulCompute<gpu>`, we 
have to create a state for it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to