2 * Copyright 2015 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * Nicolai Hähnle <nicolai.haehnle@amd.com>
28 #include "radeon/r600_cs.h"
29 #include "radeon/r600_query.h"
30 #include "util/u_memory.h"
35 enum si_pc_reg_layout
{
36 /* All secondary selector dwords follow as one block after the primary
37 * selector dwords for the counters that have secondary selectors.
39 SI_PC_MULTI_BLOCK
= 0,
41 /* Each secondary selector dword follows immediately afters the
42 * corresponding primary.
44 SI_PC_MULTI_ALTERNATE
= 1,
46 /* All secondary selector dwords follow as one block after all primary
51 /* Free-form arrangement of selector registers. */
52 SI_PC_MULTI_CUSTOM
= 3,
56 /* Registers are laid out in decreasing rather than increasing order. */
57 SI_PC_REG_REVERSE
= 4,
62 struct si_pc_block_base
{
64 unsigned num_counters
;
78 struct si_pc_block_base
*b
;
83 /* The order is chosen to be compatible with GPUPerfStudio's hardcoding of
84 * performance counter group IDs.
86 static const char * const si_pc_shader_type_suffixes
[] = {
87 "", "_ES", "_GS", "_VS", "_PS", "_LS", "_HS", "_CS"
90 static const unsigned si_pc_shader_type_bits
[] = {
101 static struct si_pc_block_base cik_CB
= {
104 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
,
106 .select0
= R_037000_CB_PERFCOUNTER_FILTER
,
107 .counter0_lo
= R_035018_CB_PERFCOUNTER0_LO
,
110 .layout
= SI_PC_MULTI_ALTERNATE
,
113 static unsigned cik_CPC_select
[] = {
114 R_036024_CPC_PERFCOUNTER0_SELECT
,
115 R_036010_CPC_PERFCOUNTER0_SELECT1
,
116 R_03600C_CPC_PERFCOUNTER1_SELECT
,
118 static struct si_pc_block_base cik_CPC
= {
122 .select
= cik_CPC_select
,
123 .counter0_lo
= R_034018_CPC_PERFCOUNTER0_LO
,
125 .layout
= SI_PC_MULTI_CUSTOM
| SI_PC_REG_REVERSE
,
128 static struct si_pc_block_base cik_CPF
= {
132 .select0
= R_03601C_CPF_PERFCOUNTER0_SELECT
,
133 .counter0_lo
= R_034028_CPF_PERFCOUNTER0_LO
,
135 .layout
= SI_PC_MULTI_ALTERNATE
| SI_PC_REG_REVERSE
,
138 static struct si_pc_block_base cik_CPG
= {
142 .select0
= R_036008_CPG_PERFCOUNTER0_SELECT
,
143 .counter0_lo
= R_034008_CPG_PERFCOUNTER0_LO
,
145 .layout
= SI_PC_MULTI_ALTERNATE
| SI_PC_REG_REVERSE
,
148 static struct si_pc_block_base cik_DB
= {
151 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
,
153 .select0
= R_037100_DB_PERFCOUNTER0_SELECT
,
154 .counter0_lo
= R_035100_DB_PERFCOUNTER0_LO
,
155 .num_multi
= 3, // really only 2, but there's a gap between registers
156 .layout
= SI_PC_MULTI_ALTERNATE
,
159 static struct si_pc_block_base cik_GDS
= {
163 .select0
= R_036A00_GDS_PERFCOUNTER0_SELECT
,
164 .counter0_lo
= R_034A00_GDS_PERFCOUNTER0_LO
,
166 .layout
= SI_PC_MULTI_TAIL
,
169 static unsigned cik_GRBM_counters
[] = {
170 R_034100_GRBM_PERFCOUNTER0_LO
,
171 R_03410C_GRBM_PERFCOUNTER1_LO
,
173 static struct si_pc_block_base cik_GRBM
= {
177 .select0
= R_036100_GRBM_PERFCOUNTER0_SELECT
,
178 .counters
= cik_GRBM_counters
,
181 static struct si_pc_block_base cik_GRBMSE
= {
185 .select0
= R_036108_GRBM_SE0_PERFCOUNTER_SELECT
,
186 .counter0_lo
= R_034114_GRBM_SE0_PERFCOUNTER_LO
,
189 static struct si_pc_block_base cik_IA
= {
193 .select0
= R_036210_IA_PERFCOUNTER0_SELECT
,
194 .counter0_lo
= R_034220_IA_PERFCOUNTER0_LO
,
196 .layout
= SI_PC_MULTI_TAIL
,
199 static struct si_pc_block_base cik_PA_SC
= {
202 .flags
= R600_PC_BLOCK_SE
,
204 .select0
= R_036500_PA_SC_PERFCOUNTER0_SELECT
,
205 .counter0_lo
= R_034500_PA_SC_PERFCOUNTER0_LO
,
207 .layout
= SI_PC_MULTI_ALTERNATE
,
210 /* According to docs, PA_SU counters are only 48 bits wide. */
211 static struct si_pc_block_base cik_PA_SU
= {
214 .flags
= R600_PC_BLOCK_SE
,
216 .select0
= R_036400_PA_SU_PERFCOUNTER0_SELECT
,
217 .counter0_lo
= R_034400_PA_SU_PERFCOUNTER0_LO
,
219 .layout
= SI_PC_MULTI_ALTERNATE
,
222 static struct si_pc_block_base cik_SPI
= {
225 .flags
= R600_PC_BLOCK_SE
,
227 .select0
= R_036600_SPI_PERFCOUNTER0_SELECT
,
228 .counter0_lo
= R_034604_SPI_PERFCOUNTER0_LO
,
230 .layout
= SI_PC_MULTI_BLOCK
,
233 static struct si_pc_block_base cik_SQ
= {
236 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_SHADER
,
238 .select0
= R_036700_SQ_PERFCOUNTER0_SELECT
,
239 .select_or
= S_036700_SQC_BANK_MASK(15) |
240 S_036700_SQC_CLIENT_MASK(15) |
241 S_036700_SIMD_MASK(15),
242 .counter0_lo
= R_034700_SQ_PERFCOUNTER0_LO
,
245 static struct si_pc_block_base cik_SX
= {
248 .flags
= R600_PC_BLOCK_SE
,
250 .select0
= R_036900_SX_PERFCOUNTER0_SELECT
,
251 .counter0_lo
= R_034900_SX_PERFCOUNTER0_LO
,
253 .layout
= SI_PC_MULTI_TAIL
,
256 static struct si_pc_block_base cik_TA
= {
259 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
| R600_PC_BLOCK_SHADER_WINDOWED
,
261 .select0
= R_036B00_TA_PERFCOUNTER0_SELECT
,
262 .counter0_lo
= R_034B00_TA_PERFCOUNTER0_LO
,
264 .layout
= SI_PC_MULTI_ALTERNATE
,
267 static struct si_pc_block_base cik_TD
= {
270 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
| R600_PC_BLOCK_SHADER_WINDOWED
,
272 .select0
= R_036C00_TD_PERFCOUNTER0_SELECT
,
273 .counter0_lo
= R_034C00_TD_PERFCOUNTER0_LO
,
275 .layout
= SI_PC_MULTI_ALTERNATE
,
278 static struct si_pc_block_base cik_TCA
= {
281 .flags
= R600_PC_BLOCK_INSTANCE_GROUPS
,
283 .select0
= R_036E40_TCA_PERFCOUNTER0_SELECT
,
284 .counter0_lo
= R_034E40_TCA_PERFCOUNTER0_LO
,
286 .layout
= SI_PC_MULTI_ALTERNATE
,
289 static struct si_pc_block_base cik_TCC
= {
292 .flags
= R600_PC_BLOCK_INSTANCE_GROUPS
,
294 .select0
= R_036E00_TCC_PERFCOUNTER0_SELECT
,
295 .counter0_lo
= R_034E00_TCC_PERFCOUNTER0_LO
,
297 .layout
= SI_PC_MULTI_ALTERNATE
,
300 static struct si_pc_block_base cik_TCP
= {
303 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
| R600_PC_BLOCK_SHADER_WINDOWED
,
305 .select0
= R_036D00_TCP_PERFCOUNTER0_SELECT
,
306 .counter0_lo
= R_034D00_TCP_PERFCOUNTER0_LO
,
308 .layout
= SI_PC_MULTI_ALTERNATE
,
311 static struct si_pc_block_base cik_VGT
= {
314 .flags
= R600_PC_BLOCK_SE
,
316 .select0
= R_036230_VGT_PERFCOUNTER0_SELECT
,
317 .counter0_lo
= R_034240_VGT_PERFCOUNTER0_LO
,
319 .layout
= SI_PC_MULTI_TAIL
,
322 static struct si_pc_block_base cik_WD
= {
326 .select0
= R_036200_WD_PERFCOUNTER0_SELECT
,
327 .counter0_lo
= R_034200_WD_PERFCOUNTER0_LO
,
330 static struct si_pc_block_base cik_MC
= {
334 .layout
= SI_PC_FAKE
,
337 static struct si_pc_block_base cik_SRBM
= {
341 .layout
= SI_PC_FAKE
,
344 /* Both the number of instances and selectors varies between chips of the same
345 * class. We only differentiate by class here and simply expose the maximum
346 * number over all chips in a class.
348 * Unfortunately, GPUPerfStudio uses the order of performance counter groups
349 * blindly once it believes it has identified the hardware, so the order of
350 * blocks here matters.
352 static struct si_pc_block groups_CIK
[] = {
363 { &cik_TA
, 111, 11 },
365 { &cik_TCC
, 160, 16 },
367 { &cik_TCP
, 154, 11 },
379 static struct si_pc_block groups_VI
[] = {
390 { &cik_TA
, 119, 16 },
392 { &cik_TCC
, 192, 16 },
394 { &cik_TCP
, 180, 16 },
406 static void si_pc_get_size(struct r600_perfcounter_block
*group
,
407 unsigned count
, unsigned *selectors
,
408 unsigned *num_select_dw
, unsigned *num_read_dw
)
410 struct si_pc_block
*sigroup
= (struct si_pc_block
*)group
->data
;
411 struct si_pc_block_base
*regs
= sigroup
->b
;
412 unsigned layout_multi
= regs
->layout
& SI_PC_MULTI_MASK
;
414 if (regs
->layout
& SI_PC_FAKE
) {
416 } else if (layout_multi
== SI_PC_MULTI_BLOCK
) {
417 if (count
< regs
->num_multi
)
418 *num_select_dw
= 2 * (count
+ 2) + regs
->num_prelude
;
420 *num_select_dw
= 2 + count
+ regs
->num_multi
+ regs
->num_prelude
;
421 } else if (layout_multi
== SI_PC_MULTI_TAIL
) {
422 *num_select_dw
= 4 + count
+ MIN2(count
, regs
->num_multi
) + regs
->num_prelude
;
423 } else if (layout_multi
== SI_PC_MULTI_CUSTOM
) {
424 assert(regs
->num_prelude
== 0);
425 *num_select_dw
= 3 * (count
+ MIN2(count
, regs
->num_multi
));
427 assert(layout_multi
== SI_PC_MULTI_ALTERNATE
);
429 *num_select_dw
= 2 + count
+ MIN2(count
, regs
->num_multi
) + regs
->num_prelude
;
432 *num_read_dw
= 6 * count
;
435 static void si_pc_emit_instance(struct r600_common_context
*ctx
,
436 int se
, int instance
)
438 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
439 unsigned value
= S_030800_SH_BROADCAST_WRITES(1);
442 value
|= S_030800_SE_INDEX(se
);
444 value
|= S_030800_SE_BROADCAST_WRITES(1);
448 value
|= S_030800_INSTANCE_INDEX(instance
);
450 value
|= S_030800_INSTANCE_BROADCAST_WRITES(1);
453 radeon_set_uconfig_reg(cs
, R_030800_GRBM_GFX_INDEX
, value
);
456 static void si_pc_emit_shaders(struct r600_common_context
*ctx
,
459 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
461 radeon_set_uconfig_reg_seq(cs
, R_036780_SQ_PERFCOUNTER_CTRL
, 2);
462 radeon_emit(cs
, shaders
& 0x7f);
463 radeon_emit(cs
, 0xffffffff);
466 static void si_pc_emit_select(struct r600_common_context
*ctx
,
467 struct r600_perfcounter_block
*group
,
468 unsigned count
, unsigned *selectors
)
470 struct si_pc_block
*sigroup
= (struct si_pc_block
*)group
->data
;
471 struct si_pc_block_base
*regs
= sigroup
->b
;
472 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
474 unsigned layout_multi
= regs
->layout
& SI_PC_MULTI_MASK
;
477 assert(count
<= regs
->num_counters
);
479 if (regs
->layout
& SI_PC_FAKE
)
482 if (layout_multi
== SI_PC_MULTI_BLOCK
) {
483 assert(!(regs
->layout
& SI_PC_REG_REVERSE
));
485 dw
= count
+ regs
->num_prelude
;
486 if (count
>= regs
->num_multi
)
487 dw
+= regs
->num_multi
;
488 radeon_set_uconfig_reg_seq(cs
, regs
->select0
, dw
);
489 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
491 for (idx
= 0; idx
< MIN2(count
, regs
->num_multi
); ++idx
)
492 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
494 if (count
< regs
->num_multi
) {
496 regs
->select0
+ 4 * regs
->num_multi
;
497 radeon_set_uconfig_reg_seq(cs
, select1
, count
);
500 for (idx
= 0; idx
< MIN2(count
, regs
->num_multi
); ++idx
)
503 if (count
> regs
->num_multi
) {
504 for (idx
= regs
->num_multi
; idx
< count
; ++idx
)
505 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
507 } else if (layout_multi
== SI_PC_MULTI_TAIL
) {
508 unsigned select1
, select1_count
;
510 assert(!(regs
->layout
& SI_PC_REG_REVERSE
));
512 radeon_set_uconfig_reg_seq(cs
, regs
->select0
, count
+ regs
->num_prelude
);
513 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
515 for (idx
= 0; idx
< count
; ++idx
)
516 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
518 select1
= regs
->select0
+ 4 * regs
->num_counters
;
519 select1_count
= MIN2(count
, regs
->num_multi
);
520 radeon_set_uconfig_reg_seq(cs
, select1
, select1_count
);
521 for (idx
= 0; idx
< select1_count
; ++idx
)
523 } else if (layout_multi
== SI_PC_MULTI_CUSTOM
) {
524 unsigned *reg
= regs
->select
;
525 for (idx
= 0; idx
< count
; ++idx
) {
526 radeon_set_uconfig_reg(cs
, *reg
++, selectors
[idx
] | regs
->select_or
);
527 if (idx
< regs
->num_multi
)
528 radeon_set_uconfig_reg(cs
, *reg
++, 0);
531 assert(layout_multi
== SI_PC_MULTI_ALTERNATE
);
533 unsigned reg_base
= regs
->select0
;
534 unsigned reg_count
= count
+ MIN2(count
, regs
->num_multi
);
535 reg_count
+= regs
->num_prelude
;
537 if (!(regs
->layout
& SI_PC_REG_REVERSE
)) {
538 radeon_set_uconfig_reg_seq(cs
, reg_base
, reg_count
);
540 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
542 for (idx
= 0; idx
< count
; ++idx
) {
543 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
544 if (idx
< regs
->num_multi
)
548 reg_base
-= (reg_count
- 1) * 4;
549 radeon_set_uconfig_reg_seq(cs
, reg_base
, reg_count
);
551 for (idx
= count
; idx
> 0; --idx
) {
552 if (idx
<= regs
->num_multi
)
554 radeon_emit(cs
, selectors
[idx
- 1] | regs
->select_or
);
556 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
562 static void si_pc_emit_start(struct r600_common_context
*ctx
,
563 struct r600_resource
*buffer
, uint64_t va
)
565 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
567 radeon_add_to_buffer_list(ctx
, &ctx
->gfx
, buffer
,
568 RADEON_USAGE_WRITE
, RADEON_PRIO_QUERY
);
570 radeon_emit(cs
, PKT3(PKT3_COPY_DATA
, 4, 0));
571 radeon_emit(cs
, COPY_DATA_SRC_SEL(COPY_DATA_IMM
) |
572 COPY_DATA_DST_SEL(COPY_DATA_MEM
));
573 radeon_emit(cs
, 1); /* immediate */
574 radeon_emit(cs
, 0); /* unused */
576 radeon_emit(cs
, va
>> 32);
578 radeon_set_uconfig_reg(cs
, R_036020_CP_PERFMON_CNTL
,
579 S_036020_PERFMON_STATE(V_036020_DISABLE_AND_RESET
));
580 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE
, 0, 0));
581 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_PERFCOUNTER_START
) | EVENT_INDEX(0));
582 radeon_set_uconfig_reg(cs
, R_036020_CP_PERFMON_CNTL
,
583 S_036020_PERFMON_STATE(V_036020_START_COUNTING
));
586 /* Note: The buffer was already added in si_pc_emit_start, so we don't have to
587 * do it again in here. */
588 static void si_pc_emit_stop(struct r600_common_context
*ctx
,
589 struct r600_resource
*buffer
, uint64_t va
)
591 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
593 r600_gfx_write_event_eop(ctx
, EVENT_TYPE_BOTTOM_OF_PIPE_TS
, 0, 1,
595 r600_gfx_wait_fence(ctx
, va
, 0, 0xffffffff);
597 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE
, 0, 0));
598 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_PERFCOUNTER_SAMPLE
) | EVENT_INDEX(0));
599 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE
, 0, 0));
600 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_PERFCOUNTER_STOP
) | EVENT_INDEX(0));
601 radeon_set_uconfig_reg(cs
, R_036020_CP_PERFMON_CNTL
,
602 S_036020_PERFMON_STATE(V_036020_STOP_COUNTING
) |
603 S_036020_PERFMON_SAMPLE_ENABLE(1));
606 static void si_pc_emit_read(struct r600_common_context
*ctx
,
607 struct r600_perfcounter_block
*group
,
608 unsigned count
, unsigned *selectors
,
609 struct r600_resource
*buffer
, uint64_t va
)
611 struct si_pc_block
*sigroup
= (struct si_pc_block
*)group
->data
;
612 struct si_pc_block_base
*regs
= sigroup
->b
;
613 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
615 unsigned reg
= regs
->counter0_lo
;
616 unsigned reg_delta
= 8;
618 if (!(regs
->layout
& SI_PC_FAKE
)) {
619 if (regs
->layout
& SI_PC_REG_REVERSE
)
620 reg_delta
= -reg_delta
;
622 for (idx
= 0; idx
< count
; ++idx
) {
624 reg
= regs
->counters
[idx
];
626 radeon_emit(cs
, PKT3(PKT3_COPY_DATA
, 4, 0));
627 radeon_emit(cs
, COPY_DATA_SRC_SEL(COPY_DATA_PERF
) |
628 COPY_DATA_DST_SEL(COPY_DATA_MEM
) |
629 COPY_DATA_COUNT_SEL
); /* 64 bits */
630 radeon_emit(cs
, reg
>> 2);
631 radeon_emit(cs
, 0); /* unused */
633 radeon_emit(cs
, va
>> 32);
634 va
+= sizeof(uint64_t);
638 for (idx
= 0; idx
< count
; ++idx
) {
639 radeon_emit(cs
, PKT3(PKT3_COPY_DATA
, 4, 0));
640 radeon_emit(cs
, COPY_DATA_SRC_SEL(COPY_DATA_IMM
) |
641 COPY_DATA_DST_SEL(COPY_DATA_MEM
) |
642 COPY_DATA_COUNT_SEL
);
643 radeon_emit(cs
, 0); /* immediate */
646 radeon_emit(cs
, va
>> 32);
647 va
+= sizeof(uint64_t);
652 static void si_pc_cleanup(struct r600_common_screen
*rscreen
)
654 r600_perfcounters_do_destroy(rscreen
->perfcounters
);
655 rscreen
->perfcounters
= NULL
;
658 void si_init_perfcounters(struct si_screen
*screen
)
660 struct r600_perfcounters
*pc
;
661 struct si_pc_block
*blocks
;
665 switch (screen
->b
.chip_class
) {
668 num_blocks
= ARRAY_SIZE(groups_CIK
);
672 num_blocks
= ARRAY_SIZE(groups_VI
);
677 return; /* not implemented */
680 if (screen
->b
.info
.max_sh_per_se
!= 1) {
681 /* This should not happen on non-SI chips. */
682 fprintf(stderr
, "si_init_perfcounters: max_sh_per_se = %d not "
683 "supported (inaccurate performance counters)\n",
684 screen
->b
.info
.max_sh_per_se
);
687 pc
= CALLOC_STRUCT(r600_perfcounters
);
691 pc
->num_start_cs_dwords
= 14;
692 pc
->num_stop_cs_dwords
= 14 + r600_gfx_write_fence_dwords(&screen
->b
);
693 pc
->num_instance_cs_dwords
= 3;
694 pc
->num_shaders_cs_dwords
= 4;
696 pc
->num_shader_types
= ARRAY_SIZE(si_pc_shader_type_bits
);
697 pc
->shader_type_suffixes
= si_pc_shader_type_suffixes
;
698 pc
->shader_type_bits
= si_pc_shader_type_bits
;
700 pc
->get_size
= si_pc_get_size
;
701 pc
->emit_instance
= si_pc_emit_instance
;
702 pc
->emit_shaders
= si_pc_emit_shaders
;
703 pc
->emit_select
= si_pc_emit_select
;
704 pc
->emit_start
= si_pc_emit_start
;
705 pc
->emit_stop
= si_pc_emit_stop
;
706 pc
->emit_read
= si_pc_emit_read
;
707 pc
->cleanup
= si_pc_cleanup
;
709 if (!r600_perfcounters_init(pc
, num_blocks
))
712 for (i
= 0; i
< num_blocks
; ++i
) {
713 struct si_pc_block
*block
= &blocks
[i
];
714 unsigned instances
= block
->instances
;
716 if (!strcmp(block
->b
->name
, "IA")) {
717 if (screen
->b
.info
.max_se
> 2)
721 r600_perfcounters_add_block(&screen
->b
, pc
,
724 block
->b
->num_counters
,
730 screen
->b
.perfcounters
= pc
;
734 r600_perfcounters_do_destroy(pc
);