Skip to content

[L0v2] fix queues for integrated buffers#21318

Draft
mateuszpn wants to merge 2 commits intointel:syclfrom
mateuszpn:mkl-fix-2
Draft

[L0v2] fix queues for integrated buffers#21318
mateuszpn wants to merge 2 commits intointel:syclfrom
mateuszpn:mkl-fix-2

Conversation

@mateuszpn
Copy link
Contributor

This is an update of #21297, making the changes consistent with migrateMemory()

Copy link
Contributor

@pbalcer pbalcer left a comment

Choose a reason for hiding this comment

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

Consider also if we can't optionally move signaling the event into the migrate memory function.

Comment on lines +150 to +159
if (!cmdList) {
UR_DFAILURE("invalid handle in mapHostPtr");
throw UR_RESULT_ERROR_INVALID_NULL_HANDLE;
}
// Use Level Zero copy for USM HOST memory to ensure GPU visibility
ZE_CALL_NOCHECK(zeCommandListAppendMemoryCopy,
(cmdList, mappedPtr, ur_cast<char *>(ptr.get()) + offset,
mapSize, nullptr, 0, nullptr));
ZE2UR_CALL_THROWS(zeCommandListAppendMemoryCopy,
(cmdList, mappedPtr,
ur_cast<char *>(ptr.get()) + offset, mapSize, nullptr,
waitListView.num, waitListView.handles));
waitListView.clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

at this point, can't we just call the migrateMemory function?


if (mappedRegion->flags &
(UR_MAP_FLAG_WRITE | UR_MAP_FLAG_WRITE_INVALIDATE_REGION)) {
if (!cmdList) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

void ur_integrated_buffer_handle_t::unmapHostPtr(
void *pMappedPtr, ze_command_list_handle_t cmdList,
wait_list_view & /*waitListView*/) {
wait_list_view &waitListView) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This wait list will always be empty:

If we want to do this, we'd need to invert how the parameters are passed here. But, given the TODO comment in that function, I'm not sure if that's the right thing to do. Would require some investigation.

void *ur_integrated_buffer_handle_t::mapHostPtr(
ur_map_flags_t flags, size_t offset, size_t mapSize,
ze_command_list_handle_t cmdList, wait_list_view & /*waitListView*/) {
ze_command_list_handle_t cmdList, wait_list_view &waitListView) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Without changing the map function, this wait list will now be used twice, see:

auto pDst = ur_cast<char *>(hBuffer->mapHostPtr(
mapFlags, offset, size, zeCommandList.get(), waitListView));
*ppRetMap = pDst;
if (waitListView) {
// If memory was not migrated, we need to wait on the events here.
ZE2UR_CALL(zeCommandListAppendWaitOnEvents,
(getZeCommandList(), waitListView.num, waitListView.handles));
}

@mateuszpn mateuszpn marked this pull request as draft February 19, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants