kfdtest: skip test when PC Sampling is not supported by ASIC
Skip test when PC Sampling is not supported by ASIC. Change-Id: I6f9be0bdaed66e51052723b6df6908079470cefb Signed-off-by: James Zhu <James.Zhu@amd.com> Signed-off-by: Chris Freehill <cfreehil@amd.com>
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
HSAKMT_STATUS HSAKMTAPI hsaKmtPcSamplingSupport(void)
|
||||
{
|
||||
CHECK_KFD_OPEN();
|
||||
CHECK_KFD_MINOR_VERSION(16);
|
||||
CHECK_KFD_MINOR_VERSION(17);
|
||||
|
||||
return HSAKMT_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtPcSamplingQueryCapabilities(HSAuint32 NodeId, void
|
||||
return HSAKMT_STATUS_INVALID_PARAMETER;
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
CHECK_KFD_MINOR_VERSION(16);
|
||||
CHECK_KFD_MINOR_VERSION(17);
|
||||
|
||||
HSAKMT_STATUS ret = validate_nodeid(NodeId, &gpu_id);
|
||||
if (ret != HSAKMT_STATUS_SUCCESS) {
|
||||
|
||||
@@ -74,8 +74,14 @@ TEST_F(KFDPCSamplingTest, BasicTest) {
|
||||
ASSERT_GE(defaultGPUNode, 0) << "Failed to get default GPU Node.";
|
||||
|
||||
/* 1. get pc sampling format numbe of entry */
|
||||
ASSERT_SUCCESS(!hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, NULL,
|
||||
num_sample_info, &return_num_sample_info));
|
||||
HSAKMT_STATUS ret = hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, NULL,
|
||||
num_sample_info, &return_num_sample_info);
|
||||
if (ret == HSAKMT_STATUS_NOT_SUPPORTED) {
|
||||
LOG() << "Skipping test: This GPU does not support PC Sampling." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_GE(return_num_sample_info, 1);
|
||||
|
||||
num_sample_info = return_num_sample_info;
|
||||
void *info_buf = calloc(num_sample_info, sizeof(HsaPcSamplingInfo));
|
||||
|
||||
@@ -150,12 +156,21 @@ TEST_F(KFDPCSamplingTest, MultiThreadPcSamplingTest) {
|
||||
|
||||
HSAuint64 threadId[2];
|
||||
struct ThreadParams params[2];
|
||||
HSAuint32 num_sample_info = 2;
|
||||
HSAuint32 num_sample_info = 0;
|
||||
HSAuint32 return_num_sample_info = 0;
|
||||
|
||||
HSAuint32 defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();
|
||||
ASSERT_GE(defaultGPUNode, 0) << "Failed to get default GPU Node";
|
||||
|
||||
HSAKMT_STATUS ret = hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, NULL,
|
||||
num_sample_info, &return_num_sample_info);
|
||||
if (ret == HSAKMT_STATUS_NOT_SUPPORTED) {
|
||||
LOG() << "Skipping test: This GPU does not support PC Sampling." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_GE(return_num_sample_info, 1);
|
||||
|
||||
num_sample_info = return_num_sample_info;
|
||||
void *info_buf = calloc(num_sample_info, sizeof(HsaPcSamplingInfo));
|
||||
|
||||
ASSERT_SUCCESS(hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, info_buf,
|
||||
@@ -234,8 +249,14 @@ TEST_F(KFDPCSamplingTest, MultiProcPcSamplingTest) {
|
||||
|
||||
params.GPUNode = defaultGPUNode;
|
||||
|
||||
ASSERT_SUCCESS(!hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, NULL,
|
||||
num_sample_info, &return_num_sample_info));
|
||||
HSAKMT_STATUS ret = hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, NULL,
|
||||
num_sample_info, &return_num_sample_info);
|
||||
if (ret == HSAKMT_STATUS_NOT_SUPPORTED) {
|
||||
LOG() << "Skipping test: This GPU does not support PC Sampling." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_GE(return_num_sample_info, 1);
|
||||
|
||||
num_sample_info = return_num_sample_info;
|
||||
void *info_buf = calloc(num_sample_info, sizeof(HsaPcSamplingInfo));
|
||||
ASSERT_SUCCESS(hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, info_buf,
|
||||
@@ -280,8 +301,14 @@ TEST_F(KFDPCSamplingTest, MultiProcPcSamplingTestM) {
|
||||
HSAuint32 defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();
|
||||
ASSERT_GE(defaultGPUNode, 0) << "Failed to get default GPU Node";
|
||||
|
||||
ASSERT_SUCCESS(!hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, NULL,
|
||||
num_sample_info, &return_num_sample_info));
|
||||
HSAKMT_STATUS ret = hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, NULL,
|
||||
num_sample_info, &return_num_sample_info);
|
||||
if (ret == HSAKMT_STATUS_NOT_SUPPORTED) {
|
||||
LOG() << "Skipping test: This GPU does not support PC Sampling." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_GE(return_num_sample_info, 1);
|
||||
|
||||
num_sample_info = return_num_sample_info;
|
||||
void *info_buf = calloc(num_sample_info, sizeof(HsaPcSamplingInfo));
|
||||
ASSERT_SUCCESS(hsaKmtPcSamplingQueryCapabilities(defaultGPUNode, info_buf,
|
||||
|
||||
مرجع در شماره جدید
Block a user