kfdtest: Add function to check for PCI Atomic Ops support

While this is currently only used in one subtest, it's useful to have
this separated into the test utilities. This will also allow us to check
for PCI Atomics support before trying to run them.

Signed-off-by: Kent Russell <kent.russell@amd.com>
Change-Id: I9704d151bfaa627eceae8399cc46c15babde6ff1
이 커밋은 다음에 포함됨:
Kent Russell가 2022-04-05 11:03:36 -04:00를 커밋했습니다
1 부모 f88aaa933b
커밋 8b54459e12
2 파일이 변경됨
+38

검색과 일치하는 파일 없음

+37
파일 보기
@@ -128,6 +128,43 @@ bool is_dgpu() {
return is_dgpu_dev;
}
bool hasPciAtomicsSupport(int node) {
/* If we can't get Node Properties, assume a lack of Atomics support */
HsaNodeProperties *pNodeProperties = new HsaNodeProperties();
if (hsaKmtGetNodeProperties(node, pNodeProperties)) {
LOG() << "Unable to get Node Properties for node " << node << std::endl;
return false;
}
/* APUs don't have IO Links, but support Atomic Ops by default */
if (pNodeProperties->NumCPUCores && pNodeProperties->NumFComputeCores)
return true;
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;
return false;
}
/* Make sure we're checking GPU-to-CPU connection here */
for (int linkId = 0; linkId < pNodeProperties->NumIOLinks; linkId++) {
/* Make sure it's a CPU */
HsaNodeProperties *linkProps = new HsaNodeProperties();
if (hsaKmtGetNodeProperties(IolinkProperties[linkId].NodeTo, linkProps)) {
LOG() << "Unable to get connected device's IO Link information" << std::endl;
return false;
}
if (linkProps->NumCPUCores) {
/* IOLink flags are only valid if Override flag is set */
return (IolinkProperties[linkId].Flags.ui32.Override &&
!IolinkProperties[linkId].Flags.ui32.NoAtomics32bit &&
!IolinkProperties[linkId].Flags.ui32.NoAtomics64bit);
}
}
return false;
}
unsigned int FamilyIdFromNode(const HsaNodeProperties *props) {
unsigned int familyId = FAMILY_UNKNOWN;
+1
파일 보기
@@ -50,6 +50,7 @@ HSAKMT_STATUS CreateQueueTypeEvent(bool ManualReset, bool IsSignaled, unsigned i
bool is_dgpu();
bool isTonga(const HsaNodeProperties *props);
bool hasPciAtomicsSupport(int node);
unsigned int FamilyIdFromNode(const HsaNodeProperties *props);
void GetHwQueueInfo(const HsaNodeProperties *props,