AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: amd-gfx@lists.freedesktop.org, Stella.Laurenzo@amd.com,
	Slobodan.Josic@amd.com, Filip.Jankovic@amd.com
Subject: Re: [RFC] amdkfd: Add GPU family name property to KFD topology
Date: Thu, 12 Feb 2026 18:22:50 -0600	[thread overview]
Message-ID: <654369dd-e5b5-45f6-b8ef-82b1bfe72141@amd.com> (raw)
In-Reply-To: <CADnq5_Ok927jfPuPw0OUg97Q2pa2uymQfeWFVrvuBfiMDCGXpA@mail.gmail.com>



On 2/11/2026 4:25 PM, Alex Deucher wrote:
> On Wed, Feb 11, 2026 at 5:14 PM Mario Limonciello
> <mario.limonciello@amd.com> wrote:
>>
>> Add a new 'gpu_family' property to the KFD topology sysfs interface that
>> exposes the GPU family name in ROCm TheRock format (e.g., gfx110X, gfx90X).
>>
>> The property is algorithmically derived from gfx_target_version, which
>> encodes the version as MMMNNRR (major.minor.revision). The family name
>> follows the pattern "gfx{major}{minor}X", making it easy for users and
>> tools to identify which ROCm compiler target to use.
>>
>> The property only appears for GFX9 and newer GPUs, as older generations
>> predate TheRock targets. Unknown or unsupported GPUs will not display
>> the property.
>>
>> Example usage:
>>    $ cat /sys/class/kfd/kfd/topology/nodes/1/properties | grep gpu_family
>>    gpu_family gfx115X
> 
> I would call this isa_version or isa_family.  gfx_target_version is
> the ISA version of a chip (i.e., the compiler target).  It's not the
> same as the GC IP version or the chip family.  That should help
> differentiate it and avoid confusion.
> 
> Alex
> 

Thanks, I guess of those options I would say based on how things are 
named in TheRock isa_family feels more logical.

But now I'm not sure if directionally this property will really be 
useful or not.  I noticed that the apt packages and wheels aren't 
actually split
up this way anymore.

>>
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> ---
>> The idea is that this can help a user figure out which wheels they need
>> for their hardware.
>>
>> Cc: Stella.Laurenzo@amd.com
>> Cc: Slobodan.Josic@amd.com
>> Cc: Filip.Jankovic@amd.com
>>   drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 37 +++++++++++++++++++++++
>>   drivers/gpu/drm/amd/amdkfd/kfd_topology.h |  1 +
>>   2 files changed, 38 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
>> index 08c63b4cc9a5f..ab029d87eb9ea 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
>> @@ -471,6 +471,9 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
>>                                dev->node_props.max_slots_scratch_cu);
>>          sysfs_show_32bit_prop(buffer, offs, "gfx_target_version",
>>                                dev->node_props.gfx_target_version);
>> +       if (dev->node_props.gpu_family[0])
>> +               sysfs_show_gen_prop(buffer, offs, "gpu_family %s\n",
>> +                                   dev->node_props.gpu_family);
>>          sysfs_show_32bit_prop(buffer, offs, "vendor_id",
>>                                dev->node_props.vendor_id);
>>          sysfs_show_32bit_prop(buffer, offs, "device_id",
>> @@ -2048,6 +2051,37 @@ static void kfd_topology_set_capabilities(struct kfd_topology_device *dev)
>>          kfd_topology_set_dbg_firmware_support(dev);
>>   }
>>
>> +/**
>> + * kfd_get_gpu_family_name - Get GPU family name from gfx_target_version
>> + * @gfx_target_version: Numeric GPU target version
>> + * @family_name: Output buffer for family name
>> + * @size: Size of output buffer
>> + *
>> + * Converts gfx_target_version to TheRock family format (e.g., "gfx110X").
>> + * The gfx_target_version encodes version as MMMNNRR where:
>> + *   MMM = major version
>> + *   NN  = minor version
>> + *   RR  = revision
>> + * Family format is "gfx{major}{minor}X", e.g., 110501 (11.5.01) -> "gfx115X"
>> + * If the version is not recognized, family_name is set to empty string.
>> + */
>> +static void kfd_get_gpu_family_name(uint32_t gfx_target_version,
>> +                                   char *family_name, size_t size)
>> +{
>> +       int major, minor;
>> +
>> +       /* Only support TheRock GPU families (GFX9 and newer) */
>> +       if (gfx_target_version < 90000) {
>> +               family_name[0] = '\0';
>> +               return;
>> +       }
>> +
>> +       major = gfx_target_version / 10000;
>> +       minor = (gfx_target_version / 100) % 100;
>> +
>> +       snprintf(family_name, size, "gfx%d%dX", major, minor);
>> +}
>> +
>>   int kfd_topology_add_device(struct kfd_node *gpu)
>>   {
>>          uint32_t gpu_id;
>> @@ -2105,6 +2139,9 @@ int kfd_topology_add_device(struct kfd_node *gpu)
>>
>>          dev->node_props.gfx_target_version =
>>                                  gpu->kfd->device_info.gfx_target_version;
>> +       kfd_get_gpu_family_name(dev->node_props.gfx_target_version,
>> +                               dev->node_props.gpu_family,
>> +                               sizeof(dev->node_props.gpu_family));
>>          dev->node_props.vendor_id = gpu->adev->pdev->vendor;
>>          dev->node_props.device_id = gpu->adev->pdev->device;
>>          dev->node_props.capability |=
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
>> index 3de8ec0043bb4..8e52dd59b53dd 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
>> @@ -81,6 +81,7 @@ struct kfd_node_properties {
>>          uint32_t eop_buffer_size;
>>          uint32_t debug_memory_size;
>>          char name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];
>> +       char gpu_family[8];  /* GPU family name in TheRock format (e.g., gfx110X) */
>>   };
>>
>>   struct kfd_mem_properties {
>> --
>> 2.53.0
>>


      reply	other threads:[~2026-02-13  0:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11 22:13 [RFC] amdkfd: Add GPU family name property to KFD topology Mario Limonciello
2026-02-11 22:25 ` Alex Deucher
2026-02-13  0:22   ` Mario Limonciello [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=654369dd-e5b5-45f6-b8ef-82b1bfe72141@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Filip.Jankovic@amd.com \
    --cc=Slobodan.Josic@amd.com \
    --cc=Stella.Laurenzo@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox