Skip to content
Snippets Groups Projects
Commit a6b26e5e authored by Andrew Stubbs's avatar Andrew Stubbs
Browse files

amdgcn: Refactor device settings into a def file


Almost all device-specific settings are now centralised into gcn-devices.def
for the compiler, mkoffload, and libgomp.  No longer will we have to touch 10
files in multiple places just to add another device without any exotic
features.  (New ISAs and devices with incompatible metadata will continue to
need a bit more.)

In order to remove the device-specific conditionals in the code a new value
HSACO_ATTR_UNSUPPORTED has been added, indicating that the assembler will
reject any setting of that option.

This incorporates some of Tobias's patch from March 2024.

Co-Authored-By: default avatarTobias Burnus <tburnus@baylibre.com>

gcc/ChangeLog:

	* config.gcc (amdgcn): Add gcn-device-macros.h to tm_file.
	Add gcn-tables.opt to extra_options.
	* config/gcn/gcn-hsa.h (NO_XNACK): Delete.
	(NO_SRAM_ECC): Delete.
	(SRAMOPT): Move definition to generated file gcn-device-macros.h.
	(XNACKOPT): Likewise.
	(ASM_SPEC): Redefine using generated values from gcn-device-macros.h.
	* config/gcn/gcn-opts.h
	(enum processor_type): Generate from gcn-devices.def.
	(TARGET_VEGA10): Delete.
	(TARGET_VEGA20): Delete.
	(TARGET_GFX908): Delete.
	(TARGET_GFX90a): Delete.
	(TARGET_GFX90c): Delete.
	(TARGET_GFX1030): Delete.
	(TARGET_GFX1036): Delete.
	(TARGET_GFX1100): Delete.
	(TARGET_GFX1103): Delete.
	(TARGET_XNACK): Redefine to allow for HSACO_ATTR_UNSUPPORTED.
	(enum hsaco_attr_type): Add HSACO_ATTR_UNSUPPORTED.
	(TARGET_TGSPLIT): New define.
	* config/gcn/gcn.cc (gcn_devices): New constant table.
	(gcn_option_override): Rework to use gcn_devices table.
	(gcn_omp_device_kind_arch_isa): Likewise.
	(output_file_start): Likewise.
	(gcn_hsa_declare_function_name): Rework using TARGET_* macros.
	* config/gcn/gcn.h (gcn_devices): Declare struct and table.
	(TARGET_CPU_CPP_BUILTINS): Rework using gcn_devices.
	* config/gcn/gcn.opt: Move enum data to generated file gcn-tables.opt.
	Use new names for the default values.
	* config/gcn/mkoffload.cc (EF_AMDGPU_MACH_AMDGCN_GFX900): Delete.
	(EF_AMDGPU_MACH_AMDGCN_GFX906): Delete.
	(EF_AMDGPU_MACH_AMDGCN_GFX908): Delete.
	(EF_AMDGPU_MACH_AMDGCN_GFX90a): Delete.
	(EF_AMDGPU_MACH_AMDGCN_GFX90c): Delete.
	(EF_AMDGPU_MACH_AMDGCN_GFX1030): Delete.
	(EF_AMDGPU_MACH_AMDGCN_GFX1036): Delete.
	(EF_AMDGPU_MACH_AMDGCN_GFX1100): Delete.
	(EF_AMDGPU_MACH_AMDGCN_GFX1103): Delete.
	(enum elf_arch_code): Define using gcn-devices.def.
	(get_arch): Rework using gcn-devices.def.
	(main): Rework using gcn-devices.def
	* config/gcn/t-gcn-hsa (gcn-tables.opt): Generate file.
	(gcn-device-macros.h): Generate file.
	* config/gcn/t-omp-device: Generate isa list from gcn-devices.def.
	* config/gcn/gcn-devices.def: New file.
	* config/gcn/gcn-tables.opt: New file.
	* config/gcn/gcn-tables.opt.urls: New file.
	* config/gcn/gen-gcn-device-macros.awk: New file.
	* config/gcn/gen-opt-tables.awk: New file.

libgomp/ChangeLog:

	* plugin/plugin-gcn.c (EF_AMDGPU_MACH): Generate from gcn-devices.def.
	(gcn_gfx803_s): Delete.
	(gcn_gfx900_s): Delete.
	(gcn_gfx906_s): Delete.
	(gcn_gfx908_s): Delete.
	(gcn_gfx90a_s): Delete.
	(gcn_gfx90c_s): Delete.
	(gcn_gfx1030_s): Delete.
	(gcn_gfx1036_s): Delete.
	(gcn_gfx1100_s): Delete.
	(gcn_gfx1103_s): Delete.
	(gcn_isa_name_len): Delete.
	(isa_hsa_name): Rename ...
	(isa_name): ... to this, and rework using gcn-devices.def.
	(isa_gcc_name): Delete.
	(isa_code): Rework using gcn-devices.def.
	(max_isa_vgprs): Rework using gcn-devices.def.
	(isa_matches_agent): Update isa_name usage.
	(GOMP_OFFLOAD_init_device): Improve diagnostic using the name.
parent c33d8c55
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