rocr/driver: move wallclock frequency query to driver layer
Move the wallclock frequency query from GpuAgent to driver layer to improve
code organization and support multiple driver types. This change:
1. Add GetWallclockFrequency API to KFD/XDNA drivers
2. Move libdrm GPU info query from GpuAgent to driver implementation
3. Update GpuAgent to use the new driver API
Signed-off-by: Honglei Huang <Honglei1.Huang@amd.com>
[ROCm/ROCR-Runtime commit: 412e386b50]
This commit is contained in:
committed by
Huang, Honglei1
parent
309e8b1a9f
commit
3fb4c8d3d7
@@ -218,13 +218,11 @@ GpuAgent::GpuAgent(HSAuint32 node, const HsaNodeProperties& node_props, bool xna
|
||||
if (model_enabled) {
|
||||
wallclock_frequency_ = 0;
|
||||
} else {
|
||||
// Get wallclock freq from libdrm.
|
||||
amdgpu_gpu_info info;
|
||||
if (DRM_CALL(amdgpu_query_gpu_info(ldrm_dev_, &info)) < 0)
|
||||
throw AMD::hsa_exception(HSA_STATUS_ERROR, "Agent creation failed.\nlibdrm query failed.\n");
|
||||
|
||||
// Reported by libdrm in KHz.
|
||||
wallclock_frequency_ = uint64_t(info.gpu_counter_freq) * 1000ull;
|
||||
// Get wallclock freq
|
||||
err = driver().GetWallclockFrequency(node_id(), &wallclock_frequency_);
|
||||
if (err != HSA_STATUS_SUCCESS) {
|
||||
throw AMD::hsa_exception(err, "Agent creation failed.\nGetWallclockFrequency error.\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user