-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathsoc_gfx940.py
110 lines (102 loc) · 4.3 KB
/
soc_gfx940.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
##############################################################################bl
# MIT License
#
# Copyright (c) 2021 - 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
##############################################################################el
import os
import config
from omniperf_soc.soc_base import OmniSoC_Base
from utils.utils import demarcate, mibench, console_log, console_error
from roofline import Roofline
class gfx940_soc(OmniSoC_Base):
def __init__(self, args, mspec):
super().__init__(args, mspec)
self.set_arch("gfx940")
if hasattr(self.get_args(), "roof_only") and self.get_args().roof_only:
self.set_perfmon_dir(
os.path.join(
str(config.omniperf_home),
"omniperf_soc",
"profile_configs",
"gfx940",
"roofline",
)
)
else:
# NB: We're using generalized Mi300 perfmon configs
self.set_perfmon_dir(
os.path.join(
str(config.omniperf_home), "omniperf_soc", "profile_configs", "gfx940"
)
)
self.set_compatible_profilers(["rocprofv2"])
# Per IP block max number of simultaneous counters. GFX IP Blocks
self.set_perfmon_config(
{
"SQ": 8,
"TA": 2,
"TD": 2,
"TCP": 4,
"TCC": 4,
"CPC": 2,
"CPF": 2,
"SPI": 2,
"GRBM": 2,
"GDS": 4,
"TCC_channels": 32,
}
)
# self.roofline_obj = Roofline(args, self._mspec)
# Set arch specific specs
self._mspec._l2_banks = 16
self._mspec.lds_banks_per_cu = 32
self._mspec.pipes_per_gpu = 4
# -----------------------
# Required child methods
# -----------------------
@demarcate
def profiling_setup(self):
"""Perform any SoC-specific setup prior to profiling."""
super().profiling_setup()
if self.get_args().roof_only:
console_error("Roofline temporarily disabled in MI300")
# Performance counter filtering
self.perfmon_filter(self.get_args().roof_only)
@demarcate
def post_profiling(self):
"""Perform any SoC-specific post profiling activities."""
super().post_profiling()
console_log("roofline", "Roofline temporarily disabled in MI300")
# if not self.get_args().no_roof:
# logging.info("[roofline] Checking for roofline.csv in " + str(self.get_args().path))
# if not os.path.isfile(os.path.join(self.get_args().path, "roofline.csv")):
# mibench(self.get_args())
# self.roofline_obj.post_processing()
# else:
# logging.info("[roofline] Skipping roofline")
@demarcate
def analysis_setup(self, roofline_parameters=None):
"""Perform any SoC-specific setup prior to analysis."""
super().analysis_setup()
console_log("roofline", "Roofline temporarily disabled in Mi300")
# configure roofline for analysis
# if roofline_parameters:
# self.roofline_obj = Roofline(self.get_args(), roofline_parameters)