MNN/source/backend/cuda/execution/MatMulExecution.hpp

37 lines
1012 B
C++
Raw Normal View History

2019-04-17 10:49:11 +08:00
//
2020-11-05 16:41:56 +08:00
// MatMulExecution.hpp
2019-04-17 10:49:11 +08:00
// MNN
//
2020-11-05 16:41:56 +08:00
// Created by MNN on 2020/07/30.
2019-04-17 10:49:11 +08:00
// Copyright © 2018, Alibaba Group Holding Limited
//
2020-11-05 16:41:56 +08:00
#ifndef MatMulExecution_hpp
#define MatMulExecution_hpp
#include <vector>
#include "backend/cuda/core/CUDABackend.hpp"
2019-12-27 22:16:57 +08:00
#include "core/Execution.hpp"
2022-01-04 10:50:40 +08:00
#include "TensorCoreGemm.cuh"
2019-04-17 10:49:11 +08:00
namespace MNN {
2020-11-05 16:41:56 +08:00
namespace CUDA {
class MatMulExecution : public Execution {
2019-04-17 10:49:11 +08:00
public:
2020-11-05 16:41:56 +08:00
MatMulExecution(bool transposeA, bool transposeB, Backend *backend);
virtual ~MatMulExecution();
2019-04-17 10:49:11 +08:00
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
2020-11-05 16:41:56 +08:00
virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
2019-04-17 10:49:11 +08:00
private:
2020-11-05 16:41:56 +08:00
bool mTransposeA;
bool mTransposeB;
2022-01-04 10:50:40 +08:00
std::pair<void*, int> mTempA;
std::pair<void*, int> mTempB;
std::pair<void*, int> mParameters; // In GPU
MatMulParam mParam; // In CPU
2022-02-18 11:30:27 +08:00
bool mUseBlas = false;
2019-04-17 10:49:11 +08:00
};
2020-11-05 16:41:56 +08:00
} // namespace CUDA
2019-04-17 10:49:11 +08:00
} // namespace MNN
2020-11-05 16:41:56 +08:00
#endif