RRZE-HPC / likwid

Performance monitoring and benchmarking suite
https://hpc.fau.de/research/tools/likwid/
GNU General Public License v3.0
1.61k stars 223 forks source link

AMD family 25, model 8 support #624

Open sgaure opened 1 month ago

sgaure commented 1 month ago

This is my desktop computer, and I would very much like to be able to profile programs I write. From /proc/cpuinfo:

processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 25
model           : 8
model name      : AMD Ryzen Threadripper PRO 5945WX 12-Cores
stepping        : 2
microcode       : 0xa008204
$ cat /etc/issue
Ubuntu 24.04 LTS
$ likwid-perfctr --version
likwid-perfctr -- Version 5.3.0 (commit: f92b13ae2203b13e045ef704214820536f6e534e)
$ sudo likwid-perfctr -g CLOCK /bin/ls
--------------------------------------------------------------------------------
CPU name:       AMD Ryzen Threadripper PRO 5945WX 12-Cores     
CPU type:       nil
CPU clock:      4.09 GHz
ERROR - [/src/likwid/src/perfmon.c:perfmon_init_maps:1300] Unsupported AMD Zen Processor
ERROR - [/src/likwid/src/perfmon.c:perfmon_init:2111] No such file or directory.
Failed to initialize event and counter lists for (null)

Linux perf runs fine, so I suppose the counters are documented.

$ perf stat /bin/true

 Performance counter stats for '/bin/true':

              0,77 msec task-clock                       #    0,076 CPUs utilized             
                 1      context-switches                 #    1,306 K/sec                     
                 0      cpu-migrations                   #    0,000 /sec                      
                54      page-faults                      #   70,522 K/sec                     
         1 397 408      cycles                           #    1,825 GHz                       
             8 617      stalled-cycles-frontend          #    0,62% frontend cycles idle      
           228 054      stalled-cycles-backend           #   16,32% backend cycles idle       
         1 138 743      instructions                     #    0,81  insn per cycle            
                                                  #    0,20  stalled cycles per insn   
           242 850      branches                         #  317,154 M/sec                     
            30 552      branch-misses                    #   12,58% of all branches           

       0,010068794 seconds time elapsed

       0,000772000 seconds user
       0,000772000 seconds sys
TomTheBear commented 1 month ago

Please try out the attached PR. It should work for your system but there could be minor differences to the general Zen4 Ryzen or Epyc variants.

sgaure commented 1 month ago

Ah, unexpectedly I'm away from office for some weeks. I can't try it out in a few weeks.

sgaure commented 1 month ago

I got around for a short test. Seems ok. For the groups I get some warnings.

$ sudo likwid-perfctr -f -C 0 -g CACHE /bin/true
WARN: Event DATA_CACHE_REFILLS_ALL not found for current architecture
$ sudo likwid-perfctr -f -C 0 -g L3CACHE /bin/true
WARN: Event L3_CACHE_REQ not found for current architecture
WARN: Event L3_MISS_REQ not found for current architecture
WARN: Event L3_CACHE_REQ_MISS not found for current architecture
TomTheBear commented 1 month ago

Please run likwid-perfctr -V 3 -e. There might be multiple reasons for this behavior.

sgaure commented 1 month ago

likwid.txt

TomTheBear commented 1 month ago

I copied the groups over from Zen3 and never updated these groups to use the Zen4 events. So this is a general Zen4 issue. I updated the PR.

sgaure commented 1 month ago

Seems ok now. There are some warnings for the NUMA group, but there's only one NUMA domain, so not very interesting. (DATA_CACHE_REFILLS_LOCAL_ALL and DATA_CACHE_REFILLS_REMOTE_ALL).

TomTheBear commented 1 month ago

Same issue, I updated it.