You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

algos.h 1.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "src/aarch64/conv_bias/opr_impl.h"
  3. #include "src/common/opr_delegate.h"
  4. #include "src/fallback/conv_bias/opr_impl.h"
  5. namespace megdnn {
  6. namespace aarch64 {
  7. using FallbackConvBiasImpl = fallback::ConvBiasImpl;
  8. class ConvBiasImpl::AlgoQU8MatrixMul final : public AlgoBase {
  9. static WorkspaceBundle get_bundle(const NCBKernSizeParam& param);
  10. static void kimpl(const NCBKernParam& param, const NCBKernIndex&);
  11. public:
  12. AlgoAttribute attribute() const override { return AlgoAttribute::REPRODUCIBLE; }
  13. const char* name() const override { return "QU8MATMUL"; }
  14. bool usable(
  15. const NCBKernSizeParam& param,
  16. AlgoSelectionStrategy algo_selection_strategy) const override;
  17. size_t get_workspace(const NCBKernSizeParam& param) const override {
  18. return get_bundle(param).total_size_in_bytes();
  19. }
  20. SmallVector<NCBKern> dispatch_kerns(const NCBKernSizeParam& param) const override {
  21. size_t group = param.filter_meta.group;
  22. return {{kimpl, {group, 1_z, 1_z}}};
  23. }
  24. //! select matmul to the highest preference
  25. bool is_preferred(const NCBKernSizeParam& param) const override {
  26. static CpuOprDelegationStorage<1> storage;
  27. auto conv_bias_opr = storage.get<ConvBias, 0>();
  28. return static_cast<ConvBiasImpl*>(conv_bias_opr)
  29. ->is_matmul_quantized_prefer(param);
  30. }
  31. ConvAlgoTypePack get_algo_type() const override {
  32. return {AlgoDataType::QUINT8X8X32, AlgoCategory::IM2COL};
  33. }
  34. MEGDNN_DECL_ALGO_TYPE(AARCH64_MATMUL_QU8)
  35. };
  36. } // namespace aarch64
  37. } // namespace megdnn
  38. // vim: syntax=cpp.doxygen