drm/amd/amdgpu: Define and implement a function that collects number of

waves that are in flight.

[Why]
Allow user to know how many compute units (CU) are in use at any given
moment.

[How]
Read registers of SQ that give number of waves that are in flight
of various queues. Use this information to determine number of CU's
in use.

Signed-off-by: Ramesh Errabolu <Ramesh.Errabolu@amd.com>
Reviewed-By: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Ramesh Errabolu
2020-09-29 12:14:08 -05:00
committed by Alex Deucher
parent 39ad082459
commit 43a4bc828c
2 changed files with 187 additions and 0 deletions

View File

@@ -212,6 +212,15 @@ struct tile_config {
* IH ring entry. This function allows the KFD ISR to get the VMID
* from the fault status register as early as possible.
*
* @get_cu_occupancy: Function pointer that returns to caller the number
* of wave fronts that are in flight for all of the queues of a process
* as identified by its pasid. It is important to note that the value
* returned by this function is a snapshot of current moment and cannot
* guarantee any minimum for the number of waves in-flight. This function
* is defined for devices that belong to GFX9 and later GFX families. Care
* must be taken in calling this function as it is not defined for devices
* that belong to GFX8 and below GFX families.
*
* This structure contains function pointers to services that the kgd driver
* provides to amdkfd driver.
*
@@ -286,6 +295,9 @@ struct kfd2kgd_calls {
void (*set_vm_context_page_table_base)(struct kgd_dev *kgd,
uint32_t vmid, uint64_t page_table_base);
uint32_t (*read_vmid_from_vmfault_reg)(struct kgd_dev *kgd);
void (*get_cu_occupancy)(struct kgd_dev *kgd, int pasid, int *wave_cnt,
int *max_waves_per_cu);
};
#endif /* KGD_KFD_INTERFACE_H_INCLUDED */