17ec681f3Smrg/* 27ec681f3Smrg * Copyright 2015 Advanced Micro Devices, Inc. 37ec681f3Smrg * All Rights Reserved. 47ec681f3Smrg * 57ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 67ec681f3Smrg * copy of this software and associated documentation files (the "Software"), 77ec681f3Smrg * to deal in the Software without restriction, including without limitation 87ec681f3Smrg * on the rights to use, copy, modify, merge, publish, distribute, sub 97ec681f3Smrg * license, and/or sell copies of the Software, and to permit persons to whom 107ec681f3Smrg * the Software is furnished to do so, subject to the following conditions: 117ec681f3Smrg * 127ec681f3Smrg * The above copyright notice and this permission notice (including the next 137ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the 147ec681f3Smrg * Software. 157ec681f3Smrg * 167ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 177ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 187ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 197ec681f3Smrg * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 207ec681f3Smrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 217ec681f3Smrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 227ec681f3Smrg * USE OR OTHER DEALINGS IN THE SOFTWARE. 237ec681f3Smrg */ 247ec681f3Smrg 257ec681f3Smrg#include "ac_gpu_info.h" 267ec681f3Smrg#include "ac_perfcounter.h" 277ec681f3Smrg 287ec681f3Smrg#include "util/u_memory.h" 297ec681f3Smrg#include "macros.h" 307ec681f3Smrg 317ec681f3Smrg/* cik_CB */ 327ec681f3Smrgstatic unsigned cik_CB_select0[] = { 337ec681f3Smrg R_037004_CB_PERFCOUNTER0_SELECT, 347ec681f3Smrg R_03700C_CB_PERFCOUNTER1_SELECT, 357ec681f3Smrg R_037010_CB_PERFCOUNTER2_SELECT, 367ec681f3Smrg R_037014_CB_PERFCOUNTER3_SELECT, 377ec681f3Smrg}; 387ec681f3Smrgstatic unsigned cik_CB_select1[] = { 397ec681f3Smrg R_037008_CB_PERFCOUNTER0_SELECT1, 407ec681f3Smrg}; 417ec681f3Smrgstatic struct ac_pc_block_base cik_CB = { 427ec681f3Smrg .gpu_block = CB, 437ec681f3Smrg .name = "CB", 447ec681f3Smrg .num_counters = 4, 457ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_INSTANCE_GROUPS, 467ec681f3Smrg 477ec681f3Smrg .select0 = cik_CB_select0, 487ec681f3Smrg .select1 = cik_CB_select1, 497ec681f3Smrg .counter0_lo = R_035018_CB_PERFCOUNTER0_LO, 507ec681f3Smrg 517ec681f3Smrg .num_spm_counters = 1, 527ec681f3Smrg .num_spm_wires = 2, 537ec681f3Smrg .spm_block_select = 0x0, 547ec681f3Smrg}; 557ec681f3Smrg 567ec681f3Smrg/* cik_CPC */ 577ec681f3Smrgstatic unsigned cik_CPC_select0[] = { 587ec681f3Smrg R_036024_CPC_PERFCOUNTER0_SELECT, 597ec681f3Smrg R_03600C_CPC_PERFCOUNTER1_SELECT, 607ec681f3Smrg}; 617ec681f3Smrgstatic unsigned cik_CPC_select1[] = { 627ec681f3Smrg R_036010_CPC_PERFCOUNTER0_SELECT1, 637ec681f3Smrg}; 647ec681f3Smrgstatic unsigned cik_CPC_counters[] = { 657ec681f3Smrg R_034018_CPC_PERFCOUNTER0_LO, 667ec681f3Smrg R_034010_CPC_PERFCOUNTER1_LO, 677ec681f3Smrg}; 687ec681f3Smrgstatic struct ac_pc_block_base cik_CPC = { 697ec681f3Smrg .gpu_block = CPC, 707ec681f3Smrg .name = "CPC", 717ec681f3Smrg .num_counters = 2, 727ec681f3Smrg 737ec681f3Smrg .select0 = cik_CPC_select0, 747ec681f3Smrg .select1 = cik_CPC_select1, 757ec681f3Smrg .counters = cik_CPC_counters, 767ec681f3Smrg 777ec681f3Smrg .num_spm_counters = 1, 787ec681f3Smrg .num_spm_wires = 2, 797ec681f3Smrg .spm_block_select = 0x1, 807ec681f3Smrg}; 817ec681f3Smrg 827ec681f3Smrg/* cik_CPF */ 837ec681f3Smrgstatic unsigned cik_CPF_select0[] = { 847ec681f3Smrg R_03601C_CPF_PERFCOUNTER0_SELECT, 857ec681f3Smrg R_036014_CPF_PERFCOUNTER1_SELECT, 867ec681f3Smrg}; 877ec681f3Smrgstatic unsigned cik_CPF_select1[] = { 887ec681f3Smrg R_036018_CPF_PERFCOUNTER0_SELECT1, 897ec681f3Smrg}; 907ec681f3Smrgstatic unsigned cik_CPF_counters[] = { 917ec681f3Smrg R_034028_CPF_PERFCOUNTER0_LO, 927ec681f3Smrg R_034020_CPF_PERFCOUNTER1_LO, 937ec681f3Smrg}; 947ec681f3Smrgstatic struct ac_pc_block_base cik_CPF = { 957ec681f3Smrg .gpu_block = CPF, 967ec681f3Smrg .name = "CPF", 977ec681f3Smrg .num_counters = 2, 987ec681f3Smrg 997ec681f3Smrg .select0 = cik_CPF_select0, 1007ec681f3Smrg .select1 = cik_CPF_select1, 1017ec681f3Smrg .counters = cik_CPF_counters, 1027ec681f3Smrg 1037ec681f3Smrg .num_spm_counters = 1, 1047ec681f3Smrg .num_spm_wires = 2, 1057ec681f3Smrg .spm_block_select = 0x2, 1067ec681f3Smrg}; 1077ec681f3Smrg 1087ec681f3Smrg/* cik_CPG */ 1097ec681f3Smrgstatic unsigned cik_CPG_select0[] = { 1107ec681f3Smrg R_036008_CPG_PERFCOUNTER0_SELECT, 1117ec681f3Smrg R_036000_CPG_PERFCOUNTER1_SELECT, 1127ec681f3Smrg}; 1137ec681f3Smrgstatic unsigned cik_CPG_select1[] = { 1147ec681f3Smrg R_036004_CPG_PERFCOUNTER0_SELECT1 1157ec681f3Smrg}; 1167ec681f3Smrgstatic unsigned cik_CPG_counters[] = { 1177ec681f3Smrg R_034008_CPG_PERFCOUNTER0_LO, 1187ec681f3Smrg R_034000_CPG_PERFCOUNTER1_LO, 1197ec681f3Smrg}; 1207ec681f3Smrgstatic struct ac_pc_block_base cik_CPG = { 1217ec681f3Smrg .gpu_block = CPG, 1227ec681f3Smrg .name = "CPG", 1237ec681f3Smrg .num_counters = 2, 1247ec681f3Smrg 1257ec681f3Smrg .select0 = cik_CPG_select0, 1267ec681f3Smrg .select1 = cik_CPG_select1, 1277ec681f3Smrg .counters = cik_CPG_counters, 1287ec681f3Smrg 1297ec681f3Smrg .num_spm_counters = 1, 1307ec681f3Smrg .num_spm_wires = 2, 1317ec681f3Smrg .spm_block_select = 0x0, 1327ec681f3Smrg}; 1337ec681f3Smrg 1347ec681f3Smrg/* cik_DB */ 1357ec681f3Smrgstatic unsigned cik_DB_select0[] = { 1367ec681f3Smrg R_037100_DB_PERFCOUNTER0_SELECT, 1377ec681f3Smrg R_037108_DB_PERFCOUNTER1_SELECT, 1387ec681f3Smrg R_037110_DB_PERFCOUNTER2_SELECT, 1397ec681f3Smrg R_037118_DB_PERFCOUNTER3_SELECT, 1407ec681f3Smrg}; 1417ec681f3Smrgstatic unsigned cik_DB_select1[] = { 1427ec681f3Smrg R_037104_DB_PERFCOUNTER0_SELECT1, 1437ec681f3Smrg R_03710C_DB_PERFCOUNTER1_SELECT1, 1447ec681f3Smrg}; 1457ec681f3Smrgstatic struct ac_pc_block_base cik_DB = { 1467ec681f3Smrg .gpu_block = DB, 1477ec681f3Smrg .name = "DB", 1487ec681f3Smrg .num_counters = 4, 1497ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_INSTANCE_GROUPS, 1507ec681f3Smrg 1517ec681f3Smrg .select0 = cik_DB_select0, 1527ec681f3Smrg .select1 = cik_DB_select1, 1537ec681f3Smrg .counter0_lo = R_035100_DB_PERFCOUNTER0_LO, 1547ec681f3Smrg 1557ec681f3Smrg .num_spm_counters = 2, 1567ec681f3Smrg .num_spm_wires = 3, 1577ec681f3Smrg .spm_block_select = 0x1, 1587ec681f3Smrg}; 1597ec681f3Smrg 1607ec681f3Smrg/* cik_GDS */ 1617ec681f3Smrgstatic unsigned cik_GDS_select0[] = { 1627ec681f3Smrg R_036A00_GDS_PERFCOUNTER0_SELECT, 1637ec681f3Smrg R_036A04_GDS_PERFCOUNTER1_SELECT, 1647ec681f3Smrg R_036A08_GDS_PERFCOUNTER2_SELECT, 1657ec681f3Smrg R_036A0C_GDS_PERFCOUNTER3_SELECT, 1667ec681f3Smrg}; 1677ec681f3Smrgstatic unsigned cik_GDS_select1[] = { 1687ec681f3Smrg R_036A10_GDS_PERFCOUNTER0_SELECT1, 1697ec681f3Smrg}; 1707ec681f3Smrgstatic struct ac_pc_block_base cik_GDS = { 1717ec681f3Smrg .gpu_block = GDS, 1727ec681f3Smrg .name = "GDS", 1737ec681f3Smrg .num_counters = 4, 1747ec681f3Smrg 1757ec681f3Smrg .select0 = cik_GDS_select0, 1767ec681f3Smrg .select1 = cik_GDS_select1, 1777ec681f3Smrg .counter0_lo = R_034A00_GDS_PERFCOUNTER0_LO, 1787ec681f3Smrg 1797ec681f3Smrg .num_spm_counters = 1, 1807ec681f3Smrg .num_spm_wires = 2, 1817ec681f3Smrg .spm_block_select = 0x3, 1827ec681f3Smrg}; 1837ec681f3Smrg 1847ec681f3Smrg/* cik_GRBM */ 1857ec681f3Smrgstatic unsigned cik_GRBM_select0[] = { 1867ec681f3Smrg R_036100_GRBM_PERFCOUNTER0_SELECT, 1877ec681f3Smrg R_036104_GRBM_PERFCOUNTER1_SELECT, 1887ec681f3Smrg}; 1897ec681f3Smrgstatic unsigned cik_GRBM_counters[] = { 1907ec681f3Smrg R_034100_GRBM_PERFCOUNTER0_LO, 1917ec681f3Smrg R_03410C_GRBM_PERFCOUNTER1_LO, 1927ec681f3Smrg}; 1937ec681f3Smrgstatic struct ac_pc_block_base cik_GRBM = { 1947ec681f3Smrg .gpu_block = GRBM, 1957ec681f3Smrg .name = "GRBM", 1967ec681f3Smrg .num_counters = 2, 1977ec681f3Smrg 1987ec681f3Smrg .select0 = cik_GRBM_select0, 1997ec681f3Smrg .counters = cik_GRBM_counters, 2007ec681f3Smrg}; 2017ec681f3Smrg 2027ec681f3Smrg/* cik_GRBMSE */ 2037ec681f3Smrgstatic unsigned cik_GRBMSE_select0[] = { 2047ec681f3Smrg R_036108_GRBM_SE0_PERFCOUNTER_SELECT, 2057ec681f3Smrg R_03610C_GRBM_SE1_PERFCOUNTER_SELECT, 2067ec681f3Smrg R_036110_GRBM_SE2_PERFCOUNTER_SELECT, 2077ec681f3Smrg R_036114_GRBM_SE3_PERFCOUNTER_SELECT, 2087ec681f3Smrg}; 2097ec681f3Smrgstatic struct ac_pc_block_base cik_GRBMSE = { 2107ec681f3Smrg .gpu_block = GRBMSE, 2117ec681f3Smrg .name = "GRBMSE", 2127ec681f3Smrg .num_counters = 4, 2137ec681f3Smrg 2147ec681f3Smrg .select0 = cik_GRBMSE_select0, 2157ec681f3Smrg .counter0_lo = R_034114_GRBM_SE0_PERFCOUNTER_LO, 2167ec681f3Smrg}; 2177ec681f3Smrg 2187ec681f3Smrg/* cik_IA */ 2197ec681f3Smrgstatic unsigned cik_IA_select0[] = { 2207ec681f3Smrg R_036210_IA_PERFCOUNTER0_SELECT, 2217ec681f3Smrg R_036214_IA_PERFCOUNTER1_SELECT, 2227ec681f3Smrg R_036218_IA_PERFCOUNTER2_SELECT, 2237ec681f3Smrg R_03621C_IA_PERFCOUNTER3_SELECT, 2247ec681f3Smrg}; 2257ec681f3Smrgstatic unsigned cik_IA_select1[] = { 2267ec681f3Smrg R_036220_IA_PERFCOUNTER0_SELECT1, 2277ec681f3Smrg}; 2287ec681f3Smrgstatic struct ac_pc_block_base cik_IA = { 2297ec681f3Smrg .gpu_block = IA, 2307ec681f3Smrg .name = "IA", 2317ec681f3Smrg .num_counters = 4, 2327ec681f3Smrg 2337ec681f3Smrg .select0 = cik_IA_select0, 2347ec681f3Smrg .select1 = cik_IA_select1, 2357ec681f3Smrg .counter0_lo = R_034220_IA_PERFCOUNTER0_LO, 2367ec681f3Smrg 2377ec681f3Smrg .num_spm_counters = 1, 2387ec681f3Smrg .num_spm_wires = 2, 2397ec681f3Smrg .spm_block_select = 0x6, 2407ec681f3Smrg}; 2417ec681f3Smrg 2427ec681f3Smrg/* cik_PA_SC */ 2437ec681f3Smrgstatic unsigned cik_PA_SC_select0[] = { 2447ec681f3Smrg R_036500_PA_SC_PERFCOUNTER0_SELECT, 2457ec681f3Smrg R_036508_PA_SC_PERFCOUNTER1_SELECT, 2467ec681f3Smrg R_03650C_PA_SC_PERFCOUNTER2_SELECT, 2477ec681f3Smrg R_036510_PA_SC_PERFCOUNTER3_SELECT, 2487ec681f3Smrg R_036514_PA_SC_PERFCOUNTER4_SELECT, 2497ec681f3Smrg R_036518_PA_SC_PERFCOUNTER5_SELECT, 2507ec681f3Smrg R_03651C_PA_SC_PERFCOUNTER6_SELECT, 2517ec681f3Smrg R_036520_PA_SC_PERFCOUNTER7_SELECT, 2527ec681f3Smrg}; 2537ec681f3Smrgstatic unsigned cik_PA_SC_select1[] = { 2547ec681f3Smrg R_036504_PA_SC_PERFCOUNTER0_SELECT1, 2557ec681f3Smrg}; 2567ec681f3Smrgstatic struct ac_pc_block_base cik_PA_SC = { 2577ec681f3Smrg .gpu_block = PA_SC, 2587ec681f3Smrg .name = "PA_SC", 2597ec681f3Smrg .num_counters = 8, 2607ec681f3Smrg .flags = AC_PC_BLOCK_SE, 2617ec681f3Smrg 2627ec681f3Smrg .select0 = cik_PA_SC_select0, 2637ec681f3Smrg .select1 = cik_PA_SC_select1, 2647ec681f3Smrg .counter0_lo = R_034500_PA_SC_PERFCOUNTER0_LO, 2657ec681f3Smrg 2667ec681f3Smrg .num_spm_counters = 1, 2677ec681f3Smrg .num_spm_wires = 2, 2687ec681f3Smrg .spm_block_select = 0x4, 2697ec681f3Smrg}; 2707ec681f3Smrg 2717ec681f3Smrg/* cik_PA_SU */ 2727ec681f3Smrgstatic unsigned cik_PA_SU_select0[] = { 2737ec681f3Smrg R_036400_PA_SU_PERFCOUNTER0_SELECT, 2747ec681f3Smrg R_036408_PA_SU_PERFCOUNTER1_SELECT, 2757ec681f3Smrg R_036410_PA_SU_PERFCOUNTER2_SELECT, 2767ec681f3Smrg R_036414_PA_SU_PERFCOUNTER3_SELECT, 2777ec681f3Smrg}; 2787ec681f3Smrgstatic unsigned cik_PA_SU_select1[] = { 2797ec681f3Smrg R_036404_PA_SU_PERFCOUNTER0_SELECT1, 2807ec681f3Smrg R_03640C_PA_SU_PERFCOUNTER1_SELECT1, 2817ec681f3Smrg}; 2827ec681f3Smrg/* According to docs, PA_SU counters are only 48 bits wide. */ 2837ec681f3Smrgstatic struct ac_pc_block_base cik_PA_SU = { 2847ec681f3Smrg .gpu_block = PA_SU, 2857ec681f3Smrg .name = "PA_SU", 2867ec681f3Smrg .num_counters = 4, 2877ec681f3Smrg .flags = AC_PC_BLOCK_SE, 2887ec681f3Smrg 2897ec681f3Smrg .select0 = cik_PA_SU_select0, 2907ec681f3Smrg .select1 = cik_PA_SU_select1, 2917ec681f3Smrg .counter0_lo = R_034400_PA_SU_PERFCOUNTER0_LO, 2927ec681f3Smrg 2937ec681f3Smrg .num_spm_counters = 2, 2947ec681f3Smrg .num_spm_wires = 3, 2957ec681f3Smrg .spm_block_select = 0x2, 2967ec681f3Smrg}; 2977ec681f3Smrg 2987ec681f3Smrg/* cik_SPI */ 2997ec681f3Smrgstatic unsigned cik_SPI_select0[] = { 3007ec681f3Smrg R_036600_SPI_PERFCOUNTER0_SELECT, 3017ec681f3Smrg R_036604_SPI_PERFCOUNTER1_SELECT, 3027ec681f3Smrg R_036608_SPI_PERFCOUNTER2_SELECT, 3037ec681f3Smrg R_03660C_SPI_PERFCOUNTER3_SELECT, 3047ec681f3Smrg R_036620_SPI_PERFCOUNTER4_SELECT, 3057ec681f3Smrg R_036624_SPI_PERFCOUNTER5_SELECT, 3067ec681f3Smrg}; 3077ec681f3Smrgstatic unsigned cik_SPI_select1[] = { 3087ec681f3Smrg R_036610_SPI_PERFCOUNTER0_SELECT1, 3097ec681f3Smrg R_036614_SPI_PERFCOUNTER1_SELECT1, 3107ec681f3Smrg R_036618_SPI_PERFCOUNTER2_SELECT1, 3117ec681f3Smrg R_03661C_SPI_PERFCOUNTER3_SELECT1 3127ec681f3Smrg}; 3137ec681f3Smrgstatic struct ac_pc_block_base cik_SPI = { 3147ec681f3Smrg .gpu_block = SPI, 3157ec681f3Smrg .name = "SPI", 3167ec681f3Smrg .num_counters = 6, 3177ec681f3Smrg .flags = AC_PC_BLOCK_SE, 3187ec681f3Smrg 3197ec681f3Smrg .select0 = cik_SPI_select0, 3207ec681f3Smrg .select1 = cik_SPI_select1, 3217ec681f3Smrg .counter0_lo = R_034604_SPI_PERFCOUNTER0_LO, 3227ec681f3Smrg 3237ec681f3Smrg .num_spm_counters = 4, 3247ec681f3Smrg .num_spm_wires = 8, 3257ec681f3Smrg .spm_block_select = 0x8, 3267ec681f3Smrg}; 3277ec681f3Smrg 3287ec681f3Smrg/* cik_SQ */ 3297ec681f3Smrgstatic unsigned cik_SQ_select0[] = { 3307ec681f3Smrg R_036700_SQ_PERFCOUNTER0_SELECT, 3317ec681f3Smrg R_036704_SQ_PERFCOUNTER1_SELECT, 3327ec681f3Smrg R_036708_SQ_PERFCOUNTER2_SELECT, 3337ec681f3Smrg R_03670C_SQ_PERFCOUNTER3_SELECT, 3347ec681f3Smrg R_036710_SQ_PERFCOUNTER4_SELECT, 3357ec681f3Smrg R_036714_SQ_PERFCOUNTER5_SELECT, 3367ec681f3Smrg R_036718_SQ_PERFCOUNTER6_SELECT, 3377ec681f3Smrg R_03671C_SQ_PERFCOUNTER7_SELECT, 3387ec681f3Smrg R_036720_SQ_PERFCOUNTER8_SELECT, 3397ec681f3Smrg R_036724_SQ_PERFCOUNTER9_SELECT, 3407ec681f3Smrg R_036728_SQ_PERFCOUNTER10_SELECT, 3417ec681f3Smrg R_03672C_SQ_PERFCOUNTER11_SELECT, 3427ec681f3Smrg R_036730_SQ_PERFCOUNTER12_SELECT, 3437ec681f3Smrg R_036734_SQ_PERFCOUNTER13_SELECT, 3447ec681f3Smrg R_036738_SQ_PERFCOUNTER14_SELECT, 3457ec681f3Smrg R_03673C_SQ_PERFCOUNTER15_SELECT, 3467ec681f3Smrg}; 3477ec681f3Smrgstatic struct ac_pc_block_base cik_SQ = { 3487ec681f3Smrg .gpu_block = SQ, 3497ec681f3Smrg .name = "SQ", 3507ec681f3Smrg .num_counters = 16, 3517ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_SHADER, 3527ec681f3Smrg 3537ec681f3Smrg .select0 = cik_SQ_select0, 3547ec681f3Smrg .select_or = S_036700_SQC_BANK_MASK(15) | S_036700_SQC_CLIENT_MASK(15) | S_036700_SIMD_MASK(15), 3557ec681f3Smrg .counter0_lo = R_034700_SQ_PERFCOUNTER0_LO, 3567ec681f3Smrg 3577ec681f3Smrg .num_spm_wires = 8, 3587ec681f3Smrg .spm_block_select = 0x9, 3597ec681f3Smrg}; 3607ec681f3Smrg 3617ec681f3Smrg/* cik_SX */ 3627ec681f3Smrgstatic unsigned cik_SX_select0[] = { 3637ec681f3Smrg R_036900_SX_PERFCOUNTER0_SELECT, 3647ec681f3Smrg R_036904_SX_PERFCOUNTER1_SELECT, 3657ec681f3Smrg R_036908_SX_PERFCOUNTER2_SELECT, 3667ec681f3Smrg R_03690C_SX_PERFCOUNTER3_SELECT, 3677ec681f3Smrg}; 3687ec681f3Smrgstatic unsigned cik_SX_select1[] = { 3697ec681f3Smrg R_036910_SX_PERFCOUNTER0_SELECT1, 3707ec681f3Smrg R_036914_SX_PERFCOUNTER1_SELECT1, 3717ec681f3Smrg}; 3727ec681f3Smrgstatic struct ac_pc_block_base cik_SX = { 3737ec681f3Smrg .gpu_block = SX, 3747ec681f3Smrg .name = "SX", 3757ec681f3Smrg .num_counters = 4, 3767ec681f3Smrg .flags = AC_PC_BLOCK_SE, 3777ec681f3Smrg 3787ec681f3Smrg .select0 = cik_SX_select0, 3797ec681f3Smrg .select1 = cik_SX_select1, 3807ec681f3Smrg .counter0_lo = R_034900_SX_PERFCOUNTER0_LO, 3817ec681f3Smrg 3827ec681f3Smrg .num_spm_counters = 2, 3837ec681f3Smrg .num_spm_wires = 4, 3847ec681f3Smrg .spm_block_select = 0x3, 3857ec681f3Smrg}; 3867ec681f3Smrg 3877ec681f3Smrg/* cik_TA */ 3887ec681f3Smrgstatic unsigned cik_TA_select0[] = { 3897ec681f3Smrg R_036B00_TA_PERFCOUNTER0_SELECT, 3907ec681f3Smrg R_036B08_TA_PERFCOUNTER1_SELECT, 3917ec681f3Smrg}; 3927ec681f3Smrgstatic unsigned cik_TA_select1[] = { 3937ec681f3Smrg R_036B04_TA_PERFCOUNTER0_SELECT1, 3947ec681f3Smrg}; 3957ec681f3Smrgstatic struct ac_pc_block_base cik_TA = { 3967ec681f3Smrg .gpu_block = TA, 3977ec681f3Smrg .name = "TA", 3987ec681f3Smrg .num_counters = 2, 3997ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_INSTANCE_GROUPS | AC_PC_BLOCK_SHADER_WINDOWED, 4007ec681f3Smrg 4017ec681f3Smrg .select0 = cik_TA_select0, 4027ec681f3Smrg .select1 = cik_TA_select1, 4037ec681f3Smrg .counter0_lo = R_034B00_TA_PERFCOUNTER0_LO, 4047ec681f3Smrg 4057ec681f3Smrg .num_spm_counters = 1, 4067ec681f3Smrg .num_spm_wires = 2, 4077ec681f3Smrg .spm_block_select = 0x5, 4087ec681f3Smrg}; 4097ec681f3Smrg 4107ec681f3Smrg/* cik_TD */ 4117ec681f3Smrgstatic unsigned cik_TD_select0[] = { 4127ec681f3Smrg R_036C00_TD_PERFCOUNTER0_SELECT, 4137ec681f3Smrg R_036C08_TD_PERFCOUNTER1_SELECT, 4147ec681f3Smrg}; 4157ec681f3Smrgstatic unsigned cik_TD_select1[] = { 4167ec681f3Smrg R_036C04_TD_PERFCOUNTER0_SELECT1, 4177ec681f3Smrg}; 4187ec681f3Smrgstatic struct ac_pc_block_base cik_TD = { 4197ec681f3Smrg .gpu_block = TD, 4207ec681f3Smrg .name = "TD", 4217ec681f3Smrg .num_counters = 2, 4227ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_INSTANCE_GROUPS | AC_PC_BLOCK_SHADER_WINDOWED, 4237ec681f3Smrg 4247ec681f3Smrg .select0 = cik_TD_select0, 4257ec681f3Smrg .select1 = cik_TD_select1, 4267ec681f3Smrg .counter0_lo = R_034C00_TD_PERFCOUNTER0_LO, 4277ec681f3Smrg 4287ec681f3Smrg .num_spm_counters = 1, 4297ec681f3Smrg .num_spm_wires = 2, 4307ec681f3Smrg .spm_block_select = 0x6, 4317ec681f3Smrg}; 4327ec681f3Smrg 4337ec681f3Smrg/* cik_TCA */ 4347ec681f3Smrgstatic unsigned cik_TCA_select0[] = { 4357ec681f3Smrg R_036E40_TCA_PERFCOUNTER0_SELECT, 4367ec681f3Smrg R_036E48_TCA_PERFCOUNTER1_SELECT, 4377ec681f3Smrg R_036E50_TCA_PERFCOUNTER2_SELECT, 4387ec681f3Smrg R_036E54_TCA_PERFCOUNTER3_SELECT, 4397ec681f3Smrg}; 4407ec681f3Smrgstatic unsigned cik_TCA_select1[] = { 4417ec681f3Smrg R_036E44_TCA_PERFCOUNTER0_SELECT1, 4427ec681f3Smrg R_036E4C_TCA_PERFCOUNTER1_SELECT1, 4437ec681f3Smrg}; 4447ec681f3Smrgstatic struct ac_pc_block_base cik_TCA = { 4457ec681f3Smrg .gpu_block = TCA, 4467ec681f3Smrg .name = "TCA", 4477ec681f3Smrg .num_counters = 4, 4487ec681f3Smrg .flags = AC_PC_BLOCK_INSTANCE_GROUPS, 4497ec681f3Smrg 4507ec681f3Smrg .select0 = cik_TCA_select0, 4517ec681f3Smrg .select1 = cik_TCA_select1, 4527ec681f3Smrg .counter0_lo = R_034E40_TCA_PERFCOUNTER0_LO, 4537ec681f3Smrg 4547ec681f3Smrg .num_spm_counters = 2, 4557ec681f3Smrg .num_spm_wires = 4, 4567ec681f3Smrg .spm_block_select = 0x5, 4577ec681f3Smrg}; 4587ec681f3Smrg 4597ec681f3Smrg/* cik_TCC */ 4607ec681f3Smrgstatic unsigned cik_TCC_select0[] = { 4617ec681f3Smrg R_036E00_TCC_PERFCOUNTER0_SELECT, 4627ec681f3Smrg R_036E08_TCC_PERFCOUNTER1_SELECT, 4637ec681f3Smrg R_036E10_TCC_PERFCOUNTER2_SELECT, 4647ec681f3Smrg R_036E14_TCC_PERFCOUNTER3_SELECT, 4657ec681f3Smrg}; 4667ec681f3Smrgstatic unsigned cik_TCC_select1[] = { 4677ec681f3Smrg R_036E04_TCC_PERFCOUNTER0_SELECT1, 4687ec681f3Smrg R_036E0C_TCC_PERFCOUNTER1_SELECT1, 4697ec681f3Smrg}; 4707ec681f3Smrgstatic struct ac_pc_block_base cik_TCC = { 4717ec681f3Smrg .gpu_block = TCC, 4727ec681f3Smrg .name = "TCC", 4737ec681f3Smrg .num_counters = 4, 4747ec681f3Smrg .flags = AC_PC_BLOCK_INSTANCE_GROUPS, 4757ec681f3Smrg 4767ec681f3Smrg .select0 = cik_TCC_select0, 4777ec681f3Smrg .select1 = cik_TCC_select1, 4787ec681f3Smrg .counter0_lo = R_034E00_TCC_PERFCOUNTER0_LO, 4797ec681f3Smrg 4807ec681f3Smrg .num_spm_counters = 2, 4817ec681f3Smrg .num_spm_wires = 4, 4827ec681f3Smrg .spm_block_select = 0x4, 4837ec681f3Smrg}; 4847ec681f3Smrg 4857ec681f3Smrg/* cik_TCP */ 4867ec681f3Smrgstatic unsigned cik_TCP_select0[] = { 4877ec681f3Smrg R_036D00_TCP_PERFCOUNTER0_SELECT, 4887ec681f3Smrg R_036D08_TCP_PERFCOUNTER1_SELECT, 4897ec681f3Smrg R_036D10_TCP_PERFCOUNTER2_SELECT, 4907ec681f3Smrg R_036D14_TCP_PERFCOUNTER3_SELECT, 4917ec681f3Smrg}; 4927ec681f3Smrgstatic unsigned cik_TCP_select1[] = { 4937ec681f3Smrg R_036D04_TCP_PERFCOUNTER0_SELECT1, 4947ec681f3Smrg R_036D0C_TCP_PERFCOUNTER1_SELECT1, 4957ec681f3Smrg}; 4967ec681f3Smrgstatic struct ac_pc_block_base cik_TCP = { 4977ec681f3Smrg .gpu_block = TCP, 4987ec681f3Smrg .name = "TCP", 4997ec681f3Smrg .num_counters = 4, 5007ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_INSTANCE_GROUPS | AC_PC_BLOCK_SHADER_WINDOWED, 5017ec681f3Smrg 5027ec681f3Smrg .select0 = cik_TCP_select0, 5037ec681f3Smrg .select1 = cik_TCP_select1, 5047ec681f3Smrg .counter0_lo = R_034D00_TCP_PERFCOUNTER0_LO, 5057ec681f3Smrg 5067ec681f3Smrg .num_spm_counters = 2, 5077ec681f3Smrg .num_spm_wires = 3, 5087ec681f3Smrg .spm_block_select = 0x7, 5097ec681f3Smrg}; 5107ec681f3Smrg 5117ec681f3Smrg/* cik_VGT */ 5127ec681f3Smrgstatic unsigned cik_VGT_select0[] = { 5137ec681f3Smrg R_036230_VGT_PERFCOUNTER0_SELECT, 5147ec681f3Smrg R_036234_VGT_PERFCOUNTER1_SELECT, 5157ec681f3Smrg R_036238_VGT_PERFCOUNTER2_SELECT, 5167ec681f3Smrg R_03623C_VGT_PERFCOUNTER3_SELECT, 5177ec681f3Smrg}; 5187ec681f3Smrgstatic unsigned cik_VGT_select1[] = { 5197ec681f3Smrg R_036240_VGT_PERFCOUNTER0_SELECT1, 5207ec681f3Smrg R_036244_VGT_PERFCOUNTER1_SELECT1, 5217ec681f3Smrg}; 5227ec681f3Smrgstatic struct ac_pc_block_base cik_VGT = { 5237ec681f3Smrg .gpu_block = VGT, 5247ec681f3Smrg .name = "VGT", 5257ec681f3Smrg .num_counters = 4, 5267ec681f3Smrg .flags = AC_PC_BLOCK_SE, 5277ec681f3Smrg 5287ec681f3Smrg .select0 = cik_VGT_select0, 5297ec681f3Smrg .select1 = cik_VGT_select1, 5307ec681f3Smrg .counter0_lo = R_034240_VGT_PERFCOUNTER0_LO, 5317ec681f3Smrg 5327ec681f3Smrg .num_spm_counters = 2, 5337ec681f3Smrg .num_spm_wires = 3, 5347ec681f3Smrg .spm_block_select = 0xa, 5357ec681f3Smrg}; 5367ec681f3Smrg 5377ec681f3Smrg/* cik_WD */ 5387ec681f3Smrgstatic unsigned cik_WD_select0[] = { 5397ec681f3Smrg R_036200_WD_PERFCOUNTER0_SELECT, 5407ec681f3Smrg R_036204_WD_PERFCOUNTER1_SELECT, 5417ec681f3Smrg R_036208_WD_PERFCOUNTER2_SELECT, 5427ec681f3Smrg R_03620C_WD_PERFCOUNTER3_SELECT, 5437ec681f3Smrg}; 5447ec681f3Smrgstatic struct ac_pc_block_base cik_WD = { 5457ec681f3Smrg .gpu_block = WD, 5467ec681f3Smrg .name = "WD", 5477ec681f3Smrg .num_counters = 4, 5487ec681f3Smrg 5497ec681f3Smrg .select0 = cik_WD_select0, 5507ec681f3Smrg .counter0_lo = R_034200_WD_PERFCOUNTER0_LO, 5517ec681f3Smrg}; 5527ec681f3Smrg 5537ec681f3Smrg/* cik_MC */ 5547ec681f3Smrgstatic struct ac_pc_block_base cik_MC = { 5557ec681f3Smrg .gpu_block = MC, 5567ec681f3Smrg .name = "MC", 5577ec681f3Smrg .num_counters = 4, 5587ec681f3Smrg}; 5597ec681f3Smrg 5607ec681f3Smrg/* cik_SRBM */ 5617ec681f3Smrgstatic struct ac_pc_block_base cik_SRBM = { 5627ec681f3Smrg .gpu_block = SRBM, 5637ec681f3Smrg .name = "SRBM", 5647ec681f3Smrg .num_counters = 2, 5657ec681f3Smrg}; 5667ec681f3Smrg 5677ec681f3Smrg/* gfx10_CHA */ 5687ec681f3Smrgstatic unsigned gfx10_CHA_select0[] = { 5697ec681f3Smrg R_037780_CHA_PERFCOUNTER0_SELECT, 5707ec681f3Smrg R_037788_CHA_PERFCOUNTER1_SELECT, 5717ec681f3Smrg R_03778C_CHA_PERFCOUNTER2_SELECT, 5727ec681f3Smrg R_037790_CHA_PERFCOUNTER3_SELECT, 5737ec681f3Smrg}; 5747ec681f3Smrgstatic unsigned gfx10_CHA_select1[] = { 5757ec681f3Smrg R_037784_CHA_PERFCOUNTER0_SELECT1, 5767ec681f3Smrg}; 5777ec681f3Smrgstatic struct ac_pc_block_base gfx10_CHA = { 5787ec681f3Smrg .gpu_block = CHA, 5797ec681f3Smrg .name = "CHA", 5807ec681f3Smrg .num_counters = 4, 5817ec681f3Smrg 5827ec681f3Smrg .select0 = gfx10_CHA_select0, 5837ec681f3Smrg .select1 = gfx10_CHA_select1, 5847ec681f3Smrg .counter0_lo = R_035800_CHA_PERFCOUNTER0_LO, 5857ec681f3Smrg 5867ec681f3Smrg .num_spm_counters = 1, 5877ec681f3Smrg .num_spm_wires = 2, 5887ec681f3Smrg .spm_block_select = 0xc, 5897ec681f3Smrg}; 5907ec681f3Smrg 5917ec681f3Smrg/* gfx10_CHCG */ 5927ec681f3Smrgstatic unsigned gfx10_CHCG_select0[] = { 5937ec681f3Smrg R_036F18_CHCG_PERFCOUNTER0_SELECT, 5947ec681f3Smrg R_036F20_CHCG_PERFCOUNTER1_SELECT, 5957ec681f3Smrg R_036F24_CHCG_PERFCOUNTER2_SELECT, 5967ec681f3Smrg R_036F28_CHCG_PERFCOUNTER3_SELECT, 5977ec681f3Smrg}; 5987ec681f3Smrgstatic unsigned gfx10_CHCG_select1[] = { 5997ec681f3Smrg R_036F1C_CHCG_PERFCOUNTER0_SELECT1, 6007ec681f3Smrg}; 6017ec681f3Smrgstatic struct ac_pc_block_base gfx10_CHCG = { 6027ec681f3Smrg .gpu_block = CHCG, 6037ec681f3Smrg .name = "CHCG", 6047ec681f3Smrg .num_counters = 4, 6057ec681f3Smrg 6067ec681f3Smrg .select0 = gfx10_CHCG_select0, 6077ec681f3Smrg .select1 = gfx10_CHCG_select1, 6087ec681f3Smrg .counter0_lo = R_034F20_CHCG_PERFCOUNTER0_LO, 6097ec681f3Smrg 6107ec681f3Smrg .num_spm_counters = 1, 6117ec681f3Smrg .num_spm_wires = 2, 6127ec681f3Smrg .spm_block_select = 0xe, 6137ec681f3Smrg}; 6147ec681f3Smrg 6157ec681f3Smrg/* gfx10_CHC */ 6167ec681f3Smrgstatic unsigned gfx10_CHC_select0[] = { 6177ec681f3Smrg R_036F00_CHC_PERFCOUNTER0_SELECT, 6187ec681f3Smrg R_036F08_CHC_PERFCOUNTER1_SELECT, 6197ec681f3Smrg R_036F0C_CHC_PERFCOUNTER2_SELECT, 6207ec681f3Smrg R_036F10_CHC_PERFCOUNTER3_SELECT, 6217ec681f3Smrg}; 6227ec681f3Smrgstatic unsigned gfx10_CHC_select1[] = { 6237ec681f3Smrg R_036F04_CHC_PERFCOUNTER0_SELECT1, 6247ec681f3Smrg}; 6257ec681f3Smrgstatic struct ac_pc_block_base gfx10_CHC = { 6267ec681f3Smrg .gpu_block = CHC, 6277ec681f3Smrg .name = "CHC", 6287ec681f3Smrg .num_counters = 4, 6297ec681f3Smrg 6307ec681f3Smrg .select0 = gfx10_CHC_select0, 6317ec681f3Smrg .select1 = gfx10_CHC_select1, 6327ec681f3Smrg .counter0_lo = R_034F00_CHC_PERFCOUNTER0_LO, 6337ec681f3Smrg 6347ec681f3Smrg .num_spm_counters = 1, 6357ec681f3Smrg .num_spm_wires = 2, 6367ec681f3Smrg .spm_block_select = 0xd, 6377ec681f3Smrg}; 6387ec681f3Smrg 6397ec681f3Smrg/* gfx10_DB */ 6407ec681f3Smrgstatic struct ac_pc_block_base gfx10_DB = { 6417ec681f3Smrg .gpu_block = DB, 6427ec681f3Smrg .name = "DB", 6437ec681f3Smrg .num_counters = 4, 6447ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_INSTANCE_GROUPS, 6457ec681f3Smrg 6467ec681f3Smrg .select0 = cik_DB_select0, 6477ec681f3Smrg .select1 = cik_DB_select1, 6487ec681f3Smrg .counter0_lo = R_035100_DB_PERFCOUNTER0_LO, 6497ec681f3Smrg 6507ec681f3Smrg .num_spm_counters = 2, 6517ec681f3Smrg .num_spm_wires = 4, 6527ec681f3Smrg .spm_block_select = 0x1, 6537ec681f3Smrg}; 6547ec681f3Smrg 6557ec681f3Smrg/* gfx10_GCR */ 6567ec681f3Smrgstatic unsigned gfx10_GCR_select0[] = { 6577ec681f3Smrg R_037580_GCR_PERFCOUNTER0_SELECT, 6587ec681f3Smrg R_037588_GCR_PERFCOUNTER1_SELECT, 6597ec681f3Smrg}; 6607ec681f3Smrgstatic unsigned gfx10_GCR_select1[] = { 6617ec681f3Smrg R_037584_GCR_PERFCOUNTER0_SELECT1, 6627ec681f3Smrg}; 6637ec681f3Smrgstatic struct ac_pc_block_base gfx10_GCR = { 6647ec681f3Smrg .gpu_block = GCR, 6657ec681f3Smrg .name = "GCR", 6667ec681f3Smrg .num_counters = 2, 6677ec681f3Smrg 6687ec681f3Smrg .select0 = gfx10_GCR_select0, 6697ec681f3Smrg .select1 = gfx10_GCR_select1, 6707ec681f3Smrg .counter0_lo = R_035480_GCR_PERFCOUNTER0_LO, 6717ec681f3Smrg 6727ec681f3Smrg .num_spm_counters = 1, 6737ec681f3Smrg .num_spm_wires = 2, 6747ec681f3Smrg .spm_block_select = 0x4, 6757ec681f3Smrg}; 6767ec681f3Smrg 6777ec681f3Smrg/* gfx10_GE */ 6787ec681f3Smrgstatic unsigned gfx10_GE_select0[] = { 6797ec681f3Smrg R_036200_GE_PERFCOUNTER0_SELECT, 6807ec681f3Smrg R_036208_GE_PERFCOUNTER1_SELECT, 6817ec681f3Smrg R_036210_GE_PERFCOUNTER2_SELECT, 6827ec681f3Smrg R_036218_GE_PERFCOUNTER3_SELECT, 6837ec681f3Smrg R_036220_GE_PERFCOUNTER4_SELECT, 6847ec681f3Smrg R_036228_GE_PERFCOUNTER5_SELECT, 6857ec681f3Smrg R_036230_GE_PERFCOUNTER6_SELECT, 6867ec681f3Smrg R_036238_GE_PERFCOUNTER7_SELECT, 6877ec681f3Smrg R_036240_GE_PERFCOUNTER8_SELECT, 6887ec681f3Smrg R_036248_GE_PERFCOUNTER9_SELECT, 6897ec681f3Smrg R_036250_GE_PERFCOUNTER10_SELECT, 6907ec681f3Smrg R_036258_GE_PERFCOUNTER11_SELECT, 6917ec681f3Smrg}; 6927ec681f3Smrgstatic unsigned gfx10_GE_select1[] = { 6937ec681f3Smrg R_036204_GE_PERFCOUNTER0_SELECT1, 6947ec681f3Smrg R_03620C_GE_PERFCOUNTER1_SELECT1, 6957ec681f3Smrg R_036214_GE_PERFCOUNTER2_SELECT1, 6967ec681f3Smrg R_03621C_GE_PERFCOUNTER3_SELECT1, 6977ec681f3Smrg}; 6987ec681f3Smrgstatic struct ac_pc_block_base gfx10_GE = { 6997ec681f3Smrg .gpu_block = GE, 7007ec681f3Smrg .name = "GE", 7017ec681f3Smrg .num_counters = 12, 7027ec681f3Smrg 7037ec681f3Smrg .select0 = gfx10_GE_select0, 7047ec681f3Smrg .select1 = gfx10_GE_select1, 7057ec681f3Smrg .counter0_lo = R_034200_GE_PERFCOUNTER0_LO, 7067ec681f3Smrg 7077ec681f3Smrg .num_spm_counters = 4, 7087ec681f3Smrg .num_spm_wires = 8, 7097ec681f3Smrg .spm_block_select = 0x6, 7107ec681f3Smrg}; 7117ec681f3Smrg 7127ec681f3Smrg/* gfx10_GL1A */ 7137ec681f3Smrgstatic unsigned gfx10_GL1A_select0[] = { 7147ec681f3Smrg R_037700_GL1A_PERFCOUNTER0_SELECT, 7157ec681f3Smrg R_037708_GL1A_PERFCOUNTER1_SELECT, 7167ec681f3Smrg R_03770C_GL1A_PERFCOUNTER2_SELECT, 7177ec681f3Smrg R_037710_GL1A_PERFCOUNTER3_SELECT, 7187ec681f3Smrg}; 7197ec681f3Smrgstatic unsigned gfx10_GL1A_select1[] = { 7207ec681f3Smrg R_037704_GL1A_PERFCOUNTER0_SELECT1, 7217ec681f3Smrg}; 7227ec681f3Smrgstatic struct ac_pc_block_base gfx10_GL1A = { 7237ec681f3Smrg .gpu_block = GL1A, 7247ec681f3Smrg .name = "GL1A", 7257ec681f3Smrg .num_counters = 4, 7267ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_SHADER_WINDOWED, 7277ec681f3Smrg 7287ec681f3Smrg .select0 = gfx10_GL1A_select0, 7297ec681f3Smrg .select1 = gfx10_GL1A_select1, 7307ec681f3Smrg .counter0_lo = R_035700_GL1A_PERFCOUNTER0_LO, 7317ec681f3Smrg 7327ec681f3Smrg .num_spm_counters = 1, 7337ec681f3Smrg .num_spm_wires = 2, 7347ec681f3Smrg .spm_block_select = 0xa, 7357ec681f3Smrg}; 7367ec681f3Smrg 7377ec681f3Smrg/* gfx10_GL1C */ 7387ec681f3Smrgstatic unsigned gfx10_GL1C_select0[] = { 7397ec681f3Smrg R_036E80_GL1C_PERFCOUNTER0_SELECT, 7407ec681f3Smrg R_036E88_GL1C_PERFCOUNTER1_SELECT, 7417ec681f3Smrg R_036E8C_GL1C_PERFCOUNTER2_SELECT, 7427ec681f3Smrg R_036E90_GL1C_PERFCOUNTER3_SELECT, 7437ec681f3Smrg}; 7447ec681f3Smrgstatic unsigned gfx10_GL1C_select1[] = { 7457ec681f3Smrg R_036E84_GL1C_PERFCOUNTER0_SELECT1, 7467ec681f3Smrg}; 7477ec681f3Smrgstatic struct ac_pc_block_base gfx10_GL1C = { 7487ec681f3Smrg .gpu_block = GL1C, 7497ec681f3Smrg .name = "GL1C", 7507ec681f3Smrg .num_counters = 4, 7517ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_SHADER_WINDOWED, 7527ec681f3Smrg 7537ec681f3Smrg .select0 = gfx10_GL1C_select0, 7547ec681f3Smrg .select1 = gfx10_GL1C_select1, 7557ec681f3Smrg .counter0_lo = R_034E80_GL1C_PERFCOUNTER0_LO, 7567ec681f3Smrg 7577ec681f3Smrg .num_spm_counters = 1, 7587ec681f3Smrg .num_spm_wires = 2, 7597ec681f3Smrg .spm_block_select = 0xc 7607ec681f3Smrg}; 7617ec681f3Smrg 7627ec681f3Smrg/* gfx10_GL2A */ 7637ec681f3Smrgstatic unsigned gfx10_GL2A_select0[] = { 7647ec681f3Smrg R_036E40_GL2A_PERFCOUNTER0_SELECT, 7657ec681f3Smrg R_036E48_GL2A_PERFCOUNTER1_SELECT, 7667ec681f3Smrg R_036E50_GL2A_PERFCOUNTER2_SELECT, 7677ec681f3Smrg R_036E54_GL2A_PERFCOUNTER3_SELECT, 7687ec681f3Smrg}; 7697ec681f3Smrgstatic unsigned gfx10_GL2A_select1[] = { 7707ec681f3Smrg R_036E44_GL2A_PERFCOUNTER0_SELECT1, 7717ec681f3Smrg R_036E4C_GL2A_PERFCOUNTER1_SELECT1, 7727ec681f3Smrg}; 7737ec681f3Smrgstatic struct ac_pc_block_base gfx10_GL2A = { 7747ec681f3Smrg .gpu_block = GL2A, 7757ec681f3Smrg .name = "GL2A", 7767ec681f3Smrg .num_counters = 4, 7777ec681f3Smrg 7787ec681f3Smrg .select0 = gfx10_GL2A_select0, 7797ec681f3Smrg .select1 = gfx10_GL2A_select1, 7807ec681f3Smrg .counter0_lo = R_034E40_GL2A_PERFCOUNTER0_LO, 7817ec681f3Smrg 7827ec681f3Smrg .num_spm_counters = 2, 7837ec681f3Smrg .num_spm_wires = 4, 7847ec681f3Smrg .spm_block_select = 0x7, 7857ec681f3Smrg}; 7867ec681f3Smrg 7877ec681f3Smrg/* gfx10_GL2C */ 7887ec681f3Smrgstatic unsigned gfx10_GL2C_select0[] = { 7897ec681f3Smrg R_036E00_GL2C_PERFCOUNTER0_SELECT, 7907ec681f3Smrg R_036E08_GL2C_PERFCOUNTER1_SELECT, 7917ec681f3Smrg R_036E10_GL2C_PERFCOUNTER2_SELECT, 7927ec681f3Smrg R_036E14_GL2C_PERFCOUNTER3_SELECT, 7937ec681f3Smrg}; 7947ec681f3Smrgstatic unsigned gfx10_GL2C_select1[] = { 7957ec681f3Smrg R_036E04_GL2C_PERFCOUNTER0_SELECT1, 7967ec681f3Smrg R_036E0C_GL2C_PERFCOUNTER1_SELECT1, 7977ec681f3Smrg}; 7987ec681f3Smrgstatic struct ac_pc_block_base gfx10_GL2C = { 7997ec681f3Smrg .gpu_block = GL2C, 8007ec681f3Smrg .name = "GL2C", 8017ec681f3Smrg .num_counters = 4, 8027ec681f3Smrg 8037ec681f3Smrg .select0 = gfx10_GL2C_select0, 8047ec681f3Smrg .select1 = gfx10_GL2C_select1, 8057ec681f3Smrg .counter0_lo = R_034E00_GL2C_PERFCOUNTER0_LO, 8067ec681f3Smrg 8077ec681f3Smrg .num_spm_counters = 2, 8087ec681f3Smrg .num_spm_wires = 4, 8097ec681f3Smrg .spm_block_select = 0x8, 8107ec681f3Smrg}; 8117ec681f3Smrg 8127ec681f3Smrg/* gfx10_PA_PH */ 8137ec681f3Smrgstatic unsigned gfx10_PA_PH_select0[] = { 8147ec681f3Smrg R_037600_PA_PH_PERFCOUNTER0_SELECT, 8157ec681f3Smrg R_037608_PA_PH_PERFCOUNTER1_SELECT, 8167ec681f3Smrg R_03760C_PA_PH_PERFCOUNTER2_SELECT, 8177ec681f3Smrg R_037610_PA_PH_PERFCOUNTER3_SELECT, 8187ec681f3Smrg R_037614_PA_PH_PERFCOUNTER4_SELECT, 8197ec681f3Smrg R_037618_PA_PH_PERFCOUNTER5_SELECT, 8207ec681f3Smrg R_03761C_PA_PH_PERFCOUNTER6_SELECT, 8217ec681f3Smrg R_037620_PA_PH_PERFCOUNTER7_SELECT, 8227ec681f3Smrg}; 8237ec681f3Smrgstatic unsigned gfx10_PA_PH_select1[] = { 8247ec681f3Smrg R_037604_PA_PH_PERFCOUNTER0_SELECT1, 8257ec681f3Smrg R_037640_PA_PH_PERFCOUNTER1_SELECT1, 8267ec681f3Smrg R_037644_PA_PH_PERFCOUNTER2_SELECT1, 8277ec681f3Smrg R_037648_PA_PH_PERFCOUNTER3_SELECT1, 8287ec681f3Smrg}; 8297ec681f3Smrgstatic struct ac_pc_block_base gfx10_PA_PH = { 8307ec681f3Smrg .gpu_block = PA_PH, 8317ec681f3Smrg .name = "PA_PH", 8327ec681f3Smrg .num_counters = 8, 8337ec681f3Smrg .flags = AC_PC_BLOCK_SE, 8347ec681f3Smrg 8357ec681f3Smrg .select0 = gfx10_PA_PH_select0, 8367ec681f3Smrg .select1 = gfx10_PA_PH_select1, 8377ec681f3Smrg .counter0_lo = R_035600_PA_PH_PERFCOUNTER0_LO, 8387ec681f3Smrg 8397ec681f3Smrg .num_spm_counters = 4, 8407ec681f3Smrg .num_spm_wires = 8, 8417ec681f3Smrg .spm_block_select = 0x5, 8427ec681f3Smrg}; 8437ec681f3Smrg 8447ec681f3Smrg/* gfx10_PA_SU */ 8457ec681f3Smrgstatic unsigned gfx10_PA_SU_select0[] = { 8467ec681f3Smrg R_036400_PA_SU_PERFCOUNTER0_SELECT, 8477ec681f3Smrg R_036408_PA_SU_PERFCOUNTER1_SELECT, 8487ec681f3Smrg R_036410_PA_SU_PERFCOUNTER2_SELECT, 8497ec681f3Smrg R_036418_PA_SU_PERFCOUNTER3_SELECT, 8507ec681f3Smrg}; 8517ec681f3Smrgstatic unsigned gfx10_PA_SU_select1[] = { 8527ec681f3Smrg R_036404_PA_SU_PERFCOUNTER0_SELECT1, 8537ec681f3Smrg R_03640C_PA_SU_PERFCOUNTER1_SELECT1, 8547ec681f3Smrg R_036414_PA_SU_PERFCOUNTER2_SELECT1, 8557ec681f3Smrg R_03641C_PA_SU_PERFCOUNTER3_SELECT1, 8567ec681f3Smrg}; 8577ec681f3Smrgstatic struct ac_pc_block_base gfx10_PA_SU = { 8587ec681f3Smrg .gpu_block = PA_SU, 8597ec681f3Smrg .name = "PA_SU", 8607ec681f3Smrg .num_counters = 4, 8617ec681f3Smrg .flags = AC_PC_BLOCK_SE, 8627ec681f3Smrg 8637ec681f3Smrg .select0 = gfx10_PA_SU_select0, 8647ec681f3Smrg .select1 = gfx10_PA_SU_select1, 8657ec681f3Smrg .counter0_lo = R_034400_PA_SU_PERFCOUNTER0_LO, 8667ec681f3Smrg 8677ec681f3Smrg .num_spm_counters = 4, 8687ec681f3Smrg .num_spm_wires = 8, 8697ec681f3Smrg .spm_block_select = 0x2, 8707ec681f3Smrg}; 8717ec681f3Smrg 8727ec681f3Smrg/* gfx10_RLC */ 8737ec681f3Smrgstatic unsigned gfx10_RLC_select0[] = { 8747ec681f3Smrg R_037304_RLC_PERFCOUNTER0_SELECT, 8757ec681f3Smrg R_037308_RLC_PERFCOUNTER1_SELECT, 8767ec681f3Smrg}; 8777ec681f3Smrgstatic struct ac_pc_block_base gfx10_RLC = { 8787ec681f3Smrg .gpu_block = RLC, 8797ec681f3Smrg .name = "RLC", 8807ec681f3Smrg .num_counters = 2, 8817ec681f3Smrg 8827ec681f3Smrg .select0 = gfx10_RLC_select0, 8837ec681f3Smrg .counter0_lo = R_035200_RLC_PERFCOUNTER0_LO, 8847ec681f3Smrg .num_spm_counters = 0, 8857ec681f3Smrg}; 8867ec681f3Smrg 8877ec681f3Smrg/* gfx10_RMI */ 8887ec681f3Smrgstatic unsigned gfx10_RMI_select0[] = { 8897ec681f3Smrg R_037400_RMI_PERFCOUNTER0_SELECT, 8907ec681f3Smrg R_037408_RMI_PERFCOUNTER1_SELECT, 8917ec681f3Smrg R_03740C_RMI_PERFCOUNTER2_SELECT, 8927ec681f3Smrg R_037414_RMI_PERFCOUNTER3_SELECT, 8937ec681f3Smrg}; 8947ec681f3Smrgstatic unsigned gfx10_RMI_select1[] = { 8957ec681f3Smrg R_037404_RMI_PERFCOUNTER0_SELECT1, 8967ec681f3Smrg R_037410_RMI_PERFCOUNTER2_SELECT1, 8977ec681f3Smrg}; 8987ec681f3Smrgstatic struct ac_pc_block_base gfx10_RMI = { 8997ec681f3Smrg .gpu_block = RMI, 9007ec681f3Smrg .name = "RMI", 9017ec681f3Smrg .num_counters = 4, 9027ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_INSTANCE_GROUPS, 9037ec681f3Smrg 9047ec681f3Smrg .select0 = gfx10_RMI_select0, 9057ec681f3Smrg .select1 = gfx10_RMI_select1, 9067ec681f3Smrg .counter0_lo = R_035300_RMI_PERFCOUNTER0_LO, 9077ec681f3Smrg 9087ec681f3Smrg .num_spm_counters = 2, 9097ec681f3Smrg .num_spm_wires = 2, 9107ec681f3Smrg .spm_block_select = 0xb, 9117ec681f3Smrg}; 9127ec681f3Smrg 9137ec681f3Smrg/* gfx10_SQ */ 9147ec681f3Smrgstatic struct ac_pc_block_base gfx10_SQ = { 9157ec681f3Smrg .gpu_block = SQ, 9167ec681f3Smrg .name = "SQ", 9177ec681f3Smrg .num_counters = 16, 9187ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_SHADER, 9197ec681f3Smrg 9207ec681f3Smrg .select0 = cik_SQ_select0, 9217ec681f3Smrg .select_or = S_036700_SQC_BANK_MASK(15), 9227ec681f3Smrg .counter0_lo = R_034700_SQ_PERFCOUNTER0_LO, 9237ec681f3Smrg 9247ec681f3Smrg .num_spm_wires = 16, 9257ec681f3Smrg .spm_block_select = 0x9, 9267ec681f3Smrg}; 9277ec681f3Smrg 9287ec681f3Smrg/* gfx10_TCP */ 9297ec681f3Smrgstatic struct ac_pc_block_base gfx10_TCP = { 9307ec681f3Smrg .gpu_block = TCP, 9317ec681f3Smrg .name = "TCP", 9327ec681f3Smrg .num_counters = 4, 9337ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_INSTANCE_GROUPS | AC_PC_BLOCK_SHADER_WINDOWED, 9347ec681f3Smrg 9357ec681f3Smrg .select0 = cik_TCP_select0, 9367ec681f3Smrg .select1 = cik_TCP_select1, 9377ec681f3Smrg .counter0_lo = R_034D00_TCP_PERFCOUNTER0_LO, 9387ec681f3Smrg 9397ec681f3Smrg .num_spm_counters = 2, 9407ec681f3Smrg .num_spm_wires = 4, 9417ec681f3Smrg .spm_block_select = 0x7, 9427ec681f3Smrg}; 9437ec681f3Smrg 9447ec681f3Smrg/* gfx10_UTCL1 */ 9457ec681f3Smrgstatic unsigned gfx10_UTCL1_select0[] = { 9467ec681f3Smrg R_03758C_UTCL1_PERFCOUNTER0_SELECT, 9477ec681f3Smrg R_037590_UTCL1_PERFCOUNTER1_SELECT, 9487ec681f3Smrg}; 9497ec681f3Smrgstatic struct ac_pc_block_base gfx10_UTCL1 = { 9507ec681f3Smrg .gpu_block = UTCL1, 9517ec681f3Smrg .name = "UTCL1", 9527ec681f3Smrg .num_counters = 2, 9537ec681f3Smrg .flags = AC_PC_BLOCK_SE | AC_PC_BLOCK_SHADER_WINDOWED, 9547ec681f3Smrg 9557ec681f3Smrg .select0 = gfx10_UTCL1_select0, 9567ec681f3Smrg .counter0_lo = R_035470_UTCL1_PERFCOUNTER0_LO, 9577ec681f3Smrg .num_spm_counters = 0, 9587ec681f3Smrg}; 9597ec681f3Smrg 9607ec681f3Smrg/* Both the number of instances and selectors varies between chips of the same 9617ec681f3Smrg * class. We only differentiate by class here and simply expose the maximum 9627ec681f3Smrg * number over all chips in a class. 9637ec681f3Smrg * 9647ec681f3Smrg * Unfortunately, GPUPerfStudio uses the order of performance counter groups 9657ec681f3Smrg * blindly once it believes it has identified the hardware, so the order of 9667ec681f3Smrg * blocks here matters. 9677ec681f3Smrg */ 9687ec681f3Smrgstatic struct ac_pc_block_gfxdescr groups_CIK[] = { 9697ec681f3Smrg {&cik_CB, 226}, {&cik_CPF, 17}, {&cik_DB, 257}, {&cik_GRBM, 34}, {&cik_GRBMSE, 15}, 9707ec681f3Smrg {&cik_PA_SU, 153}, {&cik_PA_SC, 395}, {&cik_SPI, 186}, {&cik_SQ, 252}, {&cik_SX, 32}, 9717ec681f3Smrg {&cik_TA, 111}, {&cik_TCA, 39, 2}, {&cik_TCC, 160}, {&cik_TD, 55}, {&cik_TCP, 154}, 9727ec681f3Smrg {&cik_GDS, 121}, {&cik_VGT, 140}, {&cik_IA, 22}, {&cik_MC, 22}, {&cik_SRBM, 19}, 9737ec681f3Smrg {&cik_WD, 22}, {&cik_CPG, 46}, {&cik_CPC, 22}, 9747ec681f3Smrg 9757ec681f3Smrg}; 9767ec681f3Smrg 9777ec681f3Smrgstatic struct ac_pc_block_gfxdescr groups_VI[] = { 9787ec681f3Smrg {&cik_CB, 405}, {&cik_CPF, 19}, {&cik_DB, 257}, {&cik_GRBM, 34}, {&cik_GRBMSE, 15}, 9797ec681f3Smrg {&cik_PA_SU, 154}, {&cik_PA_SC, 397}, {&cik_SPI, 197}, {&cik_SQ, 273}, {&cik_SX, 34}, 9807ec681f3Smrg {&cik_TA, 119}, {&cik_TCA, 35, 2}, {&cik_TCC, 192}, {&cik_TD, 55}, {&cik_TCP, 180}, 9817ec681f3Smrg {&cik_GDS, 121}, {&cik_VGT, 147}, {&cik_IA, 24}, {&cik_MC, 22}, {&cik_SRBM, 27}, 9827ec681f3Smrg {&cik_WD, 37}, {&cik_CPG, 48}, {&cik_CPC, 24}, 9837ec681f3Smrg 9847ec681f3Smrg}; 9857ec681f3Smrg 9867ec681f3Smrgstatic struct ac_pc_block_gfxdescr groups_gfx9[] = { 9877ec681f3Smrg {&cik_CB, 438}, {&cik_CPF, 32}, {&cik_DB, 328}, {&cik_GRBM, 38}, {&cik_GRBMSE, 16}, 9887ec681f3Smrg {&cik_PA_SU, 292}, {&cik_PA_SC, 491}, {&cik_SPI, 196}, {&cik_SQ, 374}, {&cik_SX, 208}, 9897ec681f3Smrg {&cik_TA, 119}, {&cik_TCA, 35, 2}, {&cik_TCC, 256}, {&cik_TD, 57}, {&cik_TCP, 85}, 9907ec681f3Smrg {&cik_GDS, 121}, {&cik_VGT, 148}, {&cik_IA, 32}, {&cik_WD, 58}, {&cik_CPG, 59}, 9917ec681f3Smrg {&cik_CPC, 35}, 9927ec681f3Smrg}; 9937ec681f3Smrg 9947ec681f3Smrgstatic struct ac_pc_block_gfxdescr groups_gfx10[] = { 9957ec681f3Smrg {&cik_CB, 461}, 9967ec681f3Smrg {&gfx10_CHA, 45}, 9977ec681f3Smrg {&gfx10_CHCG, 35}, 9987ec681f3Smrg {&gfx10_CHC, 35}, 9997ec681f3Smrg {&cik_CPC, 47}, 10007ec681f3Smrg {&cik_CPF, 40}, 10017ec681f3Smrg {&cik_CPG, 82}, 10027ec681f3Smrg {&gfx10_DB, 370}, 10037ec681f3Smrg {&gfx10_GCR, 94}, 10047ec681f3Smrg {&cik_GDS, 123}, 10057ec681f3Smrg {&gfx10_GE, 315}, 10067ec681f3Smrg {&gfx10_GL1A, 36}, 10077ec681f3Smrg {&gfx10_GL1C, 64}, 10087ec681f3Smrg {&gfx10_GL2A, 91}, 10097ec681f3Smrg {&gfx10_GL2C, 235}, 10107ec681f3Smrg {&cik_GRBM, 47}, 10117ec681f3Smrg {&cik_GRBMSE, 19}, 10127ec681f3Smrg {&gfx10_PA_PH, 960}, 10137ec681f3Smrg {&cik_PA_SC, 552}, 10147ec681f3Smrg {&gfx10_PA_SU, 266}, 10157ec681f3Smrg {&gfx10_RLC, 7}, 10167ec681f3Smrg {&gfx10_RMI, 258}, 10177ec681f3Smrg {&cik_SPI, 329}, 10187ec681f3Smrg {&gfx10_SQ, 509}, 10197ec681f3Smrg {&cik_SX, 225}, 10207ec681f3Smrg {&cik_TA, 226}, 10217ec681f3Smrg {&gfx10_TCP, 77}, 10227ec681f3Smrg {&cik_TD, 61}, 10237ec681f3Smrg {&gfx10_UTCL1, 15}, 10247ec681f3Smrg}; 10257ec681f3Smrg 10267ec681f3Smrgstruct ac_pc_block *ac_lookup_counter(const struct ac_perfcounters *pc, 10277ec681f3Smrg unsigned index, unsigned *base_gid, 10287ec681f3Smrg unsigned *sub_index) 10297ec681f3Smrg{ 10307ec681f3Smrg struct ac_pc_block *block = pc->blocks; 10317ec681f3Smrg unsigned bid; 10327ec681f3Smrg 10337ec681f3Smrg *base_gid = 0; 10347ec681f3Smrg for (bid = 0; bid < pc->num_blocks; ++bid, ++block) { 10357ec681f3Smrg unsigned total = block->num_groups * block->b->selectors; 10367ec681f3Smrg 10377ec681f3Smrg if (index < total) { 10387ec681f3Smrg *sub_index = index; 10397ec681f3Smrg return block; 10407ec681f3Smrg } 10417ec681f3Smrg 10427ec681f3Smrg index -= total; 10437ec681f3Smrg *base_gid += block->num_groups; 10447ec681f3Smrg } 10457ec681f3Smrg 10467ec681f3Smrg return NULL; 10477ec681f3Smrg} 10487ec681f3Smrg 10497ec681f3Smrgstruct ac_pc_block *ac_lookup_group(const struct ac_perfcounters *pc, 10507ec681f3Smrg unsigned *index) 10517ec681f3Smrg{ 10527ec681f3Smrg unsigned bid; 10537ec681f3Smrg struct ac_pc_block *block = pc->blocks; 10547ec681f3Smrg 10557ec681f3Smrg for (bid = 0; bid < pc->num_blocks; ++bid, ++block) { 10567ec681f3Smrg if (*index < block->num_groups) 10577ec681f3Smrg return block; 10587ec681f3Smrg *index -= block->num_groups; 10597ec681f3Smrg } 10607ec681f3Smrg 10617ec681f3Smrg return NULL; 10627ec681f3Smrg} 10637ec681f3Smrg 10647ec681f3Smrgbool ac_init_block_names(const struct radeon_info *info, 10657ec681f3Smrg const struct ac_perfcounters *pc, 10667ec681f3Smrg struct ac_pc_block *block) 10677ec681f3Smrg{ 10687ec681f3Smrg bool per_instance_groups = ac_pc_block_has_per_instance_groups(pc, block); 10697ec681f3Smrg bool per_se_groups = ac_pc_block_has_per_se_groups(pc, block); 10707ec681f3Smrg unsigned i, j, k; 10717ec681f3Smrg unsigned groups_shader = 1, groups_se = 1, groups_instance = 1; 10727ec681f3Smrg unsigned namelen; 10737ec681f3Smrg char *groupname; 10747ec681f3Smrg char *p; 10757ec681f3Smrg 10767ec681f3Smrg if (per_instance_groups) 10777ec681f3Smrg groups_instance = block->num_instances; 10787ec681f3Smrg if (per_se_groups) 10797ec681f3Smrg groups_se = info->max_se; 10807ec681f3Smrg if (block->b->b->flags & AC_PC_BLOCK_SHADER) 10817ec681f3Smrg groups_shader = ARRAY_SIZE(ac_pc_shader_type_bits); 10827ec681f3Smrg 10837ec681f3Smrg namelen = strlen(block->b->b->name); 10847ec681f3Smrg block->group_name_stride = namelen + 1; 10857ec681f3Smrg if (block->b->b->flags & AC_PC_BLOCK_SHADER) 10867ec681f3Smrg block->group_name_stride += 3; 10877ec681f3Smrg if (per_se_groups) { 10887ec681f3Smrg assert(groups_se <= 10); 10897ec681f3Smrg block->group_name_stride += 1; 10907ec681f3Smrg 10917ec681f3Smrg if (per_instance_groups) 10927ec681f3Smrg block->group_name_stride += 1; 10937ec681f3Smrg } 10947ec681f3Smrg if (per_instance_groups) { 10957ec681f3Smrg assert(groups_instance <= 100); 10967ec681f3Smrg block->group_name_stride += 2; 10977ec681f3Smrg } 10987ec681f3Smrg 10997ec681f3Smrg block->group_names = MALLOC(block->num_groups * block->group_name_stride); 11007ec681f3Smrg if (!block->group_names) 11017ec681f3Smrg return false; 11027ec681f3Smrg 11037ec681f3Smrg groupname = block->group_names; 11047ec681f3Smrg for (i = 0; i < groups_shader; ++i) { 11057ec681f3Smrg const char *shader_suffix = ac_pc_shader_type_suffixes[i]; 11067ec681f3Smrg unsigned shaderlen = strlen(shader_suffix); 11077ec681f3Smrg for (j = 0; j < groups_se; ++j) { 11087ec681f3Smrg for (k = 0; k < groups_instance; ++k) { 11097ec681f3Smrg strcpy(groupname, block->b->b->name); 11107ec681f3Smrg p = groupname + namelen; 11117ec681f3Smrg 11127ec681f3Smrg if (block->b->b->flags & AC_PC_BLOCK_SHADER) { 11137ec681f3Smrg strcpy(p, shader_suffix); 11147ec681f3Smrg p += shaderlen; 11157ec681f3Smrg } 11167ec681f3Smrg 11177ec681f3Smrg if (per_se_groups) { 11187ec681f3Smrg p += sprintf(p, "%d", j); 11197ec681f3Smrg if (per_instance_groups) 11207ec681f3Smrg *p++ = '_'; 11217ec681f3Smrg } 11227ec681f3Smrg 11237ec681f3Smrg if (per_instance_groups) 11247ec681f3Smrg p += sprintf(p, "%d", k); 11257ec681f3Smrg 11267ec681f3Smrg groupname += block->group_name_stride; 11277ec681f3Smrg } 11287ec681f3Smrg } 11297ec681f3Smrg } 11307ec681f3Smrg 11317ec681f3Smrg assert(block->b->selectors <= 1000); 11327ec681f3Smrg block->selector_name_stride = block->group_name_stride + 4; 11337ec681f3Smrg block->selector_names = 11347ec681f3Smrg MALLOC(block->num_groups * block->b->selectors * block->selector_name_stride); 11357ec681f3Smrg if (!block->selector_names) 11367ec681f3Smrg return false; 11377ec681f3Smrg 11387ec681f3Smrg groupname = block->group_names; 11397ec681f3Smrg p = block->selector_names; 11407ec681f3Smrg for (i = 0; i < block->num_groups; ++i) { 11417ec681f3Smrg for (j = 0; j < block->b->selectors; ++j) { 11427ec681f3Smrg sprintf(p, "%s_%03d", groupname, j); 11437ec681f3Smrg p += block->selector_name_stride; 11447ec681f3Smrg } 11457ec681f3Smrg groupname += block->group_name_stride; 11467ec681f3Smrg } 11477ec681f3Smrg 11487ec681f3Smrg return true; 11497ec681f3Smrg} 11507ec681f3Smrg 11517ec681f3Smrgbool ac_init_perfcounters(const struct radeon_info *info, 11527ec681f3Smrg bool separate_se, 11537ec681f3Smrg bool separate_instance, 11547ec681f3Smrg struct ac_perfcounters *pc) 11557ec681f3Smrg{ 11567ec681f3Smrg const struct ac_pc_block_gfxdescr *blocks; 11577ec681f3Smrg unsigned num_blocks; 11587ec681f3Smrg 11597ec681f3Smrg switch (info->chip_class) { 11607ec681f3Smrg case GFX7: 11617ec681f3Smrg blocks = groups_CIK; 11627ec681f3Smrg num_blocks = ARRAY_SIZE(groups_CIK); 11637ec681f3Smrg break; 11647ec681f3Smrg case GFX8: 11657ec681f3Smrg blocks = groups_VI; 11667ec681f3Smrg num_blocks = ARRAY_SIZE(groups_VI); 11677ec681f3Smrg break; 11687ec681f3Smrg case GFX9: 11697ec681f3Smrg blocks = groups_gfx9; 11707ec681f3Smrg num_blocks = ARRAY_SIZE(groups_gfx9); 11717ec681f3Smrg break; 11727ec681f3Smrg case GFX10: 11737ec681f3Smrg case GFX10_3: 11747ec681f3Smrg blocks = groups_gfx10; 11757ec681f3Smrg num_blocks = ARRAY_SIZE(groups_gfx10); 11767ec681f3Smrg break; 11777ec681f3Smrg case GFX6: 11787ec681f3Smrg default: 11797ec681f3Smrg return false; /* not implemented */ 11807ec681f3Smrg } 11817ec681f3Smrg 11827ec681f3Smrg pc->separate_se = separate_se; 11837ec681f3Smrg pc->separate_instance = separate_instance; 11847ec681f3Smrg 11857ec681f3Smrg pc->blocks = CALLOC(num_blocks, sizeof(struct ac_pc_block)); 11867ec681f3Smrg if (!pc->blocks) 11877ec681f3Smrg return false; 11887ec681f3Smrg pc->num_blocks = num_blocks; 11897ec681f3Smrg 11907ec681f3Smrg for (unsigned i = 0; i < num_blocks; i++) { 11917ec681f3Smrg struct ac_pc_block *block = &pc->blocks[i]; 11927ec681f3Smrg 11937ec681f3Smrg block->b = &blocks[i]; 11947ec681f3Smrg block->num_instances = MAX2(1, block->b->instances); 11957ec681f3Smrg 11967ec681f3Smrg if (!strcmp(block->b->b->name, "CB") || 11977ec681f3Smrg !strcmp(block->b->b->name, "DB") || 11987ec681f3Smrg !strcmp(block->b->b->name, "RMI")) 11997ec681f3Smrg block->num_instances = info->max_se; 12007ec681f3Smrg else if (!strcmp(block->b->b->name, "TCC")) 12017ec681f3Smrg block->num_instances = info->max_tcc_blocks; 12027ec681f3Smrg else if (!strcmp(block->b->b->name, "IA")) 12037ec681f3Smrg block->num_instances = MAX2(1, info->max_se / 2); 12047ec681f3Smrg else if (!strcmp(block->b->b->name, "TA") || 12057ec681f3Smrg !strcmp(block->b->b->name, "TCP") || 12067ec681f3Smrg !strcmp(block->b->b->name, "TD")) { 12077ec681f3Smrg block->num_instances = MAX2(1, info->max_good_cu_per_sa); 12087ec681f3Smrg } 12097ec681f3Smrg 12107ec681f3Smrg if (ac_pc_block_has_per_instance_groups(pc, block)) { 12117ec681f3Smrg block->num_groups = block->num_instances; 12127ec681f3Smrg } else { 12137ec681f3Smrg block->num_groups = 1; 12147ec681f3Smrg } 12157ec681f3Smrg 12167ec681f3Smrg if (ac_pc_block_has_per_se_groups(pc, block)) 12177ec681f3Smrg block->num_groups *= info->max_se; 12187ec681f3Smrg if (block->b->b->flags & AC_PC_BLOCK_SHADER) 12197ec681f3Smrg block->num_groups *= ARRAY_SIZE(ac_pc_shader_type_bits); 12207ec681f3Smrg 12217ec681f3Smrg pc->num_groups += block->num_groups; 12227ec681f3Smrg } 12237ec681f3Smrg 12247ec681f3Smrg return true; 12257ec681f3Smrg} 12267ec681f3Smrg 12277ec681f3Smrgvoid ac_destroy_perfcounters(struct ac_perfcounters *pc) 12287ec681f3Smrg{ 12297ec681f3Smrg if (!pc) 12307ec681f3Smrg return; 12317ec681f3Smrg 12327ec681f3Smrg for (unsigned i = 0; i < pc->num_blocks; ++i) { 12337ec681f3Smrg FREE(pc->blocks[i].group_names); 12347ec681f3Smrg FREE(pc->blocks[i].selector_names); 12357ec681f3Smrg } 12367ec681f3Smrg FREE(pc->blocks); 12377ec681f3Smrg} 1238