Re: [PATCH v2 1/2] drm/amdkfd: Init the base cu processor id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Felix,

On 10/27/2022 3:07 AM, Felix Kuehling wrote:
> On 2022-10-26 05:03, Ma Jun wrote:
>> Init and save the base cu processor id for later use
>>
>> Signed-off-by: Ma Jun <Jun.Ma2@xxxxxxx>
>> ---
>>   drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 20 +++++++++++++-------
>>   drivers/gpu/drm/amd/amdkfd/kfd_priv.h |  3 +++
>>   2 files changed, 16 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
>> index d25ac9cbe5b2..35d09e29aafb 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
>> @@ -41,13 +41,18 @@ static uint32_t gpu_processor_id_low = 0x80001000;
>>    *	@total_cu_count - Total CUs present in the GPU including ones
>>    *			  masked off
>>    */
>> -static inline unsigned int get_and_inc_gpu_processor_id(
>> -				unsigned int total_cu_count)
>> +static inline void assign_gpu_processor_id(struct kfd_dev *kfd)
>>   {
>> -	int current_id = gpu_processor_id_low;
>> +	struct amdgpu_device *adev = kfd->adev;
>> +	unsigned int array_count = 0;
>> +	unsigned int total_cu_count = 0;
>> +
>> +	kfd->processor_id_low = gpu_processor_id_low;
> 
> This still seems backwards. And I don't think you need it. You can 
> access this after the topology has been parsed from the 
> kfd_topology_device (dev->node_props.simd_id_base). I see you're using 
> it in the next patch in kfd_fill_cache_non_crat_info, which has a 
> kfd_topology_device parameter. This should run after parsing the CRAT 
> tables, so the info should be available at that time.

Thanks. I will use dev->node_props.simd_id_base in the second patch and drop
this one.

Regards
Ma Jun
> 
> Regards,
>    Felix
> 
> 
>> +
>> +	array_count = adev->gfx.config.max_sh_per_se * adev->gfx.config.max_shader_engines;
>> +	total_cu_count = array_count * adev->gfx.config.max_cu_per_sh;
>>   
>>   	gpu_processor_id_low += total_cu_count;
>> -	return current_id;
>>   }
>>   
>>   /* Static table to describe GPU Cache information */
>> @@ -2223,7 +2228,6 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,
>>   	struct crat_subtype_computeunit *cu;
>>   	struct kfd_cu_info cu_info;
>>   	int avail_size = *size;
>> -	uint32_t total_num_of_cu;
>>   	int num_of_cache_entries = 0;
>>   	int cache_mem_filled = 0;
>>   	uint32_t nid = 0;
>> @@ -2275,8 +2279,10 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,
>>   	cu->wave_front_size = cu_info.wave_front_size;
>>   	cu->array_count = cu_info.num_shader_arrays_per_engine *
>>   		cu_info.num_shader_engines;
>> -	total_num_of_cu = (cu->array_count * cu_info.num_cu_per_sh);
>> -	cu->processor_id_low = get_and_inc_gpu_processor_id(total_num_of_cu);
>> +
>> +	assign_gpu_processor_id(kdev);
>> +	cu->processor_id_low = kdev->processor_id_low;
>> +
>>   	cu->num_cu_per_array = cu_info.num_cu_per_sh;
>>   	cu->max_slots_scatch_cu = cu_info.max_scratch_slots_per_cu;
>>   	cu->num_banks = cu_info.num_shader_engines;
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
>> index 182eb67edbc5..4c06b233472f 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
>> @@ -370,6 +370,9 @@ struct kfd_dev {
>>   
>>   	/* Track per device allocated watch points. */
>>   	uint32_t alloc_watch_ids;
>> +
>> +	/* cu processor id base */
>> +	unsigned int	processor_id_low;
>>   };
>>   
>>   struct kfd_ipc_obj;



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux