Updated core initial running test

This commit is contained in:
Alejandro Saucedo 2021-02-24 22:53:46 +00:00
parent 635fdb02be
commit f35a62ee9d
4 changed files with 60 additions and 45 deletions

View file

@ -37,6 +37,11 @@ Algorithm::rebuild(
{
KP_LOG_DEBUG("Kompute Algorithm rebuild started");
this->mSpirv = spirv;
this->mWorkgroup = workgroup;
this->mSpecializationConstants = specializationConstants;
this->mPushConstants = pushConstants;
// Descriptor pool is created first so if available then destroy all before rebuild
if (this->mFreeDescriptorPool) {
this->freeMemoryDestroyGPUResources();
@ -303,6 +308,8 @@ Algorithm::createPipeline()
this->mFreePipeline = true;
this->mPipeline = std::make_shared<vk::Pipeline>(pipelineResult);
KP_LOG_DEBUG("Kompute Algorithm Create Pipeline Success");
}
void
@ -313,6 +320,8 @@ Algorithm::recordDispatch(std::shared_ptr<vk::CommandBuffer> commandBuffer)
commandBuffer->bindPipeline(vk::PipelineBindPoint::eCompute,
*this->mPipeline);
KP_LOG_DEBUG("Kompute Algorithm pipeline bound");
commandBuffer->bindDescriptorSets(vk::PipelineBindPoint::eCompute,
*this->mPipelineLayout,
0, // First set
@ -320,7 +329,11 @@ Algorithm::recordDispatch(std::shared_ptr<vk::CommandBuffer> commandBuffer)
nullptr // Dispatcher
);
KP_LOG_DEBUG("Kompute Algorithm descriptor sets bound");
commandBuffer->dispatch(this->mWorkgroup[0], this->mWorkgroup[1], this->mWorkgroup[2]);
KP_LOG_DEBUG("Kompute Algorithm dispatch success");
}
void

View file

@ -119,24 +119,6 @@ Manager::~Manager()
}
}
std::shared_ptr<Sequence>
Manager::sequence(uint32_t queueIndex)
{
KP_LOG_DEBUG("Kompute Manager sequence() with sequenceName: {} "
"and queueIndex: {}",
queueIndex);
std::shared_ptr<Sequence> sq =
std::make_shared<Sequence>(this->mPhysicalDevice,
this->mDevice,
this->mComputeQueues[queueIndex],
this->mComputeQueueFamilyIndices[queueIndex]);
this->mManagedSequences.push_back(sq);
return sq;
}
void
Manager::createInstance()
{
@ -334,13 +316,15 @@ Manager::tensor(
{
KP_LOG_DEBUG("Kompute Manager tensor creation triggered");
std::shared_ptr<Tensor> tensor = std::make_shared<Tensor>(
kp::Tensor(this->mPhysicalDevice, this->mDevice, data, tensorType));
std::shared_ptr<Tensor> tensor{
new kp::Tensor(this->mPhysicalDevice, this->mDevice, data, tensorType) };
this->mManagedTensors.push_back(tensor);
return tensor;
}
std::shared_ptr<Algorithm>
Manager::algorithm(
const std::vector<std::shared_ptr<Tensor>>& tensors,
@ -351,18 +335,36 @@ Manager::algorithm(
KP_LOG_DEBUG("Kompute Manager algorithm creation triggered");
std::shared_ptr<Algorithm> algorithm = std::make_shared<Algorithm>(
kp::Algorithm(
std::shared_ptr<Algorithm> algorithm{
new kp::Algorithm(
this->mDevice,
tensors,
spirv,
workgroup,
specializationConstants,
pushConstants));
pushConstants)};
this->mManagedAlgorithms.push_back(algorithm);
return algorithm;
}
std::shared_ptr<Sequence>
Manager::sequence(uint32_t queueIndex)
{
KP_LOG_DEBUG("Kompute Manager sequence() with sequenceName: {} "
"and queueIndex: {}",
queueIndex);
std::shared_ptr<Sequence> sq{
new kp::Sequence(this->mPhysicalDevice,
this->mDevice,
this->mComputeQueues[queueIndex],
this->mComputeQueueFamilyIndices[queueIndex]) };
this->mManagedSequences.push_back(sq);
return sq;
}
}