RRZE-HPC / likwid

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

Support for Intel Alder Lake 12th gen processors #468

Open akaalharbi opened 2 years ago

akaalharbi commented 2 years ago

Why do you need support for this specific architecture? I would like to run likwid on my laptop, however it shows the following massage:

`Cannot access directory /usr/local/share/likwid/perfgroups/unknown

CPU name: 12th Gen Intel(R) Core(TM) i7-12700H CPU type: Unknown Intel Processor CPU clock: 2.69 GHz ERROR - [./src/perfmon.c:perfmon_init_maps:1162] Unsupported Processor ERROR - [./src/perfmon.c:perfmon_init_funcs:1733] Unsupported Processor Segmentation fault (core dumped) ` I tried to run the command "grep -E "model|family|stepping" /proc/cpuinfo | sort -u"

cpu family : 6 model : 154 model name : 12th Gen Intel(R) Core(TM) i7-12700H stepping : 3 It would be generous if you can support this architecture in the next release.

TomTheBear commented 2 years ago

This will be quite some work due to the P- and E-cores. Each core-type has own units with maybe different amount of counters and features, see chapter 19.3.10 in Intel's SDM. It will take some time to integrate it. Besides hardware counting, I have to check whether application threads can be pinned to specific cores (P or E). If you can only pin to a single core (which switches between P and E depending on the workload), LIKWID has to setup both perfmon units to get the full counts.

edisonchan commented 2 years ago

does this doc help ? https://www.intel.com/content/dam/develop/public/us/en/documents/253669-sdm-vol-3b.pdf

TomTheBear commented 2 years ago

Thanks @edisonchan . That's the same documentation, I mentioned above, just a different link.

The related event lists: https://download.01.org/perfmon/ADL/

edisonchan commented 2 years ago

because RPL is almost same to ADL, so plz allow me write something about the try support for RPL.

I try to make some simple change with add raptorlake string into the source code hope to get RPL support according the "AddX86Support " page, some group works but ENERGY not:

https://drive.google.com/file/d/1__FSDUEv1veSVCxHdVlHjjzCnrHhMzPt/view?usp=sharing

Cannot gather values from unit register 0x606, deactivating RAPL support

sudo likwid-perfctr -C 0 -g BRANCH sleep 3
--------------------------------------------------------------------------------
CPU name:       13th Gen Intel(R) Core(TM) i9-13900K
CPU type:       Intel Raptorlake processor
CPU clock:      3.00 GHz
Cannot gather values from unit register 0x606, deactivating RAPL support
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Group 1: BRANCH
+------------------------------+---------+------------+
|             Event            | Counter | HWThread 0 |
+------------------------------+---------+------------+
|       INSTR_RETIRED_ANY      |  FIXC0  |    1522910 |
|     CPU_CLK_UNHALTED_CORE    |  FIXC1  |     850714 |
|     CPU_CLK_UNHALTED_REF     |  FIXC2  |     727116 |
| BR_INST_RETIRED_ALL_BRANCHES |   PMC0  |     376828 |
| BR_MISP_RETIRED_ALL_BRANCHES |   PMC1  |       4879 |
+------------------------------+---------+------------+

+----------------------------+------------+
|           Metric           | HWThread 0 |
+----------------------------+------------+
|     Runtime (RDTSC) [s]    |     3.0005 |
|    Runtime unhalted [s]    |     0.0003 |
|         Clock [MHz]        |  3504.3281 |
|             CPI            |     0.5586 |
|         Branch rate        |     0.2474 |
|  Branch misprediction rate |     0.0032 |
| Branch misprediction ratio |     0.0129 |
|   Instructions per branch  |     4.0414 |
+----------------------------+------------+
sudo likwid-perfctr -C 0 -g ENERGY sleep 3
--------------------------------------------------------------------------------
CPU name:       13th Gen Intel(R) Core(TM) i9-13900K
CPU type:       Intel Raptorlake processor
CPU clock:      2.99 GHz
Cannot gather values from unit register 0x606, deactivating RAPL support
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Group 1: ENERGY
+-----------------------+---------+------------+
|         Event         | Counter | HWThread 0 |
+-----------------------+---------+------------+
|   INSTR_RETIRED_ANY   |  FIXC0  |     177554 |
| CPU_CLK_UNHALTED_CORE |  FIXC1  |     317332 |
|  CPU_CLK_UNHALTED_REF |  FIXC2  |     241098 |
|       TEMP_CORE       |   TMP0  |         24 |
|     PWR_PKG_ENERGY    |   PWR0  |      -     |
|     PWR_PP0_ENERGY    |   PWR1  |      -     |
|    PWR_DRAM_ENERGY    |   PWR3  |      -     |
+-----------------------+---------+------------+

+----------------------+------------+
|        Metric        | HWThread 0 |
+----------------------+------------+
|  Runtime (RDTSC) [s] |     3.0005 |
| Runtime unhalted [s] |     0.0001 |
|      Clock [MHz]     |  3941.9947 |
|          CPI         |     1.7872 |
|    Temperature [C]   |         24 |
|      Energy [J]      |          0 |
|       Power [W]      |          0 |
|    Energy PP0 [J]    |          0 |
|     Power PP0 [W]    |          0 |
|    Energy DRAM [J]   |          0 |
|    Power DRAM [W]    |          0 |
+----------------------+------------+

cpu2017 500_perlbench_r:

--------------------------------------------------------------------------------
CPU name:   13th Gen Intel(R) Core(TM) i9-13900K
CPU type:   Intel Raptorlake processor
CPU clock:  3.00 GHz
--------------------------------------------------------------------------------
Group 1: DATA
+-----------------------------+---------+---------------+
|            Event            | Counter |   HWThread 0  |
+-----------------------------+---------+---------------+
|      INSTR_RETIRED_ANY      |  FIXC0  | 2734072813075 |
|    CPU_CLK_UNHALTED_CORE    |  FIXC1  |  724512668799 |
|     CPU_CLK_UNHALTED_REF    |  FIXC2  |  544545333696 |
|  MEM_INST_RETIRED_ALL_LOADS |   PMC0  |  819061848579 |
| MEM_INST_RETIRED_ALL_STORES |   PMC1  |  468860309830 |
+-----------------------------+---------+---------------+
+----------------------+------------+
|        Metric        | HWThread 0 |
+----------------------+------------+
|  Runtime (RDTSC) [s] |   182.0977 |
| Runtime unhalted [s] |   241.8901 |
|      Clock [MHz]     |  3985.1048 |
|          CPI         |     0.2650 |
|  Load to store ratio |     1.7469 |
+----------------------+------------+

The CPU freq should be 4.0 GHz here.(4GHz was set in BIOS, and idle=poll was set in grub kernel command line) , but that is not a problem, it would be 4.0GHz if run longer heavy workload. BIOS: e- cores were disabled, HTT disabled,

I think if this works(need add ENERGY/rpal support), then we can quick add support for ADL in some kind(disable e-core).

RPAL is enabled in my system(ubuntu 22.04 kernel 5.19), I have checked it works with "sudo s-tui" and rapl-tool(https://github.com/kentcz/rapl-tools), so I think there is some part of likwid source code (not?) need to modify to make it works.

TomTheBear commented 2 years ago

@edisonchan : You are very welcome to add support for Intel Raptorlake. Could you please open a new architecture issue for it. And please create a PR with your changes. It's great to ready that the AddX86Support page is helpful. Maybe there is one detail missing for RAPL. I checked rapl-tools and it also uses register 0x606.