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>
This commit is contained in:
1 parent
9bc38e2ee6
commit
412e386b50
6 files changed
+34
-7
No files matched your search
@@ -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