algos.h 3.3 KB
Newer Older
1 2 3 4 5 6 7 8
/**
 * \file dnn/src/arm_common/conv_bias/quint8/algos.h
 * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
 *
 * Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
9 10
 * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
 */

#pragma once

#include "src/arm_common/conv_bias/opr_impl.h"

namespace megdnn {
namespace arm_common {

class ConvBiasImpl::AlgoQU8DirectStride1 final : public AlgoBase {
    bool m_large_group;

public:
    AlgoQU8DirectStride1(bool large_group) : m_large_group(large_group) {}
    bool is_reproducible() const override { return true; }
    const char* name() const override {
        return m_large_group ? "QU8STRD1_LARGE_GROUP" : "QU8STRD1_SMALL_GROUP";
    }

30
    bool usable(const NCBKernSizeParam& param,
31 32
                AlgoSelectionStrategy algo_selection_strategy) const override;

33
    size_t get_workspace(const NCBKernSizeParam& param) const override;
34 35 36 37 38 39 40 41 42 43 44 45 46
    virtual SmallVector<NCBKern> dispatch_kerns(
            const NCBKernSizeParam& param) const override;
};

class ConvBiasImpl::AlgoQU8DirectStride2 final : public AlgoBase {
    bool m_large_group;

public:
    AlgoQU8DirectStride2(bool large_group) : m_large_group(large_group) {}
    bool is_reproducible() const override { return true; }
    const char* name() const override {
        return m_large_group ? "QU8STRD2_LARGE_GROUP" : "QU8STRD2_SMALL_GROUP";
    }
47
    bool usable(const NCBKernSizeParam& param,
48 49
                AlgoSelectionStrategy algo_selection_strategy) const override;

50
    size_t get_workspace(const NCBKernSizeParam& param) const override;
51 52 53
    virtual SmallVector<NCBKern> dispatch_kerns(
            const NCBKernSizeParam& param) const override;
};
54
#if __ARM_FEATURE_DOTPROD
55 56 57 58 59 60 61 62 63 64 65
class ConvBiasImpl::AlgoDotU8DirectStride1 final : public AlgoBase {
    bool m_large_group;

public:
    AlgoDotU8DirectStride1(bool large_group) : m_large_group(large_group) {}
    bool is_reproducible() const override { return true; }
    const char* name() const override {
        return m_large_group ? "ARMDOTU8STRD1_LARGE_GROUP"
                             : "ARMDOTU8STRD1_SMALL_GROUP";
    }

66
    bool usable(const NCBKernSizeParam& param,
67 68
                AlgoSelectionStrategy algo_selection_strategy) const override;

69
    size_t get_workspace(const NCBKernSizeParam& param) const override;
70 71 72 73 74 75 76 77 78 79 80 81 82 83
    virtual SmallVector<NCBKern> dispatch_kerns(
            const NCBKernSizeParam& param) const override;
};

class ConvBiasImpl::AlgoDotU8DirectStride2 final : public AlgoBase {
    bool m_large_group;

public:
    AlgoDotU8DirectStride2(bool large_group) : m_large_group(large_group) {}
    bool is_reproducible() const override { return true; }
    const char* name() const override {
        return m_large_group ? "ARMDOTU8STRD2_LARGE_GROUP"
                             : "ARMDOTU8STRD2_SMALL_GROUP";
    }
84
    bool usable(const NCBKernSizeParam& param,
85 86
                AlgoSelectionStrategy algo_selection_strategy) const override;

87
    size_t get_workspace(const NCBKernSizeParam& param) const override;
88 89 90 91 92 93 94
    virtual SmallVector<NCBKern> dispatch_kerns(
            const NCBKernSizeParam& param) const override;
};
#endif
}  // namespace arm_common
}  // namespace megdnn
   // vim: syntax=cpp.doxygen