GCN: Initial generic-target handling, add more GCN macro defines
Newer llvm-mc assemblers support the gfx*-generic targets, permitting to generate code for all GPUs belonging to the same generation, even if not optimal code. This requires LLVM 19. This patch adds the compiler-side support for generic gfx and also adds -march=gfx10-3-generic and -march=gfx-11. However, those -march= are not documented nor used anywhere, yet. Disclaimer: Not tested (as my ROCm does not support it); additionally, libgomp/plugin/plugin-gcn.c has to be updated before it becomes useful. For better compatibility with LLVM's Clang, this commit additionally adds the macro definitions __GFX<9|10|11>__ for the architecture family, __AMDGPU__ besides the existing __AMDGCN__ and the two strings-containing macros __amdgcn_processor__ and __amdgcn_target_id__, where the former has '-' replaced by '_' but otherwise both contain the lower case name. For the new generic targets, the same happens, yielding, e.g., __gfx10_3_generic__. gcc/ChangeLog: * config/gcn/gcn-devices.def: Add generic version/flag as additional value and architecture family entry; update; add gfx-10-3-generic and gfx11-generic. * config/gcn/gcn-hsa.h (ABI_VERSION_SPEC): Remove (ASM_SPEC): Use generated ABI_VERSION_OPT instead. * config/gcn/gcn-tables.opt: Regenerate * config/gcn/gcn.h (gcn_device_def): Add generic_version and arch_family members. (TARGET_CPU_CPP_BUILTINS): Fix allocation bug, handle '-' in the name and add additional macro defines. * config/gcn/gcn.cc (gcn_devices): Handle it. * config/gcn/gen-gcn-device-macros.awk: Likewise; use ELF name for the macro name; generate ABI_VERSION_OPT. * config/gcn/mkoffload.cc (ELFABIVERSION_AMDGPU_HSA_V6, EF_AMDGPU_GENERIC_VERSION_V, EF_AMDGPU_GENERIC_VERSION_OFFSET, GET_GENERIC_VERSION, SET_GENERIC_VERSION): Define. (get_arch): Call SET_GENERIC_VERSION flag on elf_flags. (copy_early_debug_info): If the arch sets the generic version, use ELFABIVERSION_AMDGPU_HSA_V6.
Showing
- gcc/config/gcn/gcn-devices.def 62 additions, 9 deletionsgcc/config/gcn/gcn-devices.def
- gcc/config/gcn/gcn-hsa.h 1 addition, 8 deletionsgcc/config/gcn/gcn-hsa.h
- gcc/config/gcn/gcn-tables.opt 6 additions, 0 deletionsgcc/config/gcn/gcn-tables.opt
- gcc/config/gcn/gcn.cc 3 additions, 2 deletionsgcc/config/gcn/gcn.cc
- gcc/config/gcn/gcn.h 23 additions, 2 deletionsgcc/config/gcn/gcn.h
- gcc/config/gcn/gen-gcn-device-macros.awk 29 additions, 10 deletionsgcc/config/gcn/gen-gcn-device-macros.awk
- gcc/config/gcn/mkoffload.cc 23 additions, 1 deletiongcc/config/gcn/mkoffload.cc
Loading
Please register or sign in to comment