2023-02-13 09:26:12 -06:00
##############################################################################bl
2023-02-13 13:47:11 -06:00
# MIT License
2023-02-13 14:50:24 -06:00
#
2025-01-23 13:09:32 -06:00
# Copyright (c) 2021 - 2025 Advanced Micro Devices, Inc. All Rights Reserved.
2023-02-13 14:50:24 -06:00
#
2022-11-04 14:49:36 -05:00
# 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:
2023-02-13 14:50:24 -06:00
#
2023-02-13 13:47:11 -06:00
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
2023-02-13 14:50:24 -06:00
#
2022-11-04 14:49:36 -05:00
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2023-02-13 13:47:11 -06:00
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2022-11-04 14:49:36 -05:00
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2023-02-13 13:47:11 -06:00
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
2023-02-13 09:26:12 -06:00
##############################################################################el
2022-11-04 14:49:36 -05:00
import argparse
2023-10-31 15:11:17 -05:00
import os
2025-03-10 14:42:56 -04:00
import re
2025-01-02 13:29:47 -08:00
import shutil
from pathlib import Path
2023-12-04 15:47:03 -06:00
2024-02-16 15:34:28 -06:00
2023-12-11 16:35:09 -06:00
def print_avail_arch ( avail_arch : list ) :
2025-06-06 12:43:52 -06:00
ret_str = " \t \t List all available metrics for analysis on specified arch: "
2023-12-04 15:47:03 -06:00
for arch in avail_arch :
2025-03-10 14:42:56 -04:00
ret_str + = " \n \t \t \t {} " . format ( arch )
2023-12-04 15:47:03 -06:00
return ret_str
2023-04-18 09:50:50 -05:00
2024-03-25 10:45:34 -05:00
2024-11-01 12:20:21 -04:00
def add_general_group ( parser , rocprof_compute_version ) :
2023-10-31 15:11:17 -05:00
general_group = parser . add_argument_group ( " General Options " )
2024-03-22 17:12:54 -05:00
2024-02-16 15:34:28 -06:00
general_group . add_argument (
2024-11-01 12:20:21 -04:00
" -v " ,
" --version " ,
action = " version " ,
version = rocprof_compute_version [ " ver_pretty " ] ,
2024-02-16 15:34:28 -06:00
)
2024-03-07 16:53:31 -06:00
general_group . add_argument (
" -V " ,
" --verbose " ,
help = " Increase output verbosity (use multiple times for higher levels) " ,
action = " count " ,
default = 0 ,
)
2024-03-22 17:12:54 -05:00
general_group . add_argument (
2024-04-01 12:46:54 -05:00
" -q " , " --quiet " , action = " store_true " , help = " Reduce output and run quietly. "
2024-03-22 17:12:54 -05:00
)
# Nowhere to load specs from in db mode
if " database " not in parser . usage :
general_group . add_argument (
2024-04-01 12:46:54 -05:00
" -s " , " --specs " , action = " store_true " , help = " Print system specs and exit. "
2024-03-22 17:12:54 -05:00
)
2024-03-25 10:45:34 -05:00
2024-11-01 12:20:21 -04:00
def omniarg_parser (
parser , rocprof_compute_home , supported_archs , rocprof_compute_version
) :
2024-03-22 17:12:54 -05:00
# -----------------------------------------
# Parse arguments (dependent on mode)
# -----------------------------------------
## General Command Line Options
## ----------------------------
2024-11-01 12:20:21 -04:00
add_general_group ( parser , rocprof_compute_version )
2024-03-22 17:12:54 -05:00
parser . _positionals . title = " Modes "
parser . _optionals . title = " Help "
2022-11-04 14:49:36 -05:00
2023-10-31 15:11:17 -05:00
subparsers = parser . add_subparsers (
2022-11-04 14:49:36 -05:00
dest = " mode " , help = " Select mode of interaction with the target application: "
)
## Profile Command Line Options
## ----------------------------
profile_parser = subparsers . add_parser (
" profile " ,
help = " Profile the target application " ,
usage = """
2024-11-01 12:20:21 -04:00
rocprof-compute profile --name <workload_name> [profile options] [roofline options] -- <profile_cmd>
2024-03-05 18:13:31 -06:00
---------------------------------------------------------------------------------
Examples:
2024-11-01 12:20:21 -04:00
\t rocprof-compute profile -n vcopy_all -- ./vcopy -n 1048576 -b 256
\t rocprof-compute profile -n vcopy_SPI_TCC -b SQ TCC -- ./vcopy -n 1048576 -b 256
\t rocprof-compute profile -n vcopy_kernel -k vecCopy -- ./vcopy -n 1048576 -b 256
\t rocprof-compute profile -n vcopy_disp -d 0 -- ./vcopy -n 1048576 -b 256
\t rocprof-compute profile -n vcopy_roof --roof-only -- ./vcopy -n 1048576 -b 256
2024-03-05 18:13:31 -06:00
---------------------------------------------------------------------------------
2023-10-31 15:11:17 -05:00
""" ,
2022-11-04 14:49:36 -05:00
prog = " tool " ,
allow_abbrev = False ,
formatter_class = lambda prog : argparse . RawTextHelpFormatter (
prog , max_help_position = 40
) ,
)
profile_parser . _optionals . title = " Help "
2023-10-31 15:11:17 -05:00
2024-11-01 12:20:21 -04:00
add_general_group ( profile_parser , rocprof_compute_version )
2022-11-04 14:49:36 -05:00
profile_group = profile_parser . add_argument_group ( " Profile Options " )
roofline_group = profile_parser . add_argument_group ( " Standalone Roofline Options " )
profile_group . add_argument (
" -n " ,
" --name " ,
type = str ,
metavar = " " ,
dest = " name " ,
help = " \t \t \t Assign a name to workload. " ,
)
profile_group . add_argument ( " --target " , type = str , default = None , help = argparse . SUPPRESS )
profile_group . add_argument (
" -p " ,
" --path " ,
metavar = " " ,
type = str ,
dest = " path " ,
2025-01-02 13:29:47 -08:00
default = str ( Path ( os . getcwd ( ) ) . joinpath ( " workloads " ) ) ,
2022-11-04 14:49:36 -05:00
required = False ,
help = " \t \t \t Specify path to save workload. \n \t \t \t (DEFAULT: {} /workloads/<name>) " . format (
os . getcwd ( )
) ,
)
2025-01-02 13:29:47 -08:00
profile_group . add_argument (
" --subpath " ,
metavar = " " ,
type = str ,
dest = " subpath " ,
default = " gpu " ,
required = False ,
help = " \t \t \t Specify the type of subpath to save workload: node_name, gpu_model. " ,
)
2025-01-29 13:14:57 -05:00
profile_group . add_argument (
" --hip-trace " ,
dest = " hip_trace " ,
required = False ,
default = False ,
action = " store_true " ,
help = " \t \t \t HIP trace, execturion trace for the entire application at the HIP level. " ,
)
profile_group . add_argument (
" --kokkos-trace " ,
dest = " kokkos_trace " ,
required = False ,
default = False ,
action = " store_true " ,
2025-03-06 10:54:46 -05:00
help = argparse . SUPPRESS ,
2025-03-10 14:42:56 -04:00
# help="\t\t\tKokkos trace, traces Kokkos API calls.",
2025-01-29 13:14:57 -05:00
)
2022-11-04 14:49:36 -05:00
profile_group . add_argument (
" -k " ,
" --kernel " ,
type = str ,
dest = " kernel " ,
metavar = " " ,
required = False ,
nargs = " + " ,
default = None ,
help = " \t \t \t Kernel filtering. " ,
)
2023-10-31 15:11:17 -05:00
profile_group . add_argument (
" -d " ,
" --dispatch " ,
type = str ,
metavar = " " ,
nargs = " + " ,
dest = " dispatch " ,
required = False ,
help = " \t \t \t Dispatch ID filtering. " ,
)
2025-03-10 14:42:56 -04:00
def validate_block ( value ) :
# Metric id regex, for example, 10, 4, 4.3, 4.32
# Dont allow more than two digits after decimal point
2025-03-11 13:34:48 -04:00
metric_id_pattern = re . compile ( r " ^ \ d+$|^ \ d+ \ . \ d$|^ \ d+ \ . \ d \ d$ " )
2025-03-10 14:42:56 -04:00
if metric_id_pattern . match ( value ) :
2025-07-21 09:37:35 -04:00
return value
raise argparse . ArgumentTypeError ( f " Invalid metric id: { value } " )
2025-03-10 14:42:56 -04:00
2023-10-31 15:11:17 -05:00
profile_group . add_argument (
" -b " ,
2024-03-04 16:41:40 -06:00
" --block " ,
2025-03-10 14:42:56 -04:00
type = validate_block ,
dest = " filter_blocks " ,
2023-10-31 15:11:17 -05:00
metavar = " " ,
nargs = " + " ,
required = False ,
2025-07-21 09:37:35 -04:00
default = [ ] ,
help = """ \t \t \t Specify metric id(s) from --list-metrics for filtering (e.g. 10, 4, 4.3). \n \t \t \t Can provide multiple space separated arguments. """ ,
2025-03-10 14:42:56 -04:00
)
profile_group . add_argument (
" --list-metrics " ,
metavar = " " ,
nargs = " ? " ,
const = " " ,
# Argument to --list-metrics is optional
choices = [ " " ] + list ( supported_archs . keys ( ) ) , # ["gfx906", "gfx908", "gfx90a"],
help = print_avail_arch ( supported_archs . keys ( ) ) ,
)
profile_group . add_argument (
" --config-dir " ,
dest = " config_dir " ,
metavar = " " ,
help = " \t \t \t Specify the directory of customized report section configs. " ,
default = rocprof_compute_home . joinpath ( " rocprof_compute_soc/analysis_configs/ " ) ,
2023-10-31 15:11:17 -05:00
)
2023-05-11 13:00:30 -05:00
profile_group . add_argument (
" --join-type " ,
metavar = " " ,
required = False ,
choices = [ " kernel " , " grid " ] ,
default = " grid " ,
help = " \t \t \t Choose how to join rocprof runs: (DEFAULT: grid) \n \t \t \t kernel (i.e. By unique kernel name dispatches) \n \t \t \t grid (i.e. By unique kernel name + grid size dispatches) " ,
)
2022-11-04 14:49:36 -05:00
profile_group . add_argument (
" --no-roof " ,
required = False ,
default = False ,
action = " store_true " ,
help = " \t \t \t Profile without collecting roofline data. " ,
)
profile_group . add_argument (
" remaining " ,
metavar = " -- [ ...] " ,
default = None ,
nargs = argparse . REMAINDER ,
help = " \t \t \t Provide command for profiling after double dash. " ,
)
2025-01-02 13:29:47 -08:00
profile_group . add_argument (
" --spatial-multiplexing " ,
type = int ,
metavar = " " ,
nargs = " + " ,
dest = " spatial_multiplexing " ,
required = False ,
default = None ,
help = " \t \t \t Provide Node ID and GPU number per node. " ,
)
profile_group . add_argument (
" --format-rocprof-output " ,
required = False ,
metavar = " " ,
dest = " format_rocprof_output " ,
choices = [ " json " , " csv " ] ,
default = " csv " ,
help = " \t \t \t Set the format of output file of rocprof. " ,
)
2022-11-04 14:49:36 -05:00
2025-06-06 12:43:52 -06:00
profile_group . add_argument (
" --pc-sampling-method " ,
required = False ,
metavar = " " ,
dest = " pc_sampling_method " ,
default = " stochastic " ,
help = " \t \t \t Set the method of pc sampling, stochastic or host_trap. Support stochastic only >= MI300 " ,
)
2025-03-28 16:51:49 -06:00
profile_group . add_argument (
" --pc-sampling-interval " ,
required = False ,
metavar = " " ,
dest = " pc_sampling_interval " ,
2025-06-06 12:43:52 -06:00
default = 1048576 ,
help = " \t \t \t Set the interval of pc sampling. \n \t \t \t For stochastic sampling, the interval is in cycles. \n \t \t \t For host_trap sampling, the interval is in microsecond (DEFAULT: 1048576). " ,
2025-03-28 16:51:49 -06:00
)
2025-05-13 10:48:21 -04:00
profile_group . add_argument (
" --rocprofiler-sdk-library-path " ,
type = str ,
dest = " rocprofiler_sdk_library_path " ,
required = False ,
default = " /opt/rocm/lib/librocprofiler-sdk.so " ,
help = " \t \t \t Set the path to rocprofiler SDK library. " ,
)
2022-11-04 14:49:36 -05:00
## Roofline Command Line Options
roofline_group . add_argument (
" --roof-only " ,
required = False ,
default = False ,
action = " store_true " ,
help = " \t \t \t Profile roofline data only. " ,
)
roofline_group . add_argument (
" --sort " ,
required = False ,
metavar = " " ,
type = str ,
default = " kernels " ,
2023-01-26 14:07:10 -06:00
choices = [ " kernels " , " dispatches " ] ,
2022-11-04 14:49:36 -05:00
help = " \t \t \t Overlay top kernels or top dispatches: (DEFAULT: kernels) \n \t \t \t kernels \n \t \t \t dispatches " ,
)
roofline_group . add_argument (
" -m " ,
" --mem-level " ,
required = False ,
choices = [ " HBM " , " L2 " , " vL1D " , " LDS " ] ,
metavar = " " ,
2023-01-26 14:07:10 -06:00
nargs = " + " ,
2022-11-04 14:49:36 -05:00
type = str ,
default = " ALL " ,
help = " \t \t \t Filter by memory level: (DEFAULT: ALL) \n \t \t \t HBM \n \t \t \t L2 \n \t \t \t vL1D \n \t \t \t LDS " ,
)
roofline_group . add_argument (
" --device " ,
metavar = " " ,
required = False ,
default = - 1 ,
type = int ,
2024-03-04 16:41:40 -06:00
help = " \t \t \t Target GPU device ID. (DEFAULT: ALL) " ,
2022-11-04 14:49:36 -05:00
)
2023-02-27 16:18:42 -06:00
roofline_group . add_argument (
" --kernel-names " ,
required = False ,
default = False ,
action = " store_true " ,
help = " \t \t \t Include kernel names in roofline plot. " ,
)
2025-03-25 15:02:09 -04:00
roofline_group . add_argument (
" -R " ,
" --roofline-data-type " ,
required = False ,
2025-05-26 18:36:31 -04:00
choices = [ " FP4 " , " FP6 " , " FP8 " , " FP16 " , " BF16 " , " FP32 " , " FP64 " , " I8 " , " I32 " , " I64 " ] ,
2025-03-25 15:02:09 -04:00
metavar = " " ,
nargs = " + " ,
type = str ,
default = [ " FP32 " ] ,
2025-06-06 12:43:52 -06:00
help = " \t \t \t Choose datatypes to view roofline PDFs for: (DEFAULT: FP32) \n \t \t \t FP4 \n \t \t \t FP6 \n \t \t \t FP8 \n \t \t \t FP16 \n \t \t \t BF16 \n \t \t \t FP32 \n \t \t \t FP64 \n \t \t \t I8 \n \t \t \t I32 \n \t \t \t I64 \n \t \t \t " ,
2025-03-25 15:02:09 -04:00
)
2022-11-04 14:49:36 -05:00
# roofline_group.add_argument('-w', '--workgroups', required=False, default=-1, type=int, help="\t\t\tNumber of kernel workgroups (DEFAULT: 1024)")
# roofline_group.add_argument('--wsize', required=False, default=-1, type=int, help="\t\t\tWorkgroup size (DEFAULT: 256)")
# roofline_group.add_argument('--dataset', required=False, default = -1, type=int, help="\t\t\tDataset size (DEFAULT: 536M)")
# roofline_group.add_argument('-e', '--experiments', required=False, default=-1, type=int, help="\t\t\tNumber of experiments (DEFAULT: 100)")
# roofline_group.add_argument('--iter', required=False, default=-1, type=int, help="\t\t\tNumber of iterations (DEFAULT: 10)")
## Database Command Line Options
## ----------------------------
db_parser = subparsers . add_parser (
" database " ,
2024-11-01 12:20:21 -04:00
help = " Interact with rocprofiler-compute database " ,
2022-11-04 14:49:36 -05:00
usage = """
2024-11-01 12:20:21 -04:00
\n rocprof-compute database <interaction type> [connection options]
2022-11-04 14:49:36 -05:00
2023-10-31 15:11:17 -05:00
\n \n -------------------------------------------------------------------------------
\n Examples:
2024-11-01 12:20:21 -04:00
\n \t rocprof-compute database --import -H pavii1 -u temp -t asw -w workloads/vcopy/mi200/
\n \t rocprof-compute database --remove -H pavii1 -u temp -w rocprofiler-compute_asw_sample_mi200
2023-10-31 15:11:17 -05:00
\n ------------------------------------------------------------------------------- \n
""" ,
2022-11-04 14:49:36 -05:00
prog = " tool " ,
allow_abbrev = False ,
formatter_class = lambda prog : argparse . RawTextHelpFormatter (
prog , max_help_position = 40
) ,
)
db_parser . _optionals . title = " Help "
2024-11-01 12:20:21 -04:00
add_general_group ( db_parser , rocprof_compute_version )
2022-11-04 14:49:36 -05:00
interaction_group = db_parser . add_argument_group ( " Interaction Type " )
connection_group = db_parser . add_argument_group ( " Connection Options " )
interaction_group . add_argument (
" -i " ,
" --import " ,
required = False ,
dest = " upload " ,
action = " store_true " ,
2024-11-01 12:20:21 -04:00
help = " \t \t \t \t Import workload to rocprofiler-compute DB " ,
2022-11-04 14:49:36 -05:00
)
interaction_group . add_argument (
" -r " ,
" --remove " ,
required = False ,
dest = " remove " ,
action = " store_true " ,
2024-11-01 12:20:21 -04:00
help = " \t \t \t \t Remove a workload from rocprofiler-compute DB " ,
2022-11-04 14:49:36 -05:00
)
connection_group . add_argument (
" -H " ,
" --host " ,
required = True ,
metavar = " " ,
help = " \t \t \t \t Name or IP address of the server host. " ,
)
connection_group . add_argument (
" -P " ,
" --port " ,
required = False ,
metavar = " " ,
help = " \t \t \t \t TCP/IP Port. (DEFAULT: 27018) " ,
default = 27018 ,
)
connection_group . add_argument (
" -u " ,
" --username " ,
required = True ,
metavar = " " ,
help = " \t \t \t \t Username for authentication. " ,
)
connection_group . add_argument (
" -p " ,
" --password " ,
metavar = " " ,
help = " \t \t \t \t The user ' s password. (will be requested later if it ' s not set) " ,
default = " " ,
)
connection_group . add_argument (
" -t " , " --team " , required = False , metavar = " " , help = " \t \t \t \t Specify Team prefix. "
)
connection_group . add_argument (
" -w " ,
" --workload " ,
required = True ,
metavar = " " ,
dest = " workload " ,
help = " \t \t \t \t Specify name of workload (to remove) or path to workload (to import) " ,
)
2024-03-12 15:54:52 -05:00
connection_group . add_argument (
" --kernel-verbose " ,
required = False ,
metavar = " " ,
help = " \t \t Specify Kernel Name verbose level 1-5. Lower the level, shorter the kernel name. (DEFAULT: 5) (DISABLE: 5) " ,
default = 5 ,
type = int ,
)
2022-11-04 14:49:36 -05:00
## Analyze Command Line Options
## ----------------------------
analyze_parser = subparsers . add_parser (
" analyze " ,
help = " Analyze existing profiling results at command line " ,
usage = """
2024-11-01 12:20:21 -04:00
rocprof-compute analyze --path <workload_path> [analyze options]
2022-11-04 14:49:36 -05:00
2024-03-15 09:24:34 -05:00
-----------------------------------------------------------------------------------
Examples:
2024-11-01 12:20:21 -04:00
\t rocprof-compute analyze -p workloads/vcopy/mi200/ --list-metrics gfx90a
\t rocprof-compute analyze -p workloads/mixbench/mi200/ --dispatch 12 34 --decimal 3
\t rocprof-compute analyze -p workloads/mixbench/mi200/ --gui
2024-03-15 09:24:34 -05:00
-----------------------------------------------------------------------------------
2023-10-31 15:11:17 -05:00
""" ,
2022-11-04 14:49:36 -05:00
prog = " tool " ,
allow_abbrev = False ,
formatter_class = lambda prog : argparse . RawTextHelpFormatter (
prog , max_help_position = 40
) ,
)
analyze_parser . _optionals . title = " Help "
2024-11-01 12:20:21 -04:00
add_general_group ( analyze_parser , rocprof_compute_version )
2022-11-04 14:49:36 -05:00
analyze_group = analyze_parser . add_argument_group ( " Analyze Options " )
2023-10-31 15:11:17 -05:00
analyze_advanced_group = analyze_parser . add_argument_group ( " Advanced Options " )
2022-11-04 14:49:36 -05:00
analyze_group . add_argument (
" -p " ,
" --path " ,
dest = " path " ,
required = False ,
metavar = " " ,
nargs = " + " ,
action = " append " ,
help = " \t \t Specify the raw data root dirs or desired results directory. " ,
)
analyze_group . add_argument (
2024-02-13 19:17:41 -06:00
" --list-stats " ,
2023-02-07 14:30:03 -06:00
action = " store_true " ,
2024-02-13 19:17:41 -06:00
help = " \t \t List all detected kernels and kernel dispatches. " ,
2022-11-04 14:49:36 -05:00
)
analyze_group . add_argument (
" --list-metrics " ,
metavar = " " ,
2024-02-16 15:34:28 -06:00
choices = supported_archs . keys ( ) , # ["gfx906", "gfx908", "gfx90a"],
2023-12-11 16:35:09 -06:00
help = print_avail_arch ( supported_archs . keys ( ) ) ,
2022-11-04 14:49:36 -05:00
)
analyze_group . add_argument (
" -k " ,
2023-02-10 16:38:55 -06:00
" --kernel " ,
2022-11-04 14:49:36 -05:00
metavar = " " ,
type = int ,
dest = " gpu_kernel " ,
nargs = " + " ,
action = " append " ,
2024-10-21 09:10:12 -07:00
help = " \t \t Specify kernel id(s) from --list-stats for filtering. " ,
2022-11-04 14:49:36 -05:00
)
analyze_group . add_argument (
2023-08-16 13:48:31 -05:00
" -d " ,
2023-02-10 16:38:55 -06:00
" --dispatch " ,
2022-11-04 14:49:36 -05:00
dest = " gpu_dispatch_id " ,
metavar = " " ,
nargs = " + " ,
action = " append " ,
2023-02-10 16:38:55 -06:00
help = " \t \t Specify dispatch id(s) for filtering. " ,
2022-11-04 14:49:36 -05:00
)
2023-10-31 15:11:17 -05:00
analyze_group . add_argument (
" -b " ,
2024-03-04 16:41:40 -06:00
" --block " ,
2023-10-31 15:11:17 -05:00
dest = " filter_metrics " ,
metavar = " " ,
nargs = " + " ,
2025-03-10 14:42:56 -04:00
help = " \t \t Specify metric id(s) from --list-metrics for filtering. " ,
2023-10-31 15:11:17 -05:00
)
2022-11-04 14:49:36 -05:00
analyze_group . add_argument (
2023-02-10 16:38:55 -06:00
" --gpu-id " ,
2022-11-04 14:49:36 -05:00
dest = " gpu_id " ,
metavar = " " ,
nargs = " + " ,
2023-02-10 16:38:55 -06:00
help = " \t \t Specify GPU id(s) for filtering. " ,
2022-11-04 14:49:36 -05:00
)
2025-02-13 16:47:25 -05:00
analyze_group . add_argument (
" --spatial-multiplexing " ,
dest = " spatial_multiplexing " ,
required = False ,
default = False ,
action = " store_true " ,
2025-06-06 12:43:52 -06:00
help = " \t \t Mode of spatial multiplexing. " ,
2025-02-13 16:47:25 -05:00
)
2022-11-04 14:49:36 -05:00
analyze_group . add_argument (
2023-10-31 15:11:17 -05:00
" -o " ,
" --output " ,
2022-11-04 14:49:36 -05:00
metavar = " " ,
2023-10-31 15:11:17 -05:00
dest = " output_file " ,
help = " \t \t Specify an output file to save analysis results. " ,
2022-11-04 14:49:36 -05:00
)
2023-05-03 11:46:17 -06:00
analyze_group . add_argument (
2023-10-31 15:11:17 -05:00
" --gui " ,
type = int ,
nargs = " ? " ,
const = 8050 ,
2024-11-01 12:20:21 -04:00
help = " \t \t Activate a GUI to interate with rocprofiler-compute metrics. \n \t \t Optionally, specify port to launch application (DEFAULT: 8050) " ,
2023-10-31 15:11:17 -05:00
)
2025-06-04 17:06:08 -04:00
analyze_group . add_argument (
" --tui " ,
action = " store_true " ,
help = " \t \t Activate a Textual User Interface (TUI) to interact with rocprofiler-compute metrics. " ,
)
2025-04-07 12:10:37 -04:00
analyze_group . add_argument (
" -R " ,
" --roofline-data-type " ,
required = False ,
2025-05-26 18:36:31 -04:00
choices = [ " FP4 " , " FP6 " , " FP8 " , " FP16 " , " BF16 " , " FP32 " , " FP64 " , " I8 " , " I32 " , " I64 " ] ,
2025-04-07 12:10:37 -04:00
metavar = " " ,
nargs = " + " ,
type = str ,
default = [ " FP32 " ] ,
2025-06-06 12:43:52 -06:00
help = " \t \t Choose datatypes to view roofline PDFs for: (DEFAULT: FP32) \n \t \t \t FP4 \n \t \t \t FP6 \n \t \t \t FP8 \n \t \t \t FP16 \n \t \t \t BF16 \n \t \t \t FP32 \n \t \t \t FP64 \n \t \t \t I8 \n \t \t \t I32 \n \t \t \t I64 \n \t \t \t " ,
)
analyze_group . add_argument (
" --pc-sampling-sorting-type " ,
required = False ,
metavar = " " ,
dest = " pc_sampling_sorting_type " ,
default = " offset " ,
type = str ,
help = " \t \t Set the sorting type of pc sampling: offset or count (DEFAULT: offset). " ,
2025-04-07 12:10:37 -04:00
)
2023-10-31 15:11:17 -05:00
analyze_advanced_group . add_argument (
" --random-port " ,
action = " store_true " ,
help = " \t \t Randomly generate a port to launch GUI application. \n \t \t Registered Ports range inclusive (1024-49151). " ,
)
analyze_advanced_group . add_argument (
2024-02-13 19:17:41 -06:00
" --max-stat-num " ,
dest = " max_stat_num " ,
2023-05-03 11:46:17 -06:00
metavar = " " ,
type = int ,
default = 10 ,
2024-02-16 15:34:28 -06:00
help = ' \t \t Specify the maximum number of stats shown in " Top Stats " tables (DEFAULT: 10) ' ,
2023-05-03 11:46:17 -06:00
)
2023-10-31 15:11:17 -05:00
analyze_advanced_group . add_argument (
" -n " ,
" --normal-unit " ,
dest = " normal_unit " ,
2022-11-04 14:49:36 -05:00
metavar = " " ,
2025-02-27 12:46:47 -07:00
default = " per_kernel " ,
2023-10-31 15:11:17 -05:00
choices = [ " per_wave " , " per_cycle " , " per_second " , " per_kernel " ] ,
2025-02-27 12:46:47 -07:00
help = " \t \t Specify the normalization unit: (DEFAULT: per_kernel) \n \t \t per_wave \n \t \t per_cycle \n \t \t per_second \n \t \t per_kernel " ,
2022-11-04 14:49:36 -05:00
)
2023-10-31 15:11:17 -05:00
analyze_advanced_group . add_argument (
2022-11-04 14:49:36 -05:00
" -t " ,
" --time-unit " ,
dest = " time_unit " ,
metavar = " " ,
default = " ns " ,
choices = [ " s " , " ms " , " us " , " ns " ] ,
help = " \t \t Specify display time unit in kernel top stats: (DEFAULT: ns) \n \t \t s \n \t \t ms \n \t \t us \n \t \t ns " ,
)
2023-10-31 15:11:17 -05:00
analyze_advanced_group . add_argument (
2022-11-04 14:49:36 -05:00
" --decimal " ,
type = int ,
metavar = " " ,
default = 2 ,
2023-10-31 15:11:17 -05:00
help = " \t \t Specify desired decimal precision of analysis results. (DEFAULT: 2) " ,
2022-11-04 14:49:36 -05:00
)
2023-10-31 15:11:17 -05:00
analyze_advanced_group . add_argument (
" --config-dir " ,
dest = " config_dir " ,
metavar = " " ,
help = " \t \t Specify the directory of customized configs. " ,
2024-11-01 12:20:21 -04:00
default = rocprof_compute_home . joinpath ( " rocprof_compute_soc/analysis_configs/ " ) ,
2023-10-31 15:11:17 -05:00
)
analyze_advanced_group . add_argument (
2023-05-03 17:45:29 -06:00
" --save-dfs " ,
dest = " df_file_dir " ,
metavar = " " ,
help = " \t \t Specify the dirctory to save analysis dataframe csv files. " ,
)
2023-10-31 15:11:17 -05:00
analyze_advanced_group . add_argument (
2022-11-04 14:49:36 -05:00
" --cols " ,
type = int ,
dest = " cols " ,
metavar = " " ,
nargs = " + " ,
help = " \t \t Specify column indices to display. " ,
)
2024-02-16 15:34:28 -06:00
analyze_advanced_group . add_argument (
" -g " , dest = " debug " , action = " store_true " , help = " \t \t Debug single metric. "
)
2023-10-31 15:11:17 -05:00
analyze_advanced_group . add_argument (
2024-11-01 12:20:21 -04:00
" --dependency " ,
action = " store_true " ,
help = " \t \t List the installation dependency. " ,
2022-11-04 14:49:36 -05:00
)
2023-10-31 15:11:17 -05:00
analyze_advanced_group . add_argument (
" --kernel-verbose " ,
2023-08-10 11:13:27 -05:00
required = False ,
metavar = " " ,
2023-08-15 14:00:36 -05:00
help = " \t \t Specify Kernel Name verbose level 1-5. Lower the level, shorter the kernel name. (DEFAULT: 5) (DISABLE: 5) " ,
default = 5 ,
2023-08-10 11:13:27 -05:00
type = int ,
)
2023-10-31 15:11:17 -05:00
analyze_advanced_group . add_argument (
2023-10-04 16:15:48 -05:00
" --report-diff " , default = 0 , nargs = " ? " , type = int , help = argparse . SUPPRESS
2024-01-15 12:24:28 -06:00
)
analyze_advanced_group . add_argument (
" --specs-correction " ,
type = str ,
metavar = " " ,
2025-04-03 02:21:18 -04:00
help = " \t \t Specify the specs to correct. e.g. --specs-correction= ' specname1:specvalue1,specname2:specvalue2 ' " ,
2024-02-16 15:34:28 -06:00
)
2025-01-02 13:29:47 -08:00
analyze_advanced_group . add_argument (
" --list-nodes " ,
action = " store_true " ,
help = " \t \t Multi-node option: list all node names. " ,
)
analyze_advanced_group . add_argument (
" --nodes " ,
metavar = " " ,
type = str ,
dest = " nodes " ,
nargs = " * " ,
help = " \t \t Multi-node option: filter with node names. Enable it without node names means ALL. " ,
)