-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rocprofv3 support initial commit -Can run rocprofv3 but ultimately fails. rocprofv3 says the counter capacity is exceeded and the output CSV file format is different from v1/v2. * Add rocprofv3 detection so v2 can still be used It's hacky but it'll do for now. * Add code path to convert rocprofv3 JSON output into CSV * Grab correct value for Queue ID * Use _sum suffix to sum TCC counters Previously we were specifying each channel for TCC counters. rocprofv3 does not support specifing each TCC channel, and instead will auto sum given the TCC counter name. The counter name with the _sum suffix is also supported and is also supported in v1 and v2. So we will use the TCC counter name with the _sum suffix. * Fix incorrect counter outputs when using rocprofv3 In the JSON output some counters appear multime times and must be summed to get the correct value. These summed values match the rocprofv3 output in CSV mode and also match the rocprofv2 output. * Remove duplicate Correlation_ID and Wave_Size in output * Handle json output that does not contain any dispatches Omniperf was assuming each JSON output from rocprofv3 would always contain dispatches. This is not the case. For example, in a multi-process workload where one of the processes does not dispatch any kernels. A JSON file will still be output for this process but it will not contain any dispatches. * Code cleanup * Update search path for rocprofv3 results Rocprofv3 was updated to include the hostname in the path where it outputs results. * Handle accumulate counters In v1/v2 rocprof uses the SQ_ACCUM_PREV_HIRES counter for the accumualte counters. v3 does not have this. So we need to define our own counters in counter_defs.yaml. For this we use the counter name + _ACCUM, for example SQ_INSTR_LEVEL_SMEM_ACCUM. To use rocprofv3 you will need to update counter_defs.yaml to include these new counter definitions. * Use correct GPU ID When converting JSON -> CSV we were assigning node_id to GPU_ID. Since the JSON contains non-GPU devices, the node_id for GPUs might not start at 0 as expected. This commit maps the agent ID to the appropriate GPU ID. * Parse scratch memory per work item from JSON * Support rocprofv3 CSV parsing JSON decoding is very slow for large files. Include support for parsing rocprofv3 CSV output and make that the default. CSV/JSON can be toggled via the ROCPROF_OUTPUT_FORMAT environment variable e.g. ROCPROF_OUTPUT_FORMAT=csv or ROCPROF_OUTPUT_FORMAT=json * black format after merge * format isort * change return of rocprof_cmd to try to resolve test's error * hack to pick last part of rocminfo's name * debug log of hacks * Modify test_profile_general.py ctest to include MI300 enablement. Currently failing because of explicitly excluded roofline files for the soc and autofailed asserts for roof-only tests- originally in place because roofline was not enabled on mi300 yet. Signed-off-by: Carrie Fallows <Carrie.Fallows@amd.com> * black and isort formated * corrected line of copyright --------- Signed-off-by: Carrie Fallows <Carrie.Fallows@amd.com> Co-authored-by: benrichard-amd <ben.richard@amd.com> Co-authored-by: YANG WANG <ywang@ywang-ubuntu.amd.com> Co-authored-by: Carrie Fallows <Carrie.Fallows@amd.com>
- Loading branch information
1 parent
903241a
commit 6c470ce
Showing
7 changed files
with
509 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
##############################################################################bl | ||
# MIT License | ||
# | ||
# Copyright (c) 2024 - 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 shlex | ||
|
||
from rocprof_compute_profile.profiler_base import RocProfCompute_Base | ||
from utils.utils import console_error, console_log, demarcate, replace_timestamps | ||
|
||
|
||
class rocprof_v3_profiler(RocProfCompute_Base): | ||
def __init__(self, profiling_args, profiler_mode, soc): | ||
super().__init__(profiling_args, profiler_mode, soc) | ||
self.ready_to_profile = ( | ||
self.get_args().roof_only | ||
and not os.path.isfile(os.path.join(self.get_args().path, "pmc_perf.csv")) | ||
or not self.get_args().roof_only | ||
) | ||
|
||
def get_profiler_options(self, fname): | ||
app_cmd = shlex.split(self.get_args().remaining) | ||
output_format = "csv" | ||
if "ROCPROF_OUTPUT_FORMAT" in os.environ.keys(): | ||
output_format = os.environ["ROCPROF_OUTPUT_FORMAT"].lower() | ||
|
||
if output_format not in ["csv", "json"]: | ||
console_error("Invalid rocprof output format", True) | ||
|
||
args = [ | ||
# v3 requires output directory argument | ||
"-d", | ||
self.get_args().path + "/" + "out", | ||
"--kernel-trace", | ||
"--output-format", | ||
output_format, | ||
"--", | ||
] | ||
args.extend(app_cmd) | ||
return args | ||
|
||
# ----------------------- | ||
# Required child methods | ||
# ----------------------- | ||
@demarcate | ||
def pre_processing(self): | ||
"""Perform any pre-processing steps prior to profiling.""" | ||
super().pre_processing() | ||
|
||
@demarcate | ||
def run_profiling(self, version, prog): | ||
"""Run profiling.""" | ||
if self.ready_to_profile: | ||
if self.get_args().roof_only: | ||
console_log( | ||
"roofline", "Generating pmc_perf.csv (roofline counters only)." | ||
) | ||
# Log profiling options and setup filtering | ||
super().run_profiling(version, prog) | ||
else: | ||
console_log("roofline", "Detected existing pmc_perf.csv") | ||
|
||
@demarcate | ||
def post_processing(self): | ||
"""Perform any post-processing steps prior to profiling.""" | ||
super().post_processing() | ||
|
||
if self.ready_to_profile: | ||
# Manually join each pmc_perf*.csv output | ||
self.join_prof() | ||
# Replace timestamp data to solve a known rocprof bug | ||
# replace_timestamps(self.get_args().path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.