Skip to content

[L0] Support for urUsmP2PPeerAccessGetInfoExp to query p2p access info #1429

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

Merged
merged 1 commit into from
Mar 14, 2024
Merged
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
37 changes: 31 additions & 6 deletions source/adapters/level_zero/usm_p2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,36 @@ UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp(
ur_exp_peer_info_t propName, size_t propSize, void *pPropValue,
size_t *pPropSizeRet) {

std::ignore = commandDevice;
std::ignore = peerDevice;
std::ignore = propName;

UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet);
// Zero return value indicates that all of the queries currently return false.
return ReturnValue(uint32_t{0});

bool propertyValue = false;
switch (propName) {
case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: {
bool p2pAccessSupported = false;
ze_device_p2p_properties_t p2pProperties;
ZE2UR_CALL(zeDeviceGetP2PProperties,
(commandDevice->ZeDevice, peerDevice->ZeDevice, &p2pProperties));
if (p2pProperties.flags & ZE_DEVICE_P2P_PROPERTY_FLAG_ACCESS) {
p2pAccessSupported = true;
}
ze_bool_t p2pDeviceSupported = false;
ZE2UR_CALL(
zeDeviceCanAccessPeer,
(commandDevice->ZeDevice, peerDevice->ZeDevice, &p2pDeviceSupported));
propertyValue = p2pAccessSupported && p2pDeviceSupported;
break;
}
case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED: {
ze_device_p2p_properties_t p2pProperties;
ZE2UR_CALL(zeDeviceGetP2PProperties,
(commandDevice->ZeDevice, peerDevice->ZeDevice, &p2pProperties));
propertyValue = p2pProperties.flags & ZE_DEVICE_P2P_PROPERTY_FLAG_ATOMICS;
break;
}
default: {
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}
}

return ReturnValue(propertyValue);
}