SWDEV-480209 - Make internal callbacks non-blocking

Change-Id: Ic918d08f341abfd9a7c167d09f9c723cdc43157f
This commit is contained in:
Anusha GodavarthySurya
2024-10-28 09:23:25 +00:00
committed by Anusha Godavarthy Surya
parent c9dd95bf6c
commit 683a942364
11 changed files with 38 additions and 34 deletions
+2 -12
View File
@@ -732,21 +732,11 @@ hipError_t GraphExec::Run(hipStream_t graph_launch_stream) {
// we may not need to flush any caches.
CallbackCommand->setEventScope(amd::Device::kCacheStateIgnore);
amd::Event& event = CallbackCommand->event();
if (!event.setCallback(CL_COMPLETE, GraphExec::DecrementRefCount, this)) {
constexpr bool kBlocking = false;
if (!event.setCallback(CL_COMPLETE, GraphExec::DecrementRefCount, this, kBlocking)) {
return hipErrorInvalidHandle;
}
CallbackCommand->enqueue();
// Add the new barrier to stall the stream, until the callback is done
amd::Command::EventWaitList eventWaitList;
eventWaitList.push_back(CallbackCommand);
amd::Command* block_command = new amd::Marker(*launch_stream, kMarkerDisableFlush, eventWaitList);
// we may not need to flush any caches.
block_command->setEventScope(amd::Device::kCacheStateIgnore);
if (block_command == nullptr) {
return hipErrorInvalidValue;
}
block_command->enqueue();
block_command->release();
CallbackCommand->release();
return status;
}