-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify tensor and image sync operations.
OpTensor/ImageSyncDevice -> OpSyncDevice OpTensor/ImageSyncLocal -> OpSyncLocal Signed-off-by: Robert Quill <robert.quill@imgtec.com>
- Loading branch information
Showing
29 changed files
with
355 additions
and
604 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "kompute/operations/OpSyncDevice.hpp" | ||
|
||
namespace kp { | ||
|
||
OpSyncDevice::OpSyncDevice( | ||
const std::vector<std::shared_ptr<Memory>>& memObjects) | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncDevice constructor with params"); | ||
|
||
if (memObjects.size() < 1) { | ||
throw std::runtime_error( | ||
"Kompute OpSyncDevice called with less than 1 memory object"); | ||
} | ||
|
||
this->mMemObjects = memObjects; | ||
} | ||
|
||
OpSyncDevice::~OpSyncDevice() | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncDevice destructor started"); | ||
|
||
this->mMemObjects.clear(); | ||
} | ||
|
||
void | ||
OpSyncDevice::record(const vk::CommandBuffer& commandBuffer) | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncDevice record called"); | ||
|
||
for (size_t i = 0; i < this->mMemObjects.size(); i++) { | ||
if (this->mMemObjects[i]->memoryType() == Tensor::MemoryTypes::eDevice) { | ||
this->mMemObjects[i]->recordCopyFromStagingToDevice(commandBuffer); | ||
} | ||
} | ||
} | ||
|
||
void | ||
OpSyncDevice::preEval(const vk::CommandBuffer& /*commandBuffer*/) | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncDevice preEval called"); | ||
} | ||
|
||
void | ||
OpSyncDevice::postEval(const vk::CommandBuffer& /*commandBuffer*/) | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncDevice postEval called"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "kompute/Tensor.hpp" | ||
|
||
#include "kompute/operations/OpSyncLocal.hpp" | ||
|
||
namespace kp { | ||
|
||
OpSyncLocal::OpSyncLocal( | ||
const std::vector<std::shared_ptr<Memory>>& memObjects) | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncLocal constructor with params"); | ||
|
||
if (memObjects.size() < 1) { | ||
throw std::runtime_error( | ||
"Kompute OpSyncLocal called with less than 1 memory object"); | ||
} | ||
|
||
this->mMemObjects = memObjects; | ||
} | ||
|
||
OpSyncLocal::~OpSyncLocal() | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncLocal destructor started"); | ||
} | ||
|
||
void | ||
OpSyncLocal::record(const vk::CommandBuffer& commandBuffer) | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncLocal record called"); | ||
|
||
for (size_t i = 0; i < this->mMemObjects.size(); i++) { | ||
if (this->mMemObjects[i]->memoryType() == Memory::MemoryTypes::eDevice) { | ||
|
||
this->mMemObjects[i]->recordPrimaryMemoryBarrier( | ||
commandBuffer, | ||
vk::AccessFlagBits::eShaderWrite, | ||
// FIXME: eTransferRead is not supported for the compute pipeline | ||
vk::AccessFlagBits::eTransferRead, | ||
vk::PipelineStageFlagBits::eComputeShader, | ||
vk::PipelineStageFlagBits::eTransfer); | ||
|
||
this->mMemObjects[i]->recordCopyFromDeviceToStaging(commandBuffer); | ||
|
||
this->mMemObjects[i]->recordPrimaryMemoryBarrier( | ||
commandBuffer, | ||
// FIXME: eTransferRead is not supported for the compute pipeline | ||
vk::AccessFlagBits::eTransferWrite, | ||
vk::AccessFlagBits::eHostRead, | ||
vk::PipelineStageFlagBits::eTransfer, | ||
vk::PipelineStageFlagBits::eHost); | ||
} | ||
} | ||
} | ||
|
||
void | ||
OpSyncLocal::preEval(const vk::CommandBuffer& /*commandBuffer*/) | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncLocal preEval called"); | ||
} | ||
|
||
void | ||
OpSyncLocal::postEval(const vk::CommandBuffer& /*commandBuffer*/) | ||
{ | ||
KP_LOG_DEBUG("Kompute OpSyncLocal postEval called"); | ||
|
||
KP_LOG_DEBUG("Kompute OpSyncLocal mapping data into tensor local"); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.