-
Notifications
You must be signed in to change notification settings - Fork 40
enable GPU IPC tests on Windows #739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
6da36e1
to
da553d7
Compare
a77f891
to
78361c2
Compare
976028a
to
cfc6f31
Compare
cfc6f31
to
1140442
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job in general, a few minor issues
d0aca41
to
becaa7d
Compare
1d41c75
to
152c072
Compare
src/provider/provider_level_zero.c
Outdated
memcpy(&ze_ipc_handle, &fd_local, sizeof(fd_local)); | ||
} | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove tab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
CloseHandle(source_process_handle); | ||
|
||
return result ? UMF_RESULT_SUCCESS : UMF_RESULT_ERROR_UNKNOWN; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will always return UMF_RESULT_SUCCESS since you check error at 79.
Otherwise:
} | |
release_current: | |
CloseHandle(current_process_handle); | |
release_source: | |
CloseHandle(source_process_handle); | |
return result; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if (!result) { | ||
LOG_ERR("DuplicateHandle() failed for pid=%d fd_in=%d.", pid, fd_in); | ||
CloseHandle(current_process_handle); | ||
CloseHandle(source_process_handle); | ||
return UMF_RESULT_ERROR_UNKNOWN; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!result) { | |
LOG_ERR("DuplicateHandle() failed for pid=%d fd_in=%d.", pid, fd_in); | |
CloseHandle(current_process_handle); | |
CloseHandle(source_process_handle); | |
return UMF_RESULT_ERROR_UNKNOWN; | |
} | |
if (!result) { | |
LOG_ERR("DuplicateHandle() failed for pid=%d fd_in=%d.", pid, fd_in); | |
result = UMF_RESULT_ERROR_UNKNOWN; | |
goto release_current; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if (!source_process_handle) { | ||
LOG_ERR("OpenProcess() failed for pid=%d.", pid); | ||
CloseHandle(current_process_handle); | ||
return UMF_RESULT_ERROR_UNKNOWN; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!source_process_handle) { | |
LOG_ERR("OpenProcess() failed for pid=%d.", pid); | |
CloseHandle(current_process_handle); | |
return UMF_RESULT_ERROR_UNKNOWN; | |
} | |
BOOL result; | |
if (!source_process_handle) { | |
LOG_ERR("OpenProcess() failed for pid=%d.", pid); | |
result = UMF_RESULT_ERROR_UNKNOWN; | |
goto release_source; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/common/ipc_common.c
Outdated
|
||
int producer_connect(int port) { | ||
struct sockaddr_in consumer_addr; | ||
int ret = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used only at the end of the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
89ec750
to
c423e04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables GPU IPC (Inter-Process Communication) tests on Windows by implementing Windows-specific socket functionality and memory exchange mechanisms. The changes introduce a new memory exchange policy for Level Zero providers to work around IPC limitations on Windows.
Key changes:
- Implements Windows socket support in IPC test infrastructure using Winsock2
- Adds new memory exchange policy (import/export) for Level Zero providers on Windows
- Creates Windows batch scripts for running GPU IPC tests
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
test/common/ipc_common.c | Adds Windows socket implementation with Winsock2 support for IPC communication |
test/providers/ipc_level_zero_prov_producer.c | Sets import/export memory exchange policy on Windows instead of IPC |
test/providers/ipc_level_zero_prov_consumer.c | Sets import/export memory exchange policy on Windows instead of IPC |
test/providers/ipc_level_zero_prov.bat | Windows batch script for Level Zero IPC tests |
test/providers/ipc_cuda_prov.bat | Windows batch script for CUDA IPC tests |
test/CMakeLists.txt | Moves GPU IPC test configuration to support Windows and adds Winsock2 library |
src/provider/provider_level_zero.c | Implements new memory exchange policy with import/export APIs |
src/utils/utils_windows_common.c | Implements Windows handle duplication functionality |
test/providers/provider_level_zero_not_impl.cpp | Adds test for new memory exchange policy API |
include/umf/providers/provider_level_zero.h | Defines new memory exchange policy enum and API |
src/libumf.def | Exports new memory exchange policy function |
*(uintptr_t *)lastNext = | ||
(uintptr_t)&relaxed_device_allocation_desc_copy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using uintptr_t casting to manipulate pNext pointers is unclear and potentially unsafe. Consider using proper pointer casting like *(void **)lastNext = &relaxed_device_allocation_desc_copy;
for better type safety and readability.
Copilot uses AI. Check for mistakes.
if (ze_provider->exchangePolicy == | ||
UMF_LEVEL_ZERO_MEMORY_PROVIDER_MEMORY_EXCHANGE_POLICY_IMPORT_EXPORT) { | ||
// add external memory export desc to the pNext chain | ||
*(uintptr_t *)lastNext = (uintptr_t)&memory_export_desc_copy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as above - using uintptr_t casting to manipulate pNext pointers is unclear and potentially unsafe. Consider using proper pointer casting like *(void **)lastNext = &memory_export_desc_copy;
for better type safety and readability.
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
304c413
to
4f03627
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR enables GPU IPC (Inter-Process Communication) tests on Windows by implementing Windows-specific socket functionality and memory exchange mechanisms. The changes introduce a new memory exchange policy for Level Zero providers to work around IPC limitations on Windows.
Key changes: