콘텐츠로 이동

카운터 레퍼런스

디바이스가 노출하는 하드웨어 카운터 이벤트 41개와, 트레이스에 표시되는 값이 원시 카운트에서 어떻게 계산되는지 정리합니다. 하드웨어 카운터는 haprof --device-trace 모드로 수집할 때 커널 실행마다 샘플링됩니다. 기본으로 등록되는 항목은 core 0의 20개 이벤트이며, 그 외의 이벤트는 HAPTI_COUNTERS 환경 변수를 통해 지정할 수 있습니다. 수집된 카운터 값을 해석하는 방법은 디바이스 트레이싱: 카운터 해석을 참고하십시오.

"트레이스 설명" 열은 카탈로그의 원문을 그대로 옮긴 것으로, 트레이스의 카운터 키 이름과 일치합니다.

Contents

Section Objective
1. 이벤트 카탈로그 블록별 이벤트 id와 이름
2. 표시 규칙 트레이스의 값이 계산되는 방식
3. 기본 등록 이벤트 --device-trace가 기본으로 수집하는 20개

1. 이벤트 카탈로그

HAPTI_COUNTERS의 <블록>에는 블록 이름을, <이벤트>에는 아래 이름이나 id를 씁니다.

AXIBRG

코어와 DRAM 사이의 AXI 브리지입니다. 읽기·쓰기 beat와, 그 양쪽의 stall을 셉니다.

이벤트 이름 트레이스 설명
0 beat_rdata DRAM read beats
1 idle AXI idle cycles
2 beat_wdata DRAM write beats
3 rdata_stall_supply read stall (supply)
4 rdata_stall_demand read stall (demand)
5 wdata_stall_supply write stall (supply)
6 wdata_stall_demand write stall (demand)
7 ar_active AR active
8 aw_active AW active
9 wait_bresp write completion wait

CDMA

코어별 DMA 엔진입니다.

이벤트 이름 트레이스 설명
0 idle DMA idle
1 inrob_beat DRAM read beats
2 outbuf_beat DRAM write beats

DMC

SRAM 뱅크 충돌을 셉니다.

이벤트 이름 트레이스 설명
0 conflict_total SRAM bank conflicts
1 conflict_maxbank hottest-bank conflicts

UTIL

코어별 유닛 사용률 샘플링입니다. 각 이벤트는 해당 유닛이 바빴던 샘플 수이고, sample_total이 분모입니다.

이벤트 이름 트레이스 설명
0 sample_total poll samples
1 core_active core busy
2 mpu_active matrix unit busy
3 vpu_active vector unit busy
4 spu_active special-fn unit busy
5 cdma_active core DMA busy
6 axibrg_active AXI bridge busy
7 rsh_active reshape unit busy
8 smp_active sample unit busy
9 cgbrg_active CG bridge busy

CGDMA

코어 그룹(CG) DMA 엔진입니다. 인스턴스 번호는 코어 그룹 번호이며, 대역폭 값은 이 블록에서 파생됩니다.

이벤트 이름 트레이스 설명
0 idle CGDMA idle cycles
1 inrob_beat DRAM read beats
2 outrob_beat DRAM write beats
3 ar_active AR active
4 inst_stall_supply inst stall (supply)
5 inst_stall_demand inst stall (demand)
6 ar_stall_supply AR stall (supply)
7 ar_stall_demand AR stall (demand)
8 inrob_stall_supply read stall (supply)
9 inrob_stall_demand read stall (demand)
10 outrob_stall_supply write stall (supply)
11 outrob_stall_demand write stall (demand)

MPU

행렬 유닛의 작업량 카운터입니다. 시간이 아니라 원시 작업량을 셉니다.

이벤트 이름 트레이스 설명
0 stripe matrix stripes
1 rsc_substripe matrix substripes
2 wne weight elements
3 ifm_chn input FM channels

2. 표시 규칙

트레이스는 원시 카운터 값을 그대로 보여 주지 않습니다. 커널 슬라이스에 붙는 값은 블록에 따라 다음 규칙으로 계산됩니다.

블록 표시 키 형식
AXIBRG, CDMA, CGDMA, MPU 실행별 델타 <블록>.c<인스턴스>.<이벤트> (<트레이스 설명>, per launch)
DMC 원시 값(이미 실행 단위) 위와 같음
UTIL sample_total 대비 백분율 UTIL.c<코어>.<유닛>% (<트레이스 설명>)
CGDMA, AXIBRG 방향별 파생값 추가 대역폭과 stall 분해
DMC 뱅크 편중 파생값 추가 SRAM 뱅크 편중

2.1 실행별 델타

AXIBRG, CDMA, CGDMA, MPU 카운터는 free-running이라 디바이스가 리셋하지 않습니다. 트레이스는 각 카운터를 직전 실행의 값과 차분해, 한 행이 "부팅 이후"가 아니라 "이번 실행"을 뜻하게 합니다. 카운터가 직전 값보다 작아지면(리셋) 원시 값을 그대로 씁니다.

첫 실행에는 직전 값이 없습니다

첫 실행의 델타는 기준값 0과 차분되므로 프로파일링 시작 전에 돌던 것까지 포함합니다. 실행의 첫 회차는 신뢰하지 말고 워밍업 후 측정하십시오.

2.2 원시 값

DMC는 펌웨어가 실행마다 초기화하므로 샘플이 이미 실행 단위입니다. 다시 차분하지 않고 그대로 표시합니다.

2.3 활용률

1
UTIL.c<core>.<unit>% = <unit>_active / sample_total × 100

sample_total은 실행 동안 수행한 폴링 샘플 수이고, *_active 이벤트는 그중 해당 유닛이 바빴던 샘플 수입니다. sample_total 자체는 분모로만 쓰이고 표시되지 않으며, 같은 코어의 sample_total이 등록되지 않았으면 UTIL 값은 표시되지 않습니다. cycle-exact 점유율이 아니라 샘플링된 duty cycle입니다.

2.4 대역폭과 stall 분해

CGDMA와 AXIBRG의 각 방향(read, write)에 대해 다음을 계산합니다.

1
2
3
util%          = beat / (beat + supply_stall + demand_stall) × 100
supply-stall%  = supply_stall / (beat + supply_stall + demand_stall) × 100
demand-stall%  = demand_stall / (beat + supply_stall + demand_stall) × 100
블록 · 방향 beat supply stall demand stall
CGDMA read inrob_beat inrob_stall_supply inrob_stall_demand
CGDMA write outrob_beat outrob_stall_supply outrob_stall_demand
AXIBRG read beat_rdata rdata_stall_supply rdata_stall_demand
AXIBRG write beat_wdata wdata_stall_supply wdata_stall_demand

세 값 모두 beat와 두 stall 카운터가 모두 등록되어 있어야 표시됩니다. 하나라도 빠지면 틀린 분모로 보여 주는 대신 그 방향 전체를 생략합니다.

CGDMA는 활용률에 펌웨어 peak를 곱한 대역폭을 추가로 표시합니다.

1
CGDMA.c<cg>.<dir> BW (GB/s) = util × 68.0

CGDMA 대역폭은 파생값입니다

코어 그룹당 68.0 GB/s는 펌웨어가 선언한 peak입니다. 이 값은 측정된 바이트 수가 아니라 그 상수로 스케일한 활용률이므로, 실행끼리 비교하는 데 쓰고 절대 전송률로 쓰지 마십시오. 메모리 전송 슬라이스의 memory bandwidth (GB/s)는 바이트 수를 시간으로 나눈 측정값이라 성격이 다릅니다.

AXIBRG 쓰기 방향의 세 값이 표시되고 wait_bresp도 등록되어 있으면 하나가 더 붙습니다.

1
bresp-wait% = wait_bresp / (beat_wdata + wait_bresp) × 100

마지막으로, 커널 전체에 대해 모든 CGDMA·AXIBRG 방향의 stall을 합산한 판정을 붙입니다.

키 값
bound (DMA stall: supply=mem, demand=compute) supply 합이 크면 memory-bound, demand 합이 크면 compute-bound, 같으면 balanced
memory-bound stall% supply 합 / (supply 합 + demand 합) × 100

2.5 SRAM 뱅크 편중

DMC의 두 이벤트가 모두 등록되어 있으면 코어별로 다음을 표시합니다.

1
DMC.c<core> bank-skew% = conflict_maxbank / conflict_total × 100

충돌이 16개 뱅크에 고르게 퍼지면 6.25%, 한 뱅크에 몰리면 100%에 가깝습니다.


3. 기본 등록 이벤트

HAPTI_COUNTERS를 지정하지 않은 --device-trace는 다음 20개를 등록합니다. 모두 인스턴스 0(core 0)입니다.

블록 이벤트
AXIBRG beat_rdata, idle, beat_wdata, rdata_stall_supply, rdata_stall_demand, wdata_stall_supply, wdata_stall_demand, wait_bresp
DMC conflict_total, conflict_maxbank
UTIL 10개 전부

이 조합으로 AXIBRG 방향별 분해, bresp-wait%, bank-skew%, UTIL 활용률이 표시됩니다. CGDMA 대역폭은 기본으로 표시되지 않습니다.


함께 보기