print warnings when DNNLOWP_16 or DNNLOWP_ROWWISE_16 engine is used (#17176)
authorJongsoo Park <jongsoo@fb.com>
Mon, 4 Mar 2019 22:25:19 +0000 (14:25 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 4 Mar 2019 22:28:42 +0000 (14:28 -0800)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17176

As title

Reviewed By: csummersea

Differential Revision: D14111616

fbshipit-source-id: 1282cb2452c4ad385fd2dc6d3f8c19e9fec715ff

caffe2/quantization/server/conv_pool_dnnlowp_op_base.h
caffe2/quantization/server/dequantize_dnnlowp_op.cc
caffe2/quantization/server/dnnlowp_op.h

index ef2df60..d635955 100644 (file)
@@ -34,6 +34,14 @@ class ConvPoolDNNLowPOpBase : public ConvPoolOpBase<CPUContext> {
       omp_set_num_threads(FLAGS_caffe2_omp_num_threads);
     }
 #endif
+
+    if (this->debug_def().engine() == "DNNLOWP_16" ||
+        this->debug_def().engine() == "DNNLOWP_ROWWISE_16") {
+      LOG(WARNING)
+          << this->debug_def().engine()
+          << " is an experimental feature mostly for testing accuracy with "
+             "fixed-point precision higher than 8 and performance is very slow";
+    }
   }
 
   virtual ~ConvPoolDNNLowPOpBase() {
index 9994f03..ffe1155 100644 (file)
@@ -10,7 +10,15 @@ DequantizeDNNLowPOp<T>::DequantizeDNNLowPOp(
     const OperatorDef& operator_def,
     Workspace* ws)
     : Operator<CPUContext>(operator_def, ws),
-      qfactory_(dnnlowp::GetQuantizationFactoryOf(this)) {}
+      qfactory_(dnnlowp::GetQuantizationFactoryOf(this)) {
+  if (this->debug_def().engine() == "DNNLOWP_16" ||
+      this->debug_def().engine() == "DNNLOWP_ROWWISE_16") {
+    LOG(WARNING)
+        << this->debug_def().engine()
+        << " is an experimental feature mostly for testing accuracy with "
+           "fixed-point precision higher than 8 and performance is very slow";
+  }
+}
 
 template <typename T>
 bool DequantizeDNNLowPOp<T>::RunOnDevice() {
index d941456..8327b27 100644 (file)
@@ -88,6 +88,13 @@ class DNNLowPOp : public Operator<CPUContext> {
       omp_set_num_threads(FLAGS_caffe2_omp_num_threads);
     }
 #endif
+    if (this->debug_def().engine() == "DNNLOWP_16" ||
+        this->debug_def().engine() == "DNNLOWP_ROWWISE_16") {
+      LOG(WARNING)
+          << this->debug_def().engine()
+          << " is an experimental feature mostly for testing accuracy with "
+             "fixed-point precision higher than 8 and performance is very slow";
+    }
   }
 
   virtual ~DNNLowPOp() {