rocr: Add hsa-agent Queries for Clock Counters
Support has been added to query the following
HSA_AMD_INFO_GET_CLOCK_COUNTERS agent info exposed through the hsa api
in rocr, rather than the user having to make a direct IOCTL call
through the kernel driver.
Signed-off-by: Sunday Clement <Sunday.Clement@amd.com>
[ROCm/ROCR-Runtime commit: e97d06530e]
Cette révision appartient à :
révisé par
Clement, Sunday
Parent
a62368e2ba
révision
315b1abaf9
@@ -253,6 +253,9 @@ hsa_status_t AieAgent::GetInfo(hsa_agent_info_t attribute, void *value) const {
|
||||
case HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES:
|
||||
std::memset(value, 0, sizeof(uint8_t) * 8);
|
||||
break;
|
||||
case HSA_AMD_AGENT_INFO_CLOCK_COUNTERS:
|
||||
std::memset(value, 0, sizeof(hsa_amd_clock_counters_t));
|
||||
break;
|
||||
default:
|
||||
*reinterpret_cast<uint32_t *>(value) = 0;
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
@@ -417,6 +417,9 @@ hsa_status_t CpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
|
||||
case HSA_AMD_AGENT_INFO_SCRATCH_LIMIT_CURRENT:
|
||||
*((uint64_t*)value) = 0;
|
||||
break;
|
||||
case HSA_AMD_AGENT_INFO_CLOCK_COUNTERS:
|
||||
memset(value, 0, sizeof(hsa_amd_clock_counters_t));
|
||||
break;
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
break;
|
||||
|
||||
@@ -1674,6 +1674,19 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
|
||||
case HSA_AMD_AGENT_INFO_SCRATCH_LIMIT_CURRENT:
|
||||
*((uint64_t*)value) = scratch_limit_async_threshold_;
|
||||
break;
|
||||
case HSA_AMD_AGENT_INFO_CLOCK_COUNTERS: {
|
||||
HsaClockCounters hsakmt_counters = {};
|
||||
hsa_amd_clock_counters_t* counters = static_cast<hsa_amd_clock_counters_t*>(value);
|
||||
|
||||
if (hsaKmtGetClockCounters(node_id(), &hsakmt_counters) == HSAKMT_STATUS_SUCCESS ) {
|
||||
counters->cpu_clock_counter = hsakmt_counters.CPUClockCounter;
|
||||
counters->gpu_clock_counter = hsakmt_counters.GPUClockCounter;
|
||||
counters->system_clock_counter = hsakmt_counters.SystemClockCounter;
|
||||
counters->system_clock_frequency = hsakmt_counters.SystemClockFrequencyHz;
|
||||
break;
|
||||
}
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
break;
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur