Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions sycl/source/detail/sycl_mem_obj_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,25 @@ void SYCLMemObjT::updateHostMemory(void *const Ptr) {
}

void SYCLMemObjT::updateHostMemory() {
if ((MUploadDataFunctor != nullptr) && MNeedWriteBack)
// Don't try updating host memory when stutting down.
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'stutting' to 'shutting'.

Suggested change
// Don't try updating host memory when stutting down.
// Don't try updating host memory when shutting down.

Copilot uses AI. Check for mistakes.
if ((MUploadDataFunctor != nullptr) && MNeedWriteBack &&
GlobalHandler::instance().isOkToDefer())
MUploadDataFunctor();

// If we're attached to a memory record, process the deletion of the memory
// record. We may get detached before we do this.
if (MRecord) {
bool Result = Scheduler::getInstance().removeMemoryObject(this);
// Don't strictly try holding the lock in removeMemoryObject during shutdown
// to prevent deadlocks.
bool Result = Scheduler::getInstance().removeMemoryObject(
this, GlobalHandler::instance().isOkToDefer());
std::ignore = Result; // for no assert build

// removeMemoryObject might fail during shutdown because of not being
// able to hold write lock. This can happen if shutdown happen due to
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected grammar: 'shutdown happen' should be 'shutdown happens'.

Suggested change
// able to hold write lock. This can happen if shutdown happen due to
// able to hold write lock. This can happen if shutdown happens due to

Copilot uses AI. Check for mistakes.
// exception/termination while holding lock.
assert(
Result &&
(Result || !GlobalHandler::instance().isOkToDefer()) &&
"removeMemoryObject should not return false in mem object destructor");
}
releaseHostMem(MShadowCopy);
Expand Down
Loading