mbrookhart commented on a change in pull request #8637: URL: https://github.com/apache/tvm/pull/8637#discussion_r686129691
########## File path: src/relay/qnn/op/make_qnn_op.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 tvm/relay/op/make_op.h + * \brief Header of internal operator functions + * to assist in creating ops in C++ + */ +#ifndef TVM_RELAY_QNN_OP_MAKE_QNN_OP_H_ +#define TVM_RELAY_QNN_OP_MAKE_QNN_OP_H_ + +#include <tvm/relay/expr.h> +#include <tvm/relay/op.h> + +namespace tvm { +namespace relay { +namespace qnn { + +Expr MakeDequantize(Expr data, Expr input_scale, Expr input_zero_point, int axis); Review comment: Hmm, I've been putting most of these in https://github.com/apache/tvm/blob/main/src/relay/op/make_op.h, but I understand separating the qnn ops out more directly. ########## File path: src/relay/transforms/fake_quantization_to_integer.cc ########## @@ -28,42 +28,52 @@ #include <tvm/relay/expr_functor.h> #include <tvm/relay/transform.h> +#include "../qnn/op/make_qnn_op.h" + namespace tvm { namespace relay { /* Description of FakeQuantizationToInteger * - * The purpose of this pass is to find regions of the graph that follow - * the general pattern: + * The purpose of this pass is to find regions of the graph that can be quantized and convert all + * ops in this subgraph to quantized ops. E.g. for below example nodes dq1, dq2, op1 and op2 will + * participate in transformation to quantized ops while op3 has non quantized input and stays out of + * transformation scope: * * x w * | | - * dq dq + * dq1 dq2 * \ / - * op1 + * op1 (can be quantized) * | - * op2 + * op2 (can be quantized) <- anchor node to be identified and used in mutation pass * | - * q + * | non_quantized_input + * \ / + * op3 <- cannot be quantized Review comment: I don't like this approach, it solves some issues where we don't support integer ops embedded in larger devices, but has the property of mis-representing the user's original intention for segments of the graph that might have actually been dequantized. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
