1. 22 Dec, 2019 1 commit
    • [REFACTOR][DTYPE] Isolate dtype to runtime (#4560) · 7fa8aab5
      dtype.h -> runtime/data_type.h
      
      Changes:
      - Rename all old reference of tvm::Type to DataType
      - ExprNode.type -> ExprNode.dtype
      - Expr.type() -> Expr.dtype()
      - Change Expr related functions to expr_operator.
        - DataType::min() -> min_value(DataType)
        - DataType::max() -> max_value(DataType)
      - Move type constructor Int, UInt, Float, Handle, Bool into DataType.
        - Int(bits) -> DataType::Int(bits)
        - UInt(bits) -> DataType::UInt(bits)
      Tianqi Chen committed
  2. 24 Nov, 2019 1 commit
  3. 21 Nov, 2019 1 commit
  4. 16 Nov, 2019 1 commit
    • Retain qnn input kernel scales (#4292) · 3ba9dd09
      * Add qnn conv2d attributes for input_tensor_scale and
      kernel_tensor_scale.
      
      The lowering in the tflite frontend loses the input_tensor_scale
      and the kernel_tensor_scale by multiplying it and putting it into
      the Requantize operation. This means that any graph partitioning
      passes or other passes that need to access this information no longer
      have it available in the qnn dialect.
      
      regards
      Ramana
      
      * Store input tensor scale and Weight tensor scale for Dense as well
      
      As for conv2d, the tflite frontend drops the input tensor
      scale and the weight tensor scale from the relay op. Store
      it as separate fields in there.
      
      * Fix unintentional tab
      
      * Rename input_tensor_scale to input_scale and kernel_tensor_scale
      to kernel_scale for conv2d.
      
      * input_tensor_scale -> input_scale weight_tensor_scale->weight_scale
      
      * Rework dense testcase
      
      And use input_scale and kernel_scale
      
      * Be consistent in use of input_scale and kernel_scale values
      
      * Fixup qnn conv2d tests for input_scale and kernel_scale
      
      * Make pydoc identical between conv2d and dense for weight_tensor
      
      * Fix up conv2d parameters to be in the same order between C++ and python
      
      * Fix ordering of parameters for dense.
      
      * Add input_scale and output_scale to try and satisfy ci gods
      
      * Delete input_scale and kernel_scale.
      
      nn.conv2d does not contain input_scale and kernel_scale. We need
      to delete it when lowering it to nn.conv2d.
      
      * Add input_scale and kernel_scale for qnn.conv2d
      Ramana Radhakrishnan committed
  5. 14 Nov, 2019 2 commits
  6. 30 Oct, 2019 1 commit
    • Improve the lowering of Qnn Dense (#4213) · 2be444f9
      * [QNN] Improving Dense lowering.
      
      * - Moving get_shape method to util
      - Finalizing the test cases and the code structure for optimized dense computation.
      
      * - Fixing cpplint.
      
      * - Addressing review comments.
      
      * - Renaming the variables correctly.
      
      * - Renaming the variables correctly.
      shoubhik committed
  7. 29 Oct, 2019 1 commit
  8. 21 Oct, 2019 2 commits
    • Add support for quantized multiply to Relay (#4141) · e5835425
      This patch adds multiply operator for quantized tensors.
      The details of the quantized multiplication are outlined
      in the code.
      
      This builds on pull request 3927 and includes the changes
      Animesh mentions in the comments on that request.
      
      Change-Id: I555715b53d0266a91d5c03dc3dfe8fc31e7ce4e1
      ekalda committed
    • [REFACTOR][NODE][RUNTIME] Move Node to the new Object protocol. (#4161) · 7895adb2
      * [REFACTOR][NODE][RUNTIME] Move Node to the new Object protocol.
      
      This PR removes the original node system, and make node as a subclass of Object.
      This is a major refactor towards a better unified runtime object system.
      
      List of changes in the refactor:
      
      - We now hide data_ field, use Downcast explicitly to get a sub-class object.
      - Removed the node system FFI in python.
      - Removed the node C API, instead use PackedFunc for list and get attrs.
      - Change relay::Op::set_attr_type_key(attr_key_name) to relay::Op::set_attr_type<AttrType>().
        - This change was necessary because of the new Object registration mechanism.
        - Subsequent changes to the op registrations
        - The change revealed a few previous problems that is now fixed.
      - Patched up a few missing node type registration.
        - Now we will raise an error if we register object that is not registered.
      - The original node.h and container.h are kept in the same location.
      - Calling convention: kObjectHandle now equals the old kNodeHandle, kNodeHandle is removed.
      - IRFunctor now dispatches on ObjectRef.
      - Update to the new type checking API: is_type, derived_from are replaced by IsInstance.
      - Removed .hash member function, instead use C++ convention hasher functors.
      
      * Address review comments
      Tianqi Chen committed
  9. 16 Oct, 2019 1 commit
  10. 08 Oct, 2019 1 commit
  11. 06 Oct, 2019 1 commit
  12. 26 Sep, 2019 1 commit
  13. 23 Sep, 2019 1 commit
  14. 22 Sep, 2019 1 commit
    • Qnn fully connected (#3910) · 43f54a58
      * Qnn Dense layer.
      
      * Reformatting code.
      
      * Reformatting code and making the test case more readable.
      
      * Fixing lint issues.
      
      * Fixing test method names to pass the nose related configurations.
      
      * Aligning the code for code style.
      shoubhik committed
  15. 12 Sep, 2019 1 commit
  16. 05 Sep, 2019 1 commit
  17. 04 Sep, 2019 1 commit
  18. 02 Sep, 2019 1 commit
  19. 31 Aug, 2019 1 commit
  20. 30 Aug, 2019 1 commit
  21. 23 Aug, 2019 1 commit
  22. 16 Aug, 2019 1 commit
    • QNN quantize and dequantize operators. (#3745) · d3eb9cb8
      * QNN quantize and dequantize operators.
      
      * addressing review comments.
      
      * addressing review comments.
      
      * Adding new line at the end of the file.
      
      * Adhering to styling guidelines.
      
      * Adding name to contributors.
      
      * Fixing lint issue.
      
      * Fixing file name.
      
      * Removing unnecessary code.
      shoubhik committed
  23. 08 Aug, 2019 1 commit
    • [QNN] Requantize operator (#3531) · a78adbd5
      * [Relay] [Quantization] WIP - Common files for the qauntization work.
      
      * [Relay] [Quantization] WIP - Prototyping requantize op.
      
      * Requantize operator implementation.
      
      Requantize converts one quantized tensor representation to another quantized
      representation. The PR has following implementation features
      
      - Requantize operator defined in qnn namespace - relay.qnn.requantize
      - Lowering of the requantize to exisiting Relay operators
      - Integer fixed point implementation of requantize
          - Two rounding modes - FE_UPWARDS (round towards infinity) and
          FE_AWAY_FROM_ZERO (std::round behavior)
      - Floating point implementation as well, that can act as reference or can be
      used for devices when FP32 computation is not used.
      - Unit test cases
      
      Relevant Issue - https://github.com/dmlc/tvm/issues/2351
      
      Credit to TFLite and GemmLowp to provide reference implementations.
      
      * Typo and lint fixes.
      
      * Doc fix.
      
      * Uncommenting the lint script (fixing mistake).
      
      * Modifying the unit tests.
      
      * Moving C++ files into src/relay/qnn
      
      * Moving python files to python/tvm/relay/qnn. Some minor fixes.
      
      * Moving the attrs.h inside the include directory.
      
      * Pushing files that I forgot earlier. Changing util location.
      
      * Incorporating comments. API change. Lint fixes.
      
      * Modifying the GetFixedPointMultiplierShift API as per comments.
      
      * Forgot the dialect change.
      
      * Changing rewrite to qnn_lower.
      
      * Renaming Quantize to Qnn for clarity.
      
      * Remove use_int_domain.
      
      * Incorportaing review comments.
      
      * Adding API doc for QNN dialect.
      
      * Move the qnn_lower pass to transform namespace.
      
      * Moving from expr to module. Adding namespace in C++.
      
      * Minor sentence rewrites. Added qnn namespace.
      
      * Added the API doc.
      
      * Chanding default out_dtype to int8. Adding a test with in/out_dtype as uint8.
      
      * Style fixes. Better error messages.
      
      * Adding documentation.
      
      * More documentation fixes.
      
      * Adding out dtype check for requantize.
      
      * Adding corner case for FP32 to fixed point conversion.
      
      * Adding extra line.
      
      * Documentation fix.
      
      * Adding static inline.
      
      * Incorporating jackwish comment. Removed idtype from requantize lowering.
      
      * Removing Quantize/Dequantize code. Restricting Requantize to (u)int8/int32.
      
      * Style fixes.
      
      * Fix the docs.
      
      * Move to Legalize API.
      Animesh Jain committed