Added initial implementation for algorithm and opMult

This commit is contained in:
Alejandro Saucedo 2020-08-21 19:15:07 +01:00
parent 0d18dc50e6
commit d59dc41ffc
11 changed files with 385 additions and 28 deletions

View file

@ -19,13 +19,43 @@ class Algorithm
public:
Algorithm();
Algorithm(std::shared_ptr<vk::Device> device);
Algorithm(std::shared_ptr<vk::Device> device, std::shared_ptr<vk::CommandBuffer> commandBuffer);
// TODO: Add specialisation data
// TODO: Explore other ways of passing shader (ie raw bytes)
void init(std::string shaderFilePath,
std::vector<std::shared_ptr<Tensor>> tensorParams);
~Algorithm();
// Record commands
void recordDispatch(uint32_t x, uint32_t y, uint32_t z);
private:
// Shared resources
std::shared_ptr<vk::Device> mDevice;
std::shared_ptr<vk::CommandBuffer> mCommandBuffer;
// Resources owned by default
std::shared_ptr<vk::DescriptorSetLayout> mDescriptorSetLayout;
bool mFreeDescriptorSetLayout = false;
std::shared_ptr<vk::DescriptorPool> mDescriptorPool;
bool mFreeDescriptorPool = false;
std::vector<std::shared_ptr<vk::DescriptorSet>> mDescriptorSets;
bool mFreeDescriptorSet = false;
std::shared_ptr<vk::ShaderModule> mShaderModule;
bool mFreeShaderModule = false;
std::shared_ptr<vk::PipelineLayout> mPipelineLayout;
bool mFreePipelineLayout = false;
std::shared_ptr<vk::PipelineCache> mPipelineCache;
bool mFreePipelineCache = false;
std::shared_ptr<vk::Pipeline> mPipeline;
bool mFreePipeline = false;
// Create util functions
void createParameters(std::vector<std::shared_ptr<Tensor>>& tensorParams);
void createShaderModule(std::string shaderFilePath);
void createPipeline();
};
} // End namespace kp