Skip to content
Snippets Groups Projects
Commit 1bdeebe6 authored by Tobias Burnus's avatar Tobias Burnus
Browse files

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.
parent 205515da
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment