drm/amdkfd: add family_id property for kfd_node
Subsystems (3)
PATCH 1/1 drm/amdkfd: add family_id property for kfd_node
Then we can remove the burden of maintaining codes to parse family_id from gfx version in rocr, i.e., remove DevIDToAddrLibFamily().
--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 3 +++ drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 1 + 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +3 -0
@@ -507,6 +507,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, dev->node_props.vendor_id);sysfs_show_32bit_prop (buffer, offs,"device_id" , dev->node_props.device_id); +sysfs_show_32bit_prop (buffer, offs,"family_id" , + dev->node_props.family_id);sysfs_show_32bit_prop (buffer, offs,"location_id" , dev->node_props.location_id); sysfs_show_32bit_prop(buffer, offs, "domain",
@@ -1690,6 +1692,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) dev->node_props.gfx_target_version = gpu->device_info.gfx_target_version; dev->node_props.vendor_id = gpu->pdev->vendor; dev->node_props.device_id = gpu->pdev->device; + dev->node_props.family_id = gpu->adev->family; dev->node_props.capability |= ((dev->gpu->adev->rev_id <<HSA_CAP_ASIC_REVISION_SHIFT ) &HSA_CAP_ASIC_REVISION_MASK );
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1 -0
@@ -56,6 +56,7 @@ struct kfd_node_properties {uint32_t gfx_target_version;uint32_t vendor_id;uint32_t device_id; +uint32_t family_id;uint32_t location_id;uint32_t domain;uint32_t max_engine_clk_fcompute;
Signature · 1 line
2.25.1
Felix Kuehling
maintainerAm 2022-08-16 um 23:09 schrieb Lang Yu:
Quoted 3 lines
Then we can remove the burden of maintaining codes to parse
family_idfrom gfx version in rocr, i.e., removeDevIDToAddrLibFamily().
I'm OK with the change. But you won't be able to remove DevIDToAddrLibFamily as long as ROCr needs to support older kernels that don't provide this info.
Regards,
Felix
Quoted 40 lines
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 3 +++ drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 1 + 2 files changed, 4 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_topology.c +3
-0@@ -507,6 +507,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, dev->node_props.vendor_id);sysfs_show_32bit_prop (buffer, offs,"device_id" , dev->node_props.device_id); +sysfs_show_32bit_prop (buffer, offs,"family_id" , + dev->node_props.family_id);sysfs_show_32bit_prop (buffer, offs,"location_id" , dev->node_props.location_id); sysfs_show_32bit_prop(buffer, offs, "domain",@@ -1690,6 +1692,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) dev->node_props.gfx_target_version = gpu->device_info.gfx_target_version; dev->node_props.vendor_id = gpu->pdev->vendor; dev->node_props.device_id = gpu->pdev->device; + dev->node_props.family_id = gpu->adev->family; dev->node_props.capability |= ((dev->gpu->adev->rev_id <<HSA_CAP_ASIC_REVISION_SHIFT ) &HSA_CAP_ASIC_REVISION_MASK );drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1
-0@@ -56,6 +56,7 @@ struct kfd_node_properties {uint32_t gfx_target_version;uint32_t vendor_id;uint32_t device_id; +uint32_t family_id;uint32_t location_id;uint32_t domain;uint32_t max_engine_clk_fcompute;
Felix Kuehling
maintainerAm 2022-08-17 um 11:04 schrieb Felix Kuehling:
Quoted 6 lines
Am 2022-08-16 um 23:09 schrieb Lang Yu:
Quoted 3 lines
Then we can remove the burden of maintaining codes to parse
family_idfrom gfx version in rocr, i.e., removeDevIDToAddrLibFamily().I'm OK with the change. But you won't be able to remove DevIDToAddrLibFamily as long as ROCr needs to support older kernels that don't provide this info.
As an alternative you should be able to use the AMDGPU_INFO_DEV_INFO ioctl from the render node. The Thunk already has the render nodes of all the GPUs. This will work on older kernels as well and will allow you to remove DevIDToAddrLibFamily.
Regards,
Felix
Quoted 46 lines
Regards,
FelixQuoted 41 lines
Signed-off-by Lang Yu <[email protected]>---
drivers/gpu/drm/amd/amdkfd/kfd_topology.c| 3 +++drivers/gpu/drm/amd/amdkfd/kfd_topology.h| 1 +2 files changed, 4 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_topology.c +2
-0@@ -507,6 +507,8 @@ static ssize_t node_show(struct kobject *kobj,struct attribute *attr, dev->node_props.vendor_id); sysfs_show_32bit_prop(buffer, offs, "device_id", dev->node_props.device_id); + sysfs_show_32bit_prop(buffer, offs, "family_id", + dev->node_props.family_id); sysfs_show_32bit_prop(buffer, offs, "location_id", dev->node_props.location_id);sysfs_show_32bit_prop(buffer, offs, "domain",
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +1
-0@@ -1690,6 +1692,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) dev->node_props.gfx_target_version = gpu->device_info.gfx_target_version; dev->node_props.vendor_id = gpu->pdev->vendor; dev->node_props.device_id = gpu->pdev->device; + dev->node_props.family_id = gpu->adev->family;
dev->node_props.capability|= ((dev->gpu->adev->rev_id<<HSA_CAP_ASIC_REVISION_SHIFT) &HSA_CAP_ASIC_REVISION_MASK);drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1
-0@@ -56,6 +56,7 @@ struct kfd_node_properties { uint32_t gfx_target_version; uint32_t vendor_id; uint32_t device_id; + uint32_t family_id; uint32_t location_id; uint32_t domain; uint32_t max_engine_clk_fcompute;
Quoted 6 lines · Felix Kuehling
Am 2022-08-17 um 11:04 schrieb Felix Kuehling:
Quoted 5 lines
Am 2022-08-16 um 23:09 schrieb Lang Yu:
Quoted 3 lines
Then we can remove the burden of maintaining codes to parse
family_idfrom gfx version in rocr, i.e., removeDevIDToAddrLibFamily().
Quoted 7 lines
Quoted 3 lines
I'm OK with the change. But you won't be able to remove DevIDToAddrLibFamily as long as ROCr needs to support older kernels that don't provide this info.
As an alternative you should be able to use the
AMDGPU_INFO_DEV_INFOioctl from the render node. The Thunk already has the render nodes of all the GPUs. This will work on older kernels as well and will allow you to remove DevIDToAddrLibFamily.
Yes, topology_get_marketing_name() has called amdgpu_device_initialize() and got family id info in Thunk. I will put the family id info into HsaNodeProperties. Thanks for your suggestion.
Regards,
Lang
Quoted 53 lines
Regards,
FelixQuoted 49 lines
Regards,
FelixQuoted 44 lines
Signed-off-by Lang Yu <[email protected]>---
drivers/gpu/drm/amd/amdkfd/kfd_topology.c| 3 +++drivers/gpu/drm/amd/amdkfd/kfd_topology.h| 1 +2 files changed, 4 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_topology.c +2
-0@@ -507,6 +507,8 @@ static ssize_t node_show(struct kobject *kobj,struct attribute *attr, dev->node_props.vendor_id); sysfs_show_32bit_prop(buffer, offs, "device_id", dev->node_props.device_id); + sysfs_show_32bit_prop(buffer, offs, "family_id", + dev->node_props.family_id); sysfs_show_32bit_prop(buffer, offs, "location_id", dev->node_props.location_id);sysfs_show_32bit_prop(buffer, offs, "domain",
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0
-0@@ -1690,6 +1692,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
dev->node_props.gfx_target_version=gpu->device_info.gfx_target_version;dev->node_props.vendor_id=gpu->pdev->vendor;dev->node_props.device_id=gpu->pdev->device;
+dev->node_props.family_id=gpu->adev->family;dev->node_props.capability|= ((dev->gpu->adev->rev_id<<HSA_CAP_ASIC_REVISION_SHIFT) &HSA_CAP_ASIC_REVISION_MASK);drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1
-0@@ -56,6 +56,7 @@ struct kfd_node_properties { uint32_t gfx_target_version; uint32_t vendor_id; uint32_t device_id; + uint32_t family_id; uint32_t location_id; uint32_t domain; uint32_t max_engine_clk_fcompute;