kfdtest: Add helper to check if IsAppAPU system

If there is connection between GPU and CPU with weight 13,
KFD_CRAT_INTRA_SOCKET_WEIGHT, then this is AppAPU.

This will be used to skip tests not suitable for AppAPU.

Change-Id: If6fad81528b52afd4ac4cefa508d787b0f6637ca
Signed-off-by: Philip Yang <Philip.Yang@amd.com>


[ROCm/ROCR-Runtime commit: e2df2c21af]
This commit is contained in:
Philip Yang
2023-03-24 11:14:40 -04:00
committed by Graham Sider
vanhempi 76c0c340f9
commit e80be9112f
2 muutettua tiedostoa jossa 34 lisäystä ja 0 poistoa
@@ -672,6 +672,39 @@ const bool HsaNodeInfo::IsGPUNodeLargeBar(int node) const {
return false;
}
const bool HsaNodeInfo::IsAppAPU(int node) const {
const HsaNodeProperties *pNodeProperties = GetNodeProperties(node);
/* CPU with compute cores is small APU, not AppAPU */
if (pNodeProperties->NumCPUCores && pNodeProperties->NumFComputeCores)
return false;
HsaIoLinkProperties *IolinkProperties = new HsaIoLinkProperties[pNodeProperties->NumIOLinks];
if (hsaKmtGetNodeIoLinkProperties(node, pNodeProperties->NumIOLinks, IolinkProperties)) {
LOG() << "Unable to get Node IO Link Information for node " << node << std::endl;
delete [] IolinkProperties;
return false;
}
/* Checking GPU-to-CPU connection weight */
for (int linkId = 0; linkId < pNodeProperties->NumIOLinks; linkId++) {
HsaNodeProperties linkProps;
if (hsaKmtGetNodeProperties(IolinkProperties[linkId].NodeTo, &linkProps)) {
LOG() << "Unable to get connected device's IO Link information" << std::endl;
break;
}
/* If it's GPU-CPU link with connection weight KFD_CRAT_INTRA_SOCKET_WEIGHT 13 */
if (linkProps.NumCPUCores && IolinkProperties[linkId].Weight == 13) {
delete [] IolinkProperties;
return true;
}
}
delete [] IolinkProperties;
return false;
}
const bool HsaNodeInfo::IsPeerAccessibleByNode(int peer, int node) const {
const HsaNodeProperties *pNodeProperties;
@@ -233,6 +233,7 @@ class HsaNodeInfo {
void PrintNodeInfo() const;
const bool IsGPUNodeLargeBar(int node) const;
const bool IsAppAPU(int node) const;
const bool IsPeerAccessibleByNode(int peer, int node) const;
// @brief Find the first available Large-BAR GPU node
// @return: Node ID if successful or -1