Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HiSilicon TSV110 architecture #448

Merged
merged 3 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/includes/perfmon_hisilicon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* =======================================================================================
*
* Filename: perfmon_hisilicon.h
*
* Description: Header File of perfmon module for HiSilicon chips.
*
* Version: <VERSION>
* Released: <DATE>
*
* Author: Thomas Gruber (tr), thomas.roehl@googlemail.com
* Project: likwid
*
* Copyright (C) 2022 RRZE, University Erlangen-Nuremberg
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* =======================================================================================
*/
#ifndef NUM_ARCH_EVENTS_A57
#include <perfmon_a57_events.h>
#endif
#include <perfmon_hisilicon_counters.h>


static int perfmon_numCountersHiSiliconTsv110 = NUM_COUNTERS_HISILICON_TSV110;
static int perfmon_numArchEventsHiSiliconTsv110 = NUM_ARCH_EVENTS_A57;
50 changes: 50 additions & 0 deletions src/includes/perfmon_hisilicon_counters.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* =======================================================================================
*
* Filename: perfmon_hisilicon_counters.h
*
* Description: Counter Header File of perfmon module for HiSilicon chips.
*
* Version: <VERSION>
* Released: <DATE>
*
* Author: Thomas Gruber (tr), thomas.roehl@googlemail.com
* Project: likwid
*
* Copyright (C) 2022 RRZE, University Erlangen-Nuremberg
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* =======================================================================================
*/


#define NUM_COUNTERS_HISILICON_TSV110 6

static RegisterMap tsv110_counter_map[NUM_COUNTERS_HISILICON_TSV110] = {
{"PMC0", PMC0, PMC, A57_PERFEVTSEL0, A57_PMC0, 0, 0, EVENT_OPTION_NONE_MASK},
{"PMC1", PMC1, PMC, A57_PERFEVTSEL1, A57_PMC1, 0, 0, EVENT_OPTION_NONE_MASK},
{"PMC2", PMC2, PMC, A57_PERFEVTSEL2, A57_PMC2, 0, 0, EVENT_OPTION_NONE_MASK},
{"PMC3", PMC3, PMC, A57_PERFEVTSEL3, A57_PMC3, 0, 0, EVENT_OPTION_NONE_MASK},
{"PMC4", PMC4, PMC, A57_PERFEVTSEL4, A57_PMC4, 0, 0, EVENT_OPTION_NONE_MASK},
{"PMC5", PMC5, PMC, A57_PERFEVTSEL5, A57_PMC5, 0, 0, EVENT_OPTION_NONE_MASK},
};

static BoxMap tsv110_box_map[NUM_UNITS] = {
[PMC] = {A57_PERF_CONTROL_CTRL, A57_OVERFLOW_STATUS, A57_OVERFLOW_FLAGS, 0, 0, 0, 32},
};

static char* tsv110_translate_types[NUM_UNITS] = {
[PMC] = "/sys/bus/event_source/devices/armv8_pmuv3_0",
};

2 changes: 2 additions & 0 deletions src/includes/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ struct topology_functions {
#define APP_XGENE1 0x00U
#define ARM_NEOVERSE_N1 0xD0CU
#define FUJITSU_A64FX 0x001U
#define HUAWEI_TSV110 0xD01U
#define AWS_GRAVITON3 0xD40U

/* ARM vendors */
Expand All @@ -185,6 +186,7 @@ struct topology_functions {
#define MARVELL 0x56U
#define INTEL_ARM 0x69U
#define FUJITSU_ARM 0x46U
#define HUAWEI_ARM 0x48U

/* POWER */
#define POWER7 0x7U
Expand Down
17 changes: 17 additions & 0 deletions src/perfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
#include <perfmon_icelake.h>
#include <perfmon_neon1.h>
#include <perfmon_a64fx.h>
#include <perfmon_hisilicon.h>
#include <perfmon_graviton3.h>

#ifdef LIKWID_USE_PERFEVENT
Expand Down Expand Up @@ -1455,6 +1456,22 @@ perfmon_init_maps(void)
break;
}
break;
case HUAWEI_ARM:
switch (cpuid_info.part)
{
case HUAWEI_TSV110:
eventHash = a57_arch_events;
perfmon_numArchEvents = perfmon_numArchEventsHiSiliconTsv110;
counter_map = tsv110_counter_map;
box_map = tsv110_box_map;
perfmon_numCounters = perfmon_numCountersHiSiliconTsv110;
translate_types = tsv110_translate_types;
break;
default:
ERROR_PLAIN_PRINT(Unsupported Huawei Processor);
break;
}
break;
default:
ERROR_PLAIN_PRINT(Unsupported ARMv8 Processor);
err = -EINVAL;
Expand Down
12 changes: 12 additions & 0 deletions src/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ static char* arm_cortex_a53 = "ARM Cortex A53";
static char* arm_cortex_a72 = "ARM Cortex A72";
static char* arm_cortex_a73 = "ARM Cortex A73";
static char* arm_neoverse_n1 = "ARM Neoverse N1";
static char* arm_huawei_tsv110 = "Huawei TSV110 (ARMv8)";
static char* fujitsu_a64fx = "Fujitsu A64FX";
static char* power7_str = "POWER7 architecture";
static char* power8_str = "POWER8 architecture";
Expand Down Expand Up @@ -1228,6 +1229,17 @@ topology_setName(void)
return EXIT_FAILURE;
break;
}
case HUAWEI_ARM:
switch (cpuid_info.part)
{
case HUAWEI_TSV110:
cpuid_info.name = arm_huawei_tsv110;
cpuid_info.short_name = short_arm8;
break;
default:
return EXIT_FAILURE;
break;
}
default:
return EXIT_FAILURE;
break;
Expand Down
Loading