Added support for push constants
This commit is contained in:
parent
91d3b9a223
commit
7dc1f35206
28 changed files with 3151 additions and 3090 deletions
|
|
@ -17,7 +17,8 @@ class OpAlgoDispatch : public OpBase
|
|||
{
|
||||
public:
|
||||
|
||||
OpAlgoDispatch(const std::shared_ptr<kp::Algorithm>& algorithm);
|
||||
OpAlgoDispatch(const std::shared_ptr<kp::Algorithm>& algorithm,
|
||||
const kp::Constants& pushConstants = {});
|
||||
|
||||
/**
|
||||
* Default destructor, which is in charge of destroying the algorithm
|
||||
|
|
@ -33,23 +34,24 @@ class OpAlgoDispatch : public OpBase
|
|||
* copy of the output data for the staging buffer so it can be read by the
|
||||
* host.
|
||||
*/
|
||||
virtual void record(std::shared_ptr<vk::CommandBuffer> commandBuffer) override;
|
||||
virtual void record(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
/**
|
||||
* Does not perform any preEval commands.
|
||||
*/
|
||||
virtual void preEval() override;
|
||||
virtual void preEval(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
/**
|
||||
* Executes after the recorded commands are submitted, and performs a copy
|
||||
* of the GPU Device memory into the staging buffer so the output data can
|
||||
* be retrieved.
|
||||
*/
|
||||
virtual void postEval() override;
|
||||
virtual void postEval(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
private:
|
||||
// -------------- ALWAYS OWNED RESOURCES
|
||||
std::shared_ptr<Algorithm> mAlgorithm;
|
||||
Constants mPushConstants;
|
||||
};
|
||||
|
||||
} // End namespace kp
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class OpBase
|
|||
* commands that are expected to record operations that are to be submitted
|
||||
* as a batch into the GPU.
|
||||
*/
|
||||
virtual void record(std::shared_ptr<vk::CommandBuffer> commandBuffer) = 0;
|
||||
virtual void record(const vk::CommandBuffer& commandBuffer) = 0;
|
||||
|
||||
/**
|
||||
* Pre eval is called before the Sequence has called eval and submitted the commands to
|
||||
|
|
@ -44,7 +44,7 @@ class OpBase
|
|||
* resources that are created should be idempotent in case it's called multiple
|
||||
* times in a row.
|
||||
*/
|
||||
virtual void preEval() = 0;
|
||||
virtual void preEval(const vk::CommandBuffer& commandBuffer) = 0;
|
||||
|
||||
/**
|
||||
* Post eval is called after the Sequence has called eval and submitted the commands to
|
||||
|
|
@ -54,7 +54,7 @@ class OpBase
|
|||
* resources that are destroyed should not require a re-init unless explicitly
|
||||
* provided by the user.
|
||||
*/
|
||||
virtual void postEval() = 0;
|
||||
virtual void postEval(const vk::CommandBuffer& commandBuffer) = 0;
|
||||
};
|
||||
|
||||
} // End namespace kp
|
||||
|
|
|
|||
|
|
@ -32,17 +32,17 @@ class OpTensorCopy : public OpBase
|
|||
/**
|
||||
* Records the copy commands from the first tensor into all the other tensors provided. Also optionally records a barrier.
|
||||
*/
|
||||
void record(std::shared_ptr<vk::CommandBuffer> commandBuffer) override;
|
||||
void record(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
/**
|
||||
* Does not perform any preEval commands.
|
||||
*/
|
||||
virtual void preEval() override;
|
||||
virtual void preEval(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
/**
|
||||
* Copies the local vectors for all the tensors to sync the data with the gpu.
|
||||
*/
|
||||
virtual void postEval() override;
|
||||
virtual void postEval(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
private:
|
||||
// -------------- ALWAYS OWNED RESOURCES
|
||||
|
|
|
|||
|
|
@ -31,17 +31,17 @@ class OpTensorSyncDevice : public OpBase
|
|||
/**
|
||||
* For device tensors, it records the copy command for the tensor to copy the data from its staging to device memory.
|
||||
*/
|
||||
void record(std::shared_ptr<vk::CommandBuffer> commandBuffer) override;
|
||||
void record(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
/**
|
||||
* Does not perform any preEval commands.
|
||||
*/
|
||||
virtual void preEval() override;
|
||||
virtual void preEval(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
/**
|
||||
* Does not perform any postEval commands.
|
||||
*/
|
||||
virtual void postEval() override;
|
||||
virtual void postEval(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
private:
|
||||
// -------------- ALWAYS OWNED RESOURCES
|
||||
|
|
|
|||
|
|
@ -32,17 +32,17 @@ class OpTensorSyncLocal : public OpBase
|
|||
/**
|
||||
* For device tensors, it records the copy command for the tensor to copy the data from its device to staging memory.
|
||||
*/
|
||||
void record(std::shared_ptr<vk::CommandBuffer> commandBuffer) override;
|
||||
void record(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
/**
|
||||
* Does not perform any preEval commands.
|
||||
*/
|
||||
virtual void preEval() override;
|
||||
virtual void preEval(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
/**
|
||||
* For host tensors it performs the map command from the host memory into local memory.
|
||||
*/
|
||||
virtual void postEval() override;
|
||||
virtual void postEval(const vk::CommandBuffer& commandBuffer) override;
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue