MNN/source/backend/vulkan/execution/VulkanMatrixMultier4x4.hpp

53 lines
1.5 KiB
C++
Raw Normal View History

2019-04-17 10:49:11 +08:00
//
// VulkanMatrixMultier4x4.hpp
2019-04-17 10:49:11 +08:00
// MNN
//
// Created by MNN on 2019/01/31.
// Copyright © 2018, Alibaba Group Holding Limited
//
#ifndef VulkanMatrixMultier4x4_hpp
#define VulkanMatrixMultier4x4_hpp
2019-04-17 10:49:11 +08:00
#include <stdio.h>
#include "VulkanBasicExecution.hpp"
2019-04-17 10:49:11 +08:00
namespace MNN {
class VulkanMatrixMultier4x4 : public NonCopyable {
2019-04-17 10:49:11 +08:00
public:
virtual ~VulkanMatrixMultier4x4();
static std::shared_ptr<VulkanImage> createKernel(VulkanBackend* backend, const float* B, int l, int h, int c);
VulkanMatrixMultier4x4(VulkanBackend* backend, const float* B, int l, int h, int c = 1, std::shared_ptr<VulkanImage> kernel = nullptr);
void prepare(int e, std::shared_ptr<VulkanImage> dst = nullptr, std::shared_ptr<VulkanImage> src = nullptr);
2019-04-17 10:49:11 +08:00
void compute(const VulkanCommandPool::Buffer* commandBuffer) const;
inline const VulkanImage* source() const {
return mSource.get();
}
inline const VulkanImage* dest() const {
return mDest.get();
}
private:
const VulkanPipeline* mPipeline;
std::shared_ptr<VulkanPipeline::DescriptorSet> mDescriptorSet;
VulkanBackend* mBackend;
std::shared_ptr<VulkanImage> mKernel;
const VulkanSampler* mSampler;
std::shared_ptr<VulkanBuffer> mConstBuffer;
std::shared_ptr<VulkanImage> mDest;
std::shared_ptr<VulkanImage> mSource;
int mWidth;
int mHeight;
int mDepth;
int mOutputWidth = 0;
int mOutputHeight = 0;
};
} // namespace MNN
#endif /* VulkanMatrixMultier4x4_hpp */