[SYCLomaitc] Migrate 2 CUDA IPC code to level zero APIs.#2818
[SYCLomaitc] Migrate 2 CUDA IPC code to level zero APIs.#2818ShengchenJ wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR migrates two CUDA IPC code paths to level zero APIs by introducing new types and functions for IPC event pool handling and updating type mappings.
- Added a new type and functions in ze_utils.hpp to support event pool creation and IPC handling.
- Updated RulesLang.cpp to check for experimental usage of the new cudaIpcEventHandle_st and revised the namespace mappings in MapNames.cpp.
Reviewed Changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| clang/runtime/dpct-rt/include/dpct/ze_utils.hpp | Adds new structures and functions for creating and handling Level Zero event pool IPC. |
| clang/lib/DPCT/RulesLang/RulesLang.cpp | Inserts experimental feature support for cudaIpcEventHandle_st with an updated check. |
| clang/lib/DPCT/RuleInfra/MapNames.cpp | Updates type mapping to include cudaIpcEventHandle_t to the new experimental type. |
Files not reviewed (3)
- clang/lib/DPCT/RulesLang/APINamesMisc.inc: Language not supported
- clang/lib/DPCT/SrcAPI/APINames.inc: Language not supported
- clang/test/dpct/IPC/share_mem_exp_option.cu: Language not supported
| if (CanonicalTypeStr == "cudaIpcEventHandle_st") { | ||
| if (!DpctGlobalInfo::useExtLevelZero()) { | ||
| report(TL->getBeginLoc(), Diagnostics::TRY_EXPERIMENTAL_FEATURE, false, | ||
| "cudaIpcMemHandle_t", "--use-experimental-features=level_zero"); |
There was a problem hiding this comment.
The report message within this block uses 'cudaIpcMemHandle_t' instead of 'cudaIpcEventHandle_t', which may confuse users expecting the correct type name. Please update the string to 'cudaIpcEventHandle_t' to reflect the correct experimental feature.
| "cudaIpcMemHandle_t", "--use-experimental-features=level_zero"); | |
| "cudaIpcEventHandle_t", "--use-experimental-features=level_zero"); |
| int fd = detail::get_fd_of_peer_process(hipc); | ||
| if (fd < 0) | ||
| throw std::runtime_error("Cannot get file descriptor of peer process."); | ||
| *((int *)hipc.handle.data) = detail::get_fd_of_peer_process(hipc); |
There was a problem hiding this comment.
Casting hipc.handle.data to an int pointer directly might lead to issues if the underlying type of handle.data is not guaranteed to store an integer file descriptor. Consider using a safer method, like memcpy or a static_cast/reinterpret_cast with appropriate validation.
|
Temp disable. |
No description provided.