Build out gfx942 SoC class and improve SoC detection

Signed-off-by: coleramos425 <colramos@amd.com>
This commit is contained in:
coleramos425
2024-01-19 11:02:52 -06:00
committed by Cole Ramos
orang tua 0432f77a7e
melakukan 7846a663fd
2 mengubah file dengan 129 tambahan dan 9 penghapusan
+17 -9
Melihat File
@@ -51,6 +51,7 @@ class Omniperf:
"gfx906": {"mi50": ["MI50", "MI60"]},
"gfx908": {"mi100": ["MI100"]},
"gfx90a": {"mi200": ["MI210", "MI250", "MI250X"]},
"gfx942": {"mi300": ["MI300A_A1", "MI300X_A1"]},
}
self.setup_logging()
@@ -127,7 +128,14 @@ class Omniperf:
else:
#TODO: Add detection logic for rocprofv2
rocprof_cmd = detect_rocprof()
self.__profiler_mode = "rocprofv1"
if str(rocprof_cmd).endswith("rocprof"):
self.__profiler_mode = "rocprofv1"
elif str(rocprof_cmd).endswith("rocprofv2"):
self.__profiler_mode = "rocprofv2"
else:
error("Incompatible profiler. Please review documentation.")
return
def detect_analyze(self):
if self.__args.gui:
@@ -137,22 +145,24 @@ class Omniperf:
return
@demarcate
def detect_soc(self, arch=None):
def detect_soc(self, sys_info=pd.DataFrame()):
"""Load OmniSoC instance for Omniperf run
"""
# in case of analyze mode, we can explicitly specify an arch
# rather than detect from rocminfo
if not arch:
if sys_info.empty:
arch = sys_info.iloc[0]["gpu_soc"]
target = sys_info.iloc[0]["name"]
else:
mspec = get_machine_specs(0)
arch = mspec.arch
target = mspec.GPU
# instantiate underlying SoC support class
# in case of analyze mode, __soc can accommodate multiple archs
if arch not in self.__supported_archs.keys():
logging.error("Unsupported SoC")
sys.exit(1)
error("%s is an unsupported SoC" % arch)
else:
target = list(self.__supported_archs[arch].keys())[0]
self.__soc_name.add(target)
if hasattr(self.__args, 'target'):
self.__args.target = target
@@ -251,9 +261,7 @@ class Omniperf:
# Load required SoC(s) from input
for d in analyzer.get_args().path:
sys_info = pd.read_csv(Path(d[0], "sysinfo.csv"))
arch = sys_info.iloc[0]["gpu_soc"]
# Create and load new SoC object
self.detect_soc(arch)
self.detect_soc(sys_info)
analyzer.set_soc(self.__soc)
analyzer.pre_processing()
+112
Melihat File
@@ -0,0 +1,112 @@
##############################################################################bl
# MIT License
#
# Copyright (c) 2021 - 2023 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
from roofline import Roofline
import logging
class gfx942_soc (OmniSoC_Base):
def __init__(self,args):
super().__init__(args)
self.set_soc_name("gfx942")
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", "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.set_soc_param(
{
"numSE": 8,
"numCU": 38,
"numSIMD": 4,
"numWavesPerCU": 32,
"numSQC": 56,
"L2Banks": 16,
"LDSBanks": 32,
"Freq": 1950,
"mclk": 1300
}
)
self.roofline_obj = Roofline(args)
#-----------------------
# Required child methods
#-----------------------
@demarcate
def profiling_setup(self):
"""Perform any SoC-specific setup prior to profiling.
"""
super().profiling_setup()
# 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()
logging.info("[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()
logging.info("[roofline] Roofline temporarily disabled in Mi300")
# configure roofline for analysis
# if roofline_parameters:
# self.roofline_obj = Roofline(self.get_args(), roofline_parameters)