diff --git a/src/amd/Makefile.sources b/src/amd/Makefile.sources index 740ccc35b07..84289c38980 100644 --- a/src/amd/Makefile.sources +++ b/src/amd/Makefile.sources @@ -61,7 +61,8 @@ AMD_COMMON_FILES = \ common/ac_shadowed_regs.c \ common/ac_shadowed_regs.h \ common/ac_sqtt.c \ - common/ac_sqtt.h + common/ac_sqtt.h \ + common/amd_family.c AMD_COMMON_LLVM_FILES = \ llvm/ac_llvm_build.c \ diff --git a/src/amd/common/amd_family.c b/src/amd/common/amd_family.c new file mode 100644 index 00000000000..801cce1dbe2 --- /dev/null +++ b/src/amd/common/amd_family.c @@ -0,0 +1,102 @@ +/* + * Copyright © 2017 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS + * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + */ + +#include "amd_family.h" + +#include "util/macros.h" + +const char *ac_get_family_name(enum radeon_family family) +{ + switch (family) { + case CHIP_TAHITI: + return "tahiti"; + case CHIP_PITCAIRN: + return "pitcairn"; + case CHIP_VERDE: + return "verde"; + case CHIP_OLAND: + return "oland"; + case CHIP_HAINAN: + return "hainan"; + case CHIP_BONAIRE: + return "bonaire"; + case CHIP_KABINI: + return "kabini"; + case CHIP_KAVERI: + return "kaveri"; + case CHIP_HAWAII: + return "hawaii"; + case CHIP_TONGA: + return "tonga"; + case CHIP_ICELAND: + return "iceland"; + case CHIP_CARRIZO: + return "carrizo"; + case CHIP_FIJI: + return "fiji"; + case CHIP_STONEY: + return "stoney"; + case CHIP_POLARIS10: + return "polaris10"; + case CHIP_POLARIS11: + return "polaris11"; + case CHIP_POLARIS12: + return "polaris12"; + case CHIP_VEGAM: + return "vegam"; + case CHIP_VEGA10: + return "vega10"; + case CHIP_RAVEN: + return "raven"; + case CHIP_VEGA12: + return "vega12"; + case CHIP_VEGA20: + return "vega20"; + case CHIP_RAVEN2: + return "raven2"; + case CHIP_RENOIR: + return "renoir"; + case CHIP_ARCTURUS: + return "arcturus"; + case CHIP_ALDEBARAN: + return "aldebaran"; + case CHIP_NAVI10: + return "navi10"; + case CHIP_NAVI12: + return "navi12"; + case CHIP_NAVI14: + return "navi14"; + case CHIP_SIENNA_CICHLID: + return "sienna_cichlid"; + case CHIP_NAVY_FLOUNDER: + return "navy_flounder"; + case CHIP_DIMGREY_CAVEFISH: + return "dimgrey_cavefish"; + case CHIP_VANGOGH: + return "vangogh"; + default: + unreachable("Unknown GPU family"); + } +} diff --git a/src/amd/common/amd_family.h b/src/amd/common/amd_family.h index eff25221db3..31ec0fb8aab 100644 --- a/src/amd/common/amd_family.h +++ b/src/amd/common/amd_family.h @@ -24,6 +24,10 @@ #ifndef AMD_FAMILY_H #define AMD_FAMILY_H +#ifdef __cplusplus +extern "C" { +#endif + enum radeon_family { CHIP_UNKNOWN = 0, @@ -145,4 +149,10 @@ enum ring_type NUM_RING_TYPES, }; +const char *ac_get_family_name(enum radeon_family family); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/amd/common/meson.build b/src/amd/common/meson.build index 535fe0c09b6..6befc26f02b 100644 --- a/src/amd/common/meson.build +++ b/src/amd/common/meson.build @@ -90,6 +90,7 @@ amd_common_files = files( 'ac_nir.h', 'ac_nir_lower_esgs_io_to_mem.c', 'ac_nir_lower_tess_io_to_mem.c', + 'amd_family.c', ) libamd_common = static_library(