[PATCH 2/3] Add AMDGPU generic targets
Simon Marchi
simon.marchi@polymtl.ca
Thu May 7 16:30:34 GMT 2026
On 11/7/25 8:37 AM, Jan Beulich wrote:
> On 31.10.2025 18:54, Luis Machado wrote:
>> --- a/bfd/archures.c
>> +++ b/bfd/archures.c
>> @@ -560,19 +560,24 @@ DESCRIPTION
>> .#define bfd_mach_loongarch64 2
>> . bfd_arch_amdgcn, {* AMDGCN *}
>> .#define bfd_mach_amdgcn_unknown 0x000
>> +.#define bfd_mach_amdgcn_gfx9_generic 0x051
>> .#define bfd_mach_amdgcn_gfx900 0x02c
>> .#define bfd_mach_amdgcn_gfx904 0x02e
>> .#define bfd_mach_amdgcn_gfx906 0x02f
>> .#define bfd_mach_amdgcn_gfx908 0x030
>> .#define bfd_mach_amdgcn_gfx90a 0x03f
>> +.#define bfd_mach_amdgcn_gfx9_4_generic 0x05f
>> .#define bfd_mach_amdgcn_gfx942 0x04c
>> .#define bfd_mach_amdgcn_gfx950 0x04f
>> +.#define bfd_mach_amdgcn_gfx10_1_generic 0x052
>> .#define bfd_mach_amdgcn_gfx1010 0x033
>> .#define bfd_mach_amdgcn_gfx1011 0x034
>> .#define bfd_mach_amdgcn_gfx1012 0x035
>> +.#define bfd_mach_amdgcn_gfx10_3_generic 0x053
>> .#define bfd_mach_amdgcn_gfx1030 0x036
>> .#define bfd_mach_amdgcn_gfx1031 0x037
>> .#define bfd_mach_amdgcn_gfx1032 0x038
>> +.#define bfd_mach_amdgcn_gfx11_generic 0x054
>> .#define bfd_mach_amdgcn_gfx1100 0x041
>> .#define bfd_mach_amdgcn_gfx1101 0x046
>> .#define bfd_mach_amdgcn_gfx1102 0x047
>> @@ -580,6 +585,7 @@ DESCRIPTION
>> .#define bfd_mach_amdgcn_gfx1151 0x04a
>> .#define bfd_mach_amdgcn_gfx1152 0x055
>> .#define bfd_mach_amdgcn_gfx1153 0x058
>> +.#define bfd_mach_amdgcn_gfx12_generic 0x059
>> .#define bfd_mach_amdgcn_gfx1200 0x048
>> .#define bfd_mach_amdgcn_gfx1201 0x04e
>
Hi Jan,
I will pick up this patch from Luis.
> Here I'm getting curious: Where are these numbers coming from? I'm asking in
> particular in order to understand whether there's a risk of future collisions.
The canonical source for these numbers is:
https://llvm.org/docs/AMDGPUUsage.html#amdgpu-ef-amdgpu-mach-table
> I further wonder by what criteria _generic entries are added (or not).
Generic processor versioning is described here:
https://llvm.org/docs/AMDGPUUsage.html#generic-processor-versioning
https://llvm.org/docs/AMDGPUUsage.html#amdgpu-generic-processor-table
We just mirror what is there. Whether a generic processor variant
exists is an engineering decision at AMD. As far as I understand, a
binary compiled for gfx12_generic, for example, will run on any gfx120*
card.
I will add those links as comments in the code (if it is allowed to have
external links), I think it will be useful for others who wonder where
these numbers come from in the future.
>
>> --- a/include/elf/amdgpu.h
>> +++ b/include/elf/amdgpu.h
>> @@ -79,6 +79,12 @@
>> #define EF_AMDGPU_MACH_AMDGCN_GFX942 0x04c
>> #define EF_AMDGPU_MACH_AMDGCN_GFX1201 0x04e
>> #define EF_AMDGPU_MACH_AMDGCN_GFX950 0x04f
>> +#define EF_AMDGPU_MACH_AMDGCN_GFX9_GENERIC 0x051
>> +#define EF_AMDGPU_MACH_AMDGCN_GFX10_1_GENERIC 0x052
>> +#define EF_AMDGPU_MACH_AMDGCN_GFX10_3_GENERIC 0x053
>> +#define EF_AMDGPU_MACH_AMDGCN_GFX11_GENERIC 0x054
>> +#define EF_AMDGPU_MACH_AMDGCN_GFX12_GENERIC 0x059
>> +#define EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC 0x05f
>
> Why is it that these constants aren't used in bfd/archures.c?
Good question, if we want to switch to that I'll make a patch on top of
all this.
Simon
More information about the Binutils
mailing list