ac: add ac_get_family_name() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9974>
This commit is contained in:
Samuel Pitoiset 2021-04-01 14:29:46 +02:00 committed by Marge Bot
parent 9ca0e070e7
commit 11c1027730
4 changed files with 115 additions and 1 deletions

View file

@ -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 \

102
src/amd/common/amd_family.c Normal file
View file

@ -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");
}
}

View file

@ -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

View file

@ -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(