rocprofv3: support specifying HW counters via command line (#1130)
* rocprofv3: support specifying PMC counters via command line
- E.g. `rocprofv3 --pmc SQ_WAVES -- <app>`
* Update CHANGELOG
* updated rocprofv3 help and documentation
---------
Co-authored-by: Gopesh Bhardwaj <gopesh.bhardwaj@amd.com>
[ROCm/rocprofiler-sdk commit: d93d4d9463]
这个提交包含在:
@@ -106,6 +106,7 @@ Full documentation for ROCprofiler-SDK is available at [Click Here](source/docs/
|
||||
- Adding start and end timestamp columns to the counter collection csv output.
|
||||
- Changed naming of agent profiling to device counting service (which more closely follows its name). To convert existing tool/user code to the new names, the following sed can be used: `find . -type f -exec sed -i 's/rocprofiler_agent_profile_callback_t/rocprofiler_device_counting_service_callback_t/g; s/rocprofiler_configure_agent_profile_counting_service/rocprofiler_configure_device_counting_service/g; s/agent_profile.h/device_counting_service.h/g; s/rocprofiler_sample_agent_profile_counting_service/rocprofiler_sample_device_counting_service/g' {} +`
|
||||
- Changed naming of dispatch profiling service to dispatch counting service (which more closely follows its name). To convert existing tool/user code to the new names, the following sed can be used: `-type f -exec sed -i -e 's/dispatch_profile_counting_service/dispatch_counting_service/g' -e 's/dispatch_profile.h/dispatch_counting_service.h/g' -e 's/rocprofiler_profile_counting_dispatch_callback_t/rocprofiler_dispatch_counting_service_callback_t/g' -e 's/rocprofiler_profile_counting_dispatch_data_t/rocprofiler_dispatch_counting_service_data_t/g' -e 's/rocprofiler_profile_counting_dispatch_record_t/rocprofiler_dispatch_counting_service_record_t/g' {} +`
|
||||
- Support specifying HW counters via command-line in rocprofv3, e.g. `rocprofv3 --pmc [COUNTER [COUNTER ...]]`
|
||||
|
||||
### Fixes
|
||||
|
||||
@@ -120,5 +121,6 @@ Full documentation for ROCprofiler-SDK is available at [Click Here](source/docs/
|
||||
- Fix to handle a range of values for select() dimension in expressions parser.
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed gfx8 metric definitions.
|
||||
- Removed rocprofv3 installation to sbin directory.
|
||||
|
||||
@@ -100,7 +100,7 @@ For MPI applications (or other job launchers such as SLURM), place rocprofv3 ins
|
||||
io_options.add_argument(
|
||||
"-i",
|
||||
"--input",
|
||||
help="Input file for counter collection",
|
||||
help="Input file for run configuration (JSON or YAML) or counter collection (TXT)",
|
||||
required=False,
|
||||
)
|
||||
io_options.add_argument(
|
||||
@@ -227,6 +227,18 @@ For MPI applications (or other job launchers such as SLURM), place rocprofv3 ins
|
||||
help="For collecting HSA API Traces (Finalizer-extension API), e.g. HSA functions prefixed with only 'hsa_ext_program_' (i.e. hsa_ext_program_create).",
|
||||
)
|
||||
|
||||
counter_collection_options = parser.add_argument_group("Counter collection options")
|
||||
|
||||
counter_collection_options.add_argument(
|
||||
"--pmc",
|
||||
help=(
|
||||
"Specify Performance Monitoring Counters to collect(comma OR space separated in case of more than 1 counters). "
|
||||
"Note: job will fail if entire set of counters cannot be collected in single pass"
|
||||
),
|
||||
default=None,
|
||||
nargs="*",
|
||||
)
|
||||
|
||||
post_processing_options = parser.add_argument_group("Post-processing tracing options")
|
||||
|
||||
add_parser_bool_argument(
|
||||
@@ -644,7 +656,7 @@ def run(app_args, args, **kwargs):
|
||||
|
||||
update_env("ROCPROF_OUTPUT_FILE_NAME", _output_file)
|
||||
update_env("ROCPROF_OUTPUT_PATH", _output_path)
|
||||
if app_pass is not None:
|
||||
if app_pass is not None and args.sub_directory is not None:
|
||||
app_env["ROCPROF_OUTPUT_PATH"] = os.path.join(
|
||||
f"{_output_path}", f"{args.sub_directory}{app_pass}"
|
||||
)
|
||||
@@ -885,7 +897,7 @@ def main(argv=None):
|
||||
if len(inp_args) == 1:
|
||||
args = get_args(cmd_args, inp_args[0])
|
||||
pass_idx = None
|
||||
if hasattr(args, "pmc") and args.pmc is not None and len(args.pmc) > 0:
|
||||
if has_set_attr(args, "pmc") and len(args.pmc) > 0:
|
||||
pass_idx = 1
|
||||
run(app_args, args, pass_id=pass_idx)
|
||||
else:
|
||||
|
||||
@@ -542,6 +542,21 @@ Properties
|
||||
- WRITE_SIZE
|
||||
|
||||
|
||||
Command-Line
|
||||
+++++++++++++
|
||||
|
||||
Desired counters can now be collected as ``command-line`` option as well.
|
||||
|
||||
To supply the counters via ``command-line`` options, use:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
rocprofv3 --pmc SQ_WAVES GRBM_COUNT GRBM_GUI_ACTIVE -- <app_relative_path>
|
||||
|
||||
.. note::
|
||||
1. Please note that more than 1 counters should be separated by a space or a comma.
|
||||
2. Job will fail if entire set of counters cannot be collected in single pass
|
||||
|
||||
Kernel profiling output
|
||||
+++++++++++++++++++++++++
|
||||
|
||||
|
||||
@@ -55,3 +55,43 @@ foreach(_DIR "pmc_1" "pmc_2" "pmc_3" "pmc_4")
|
||||
"rocprofv3-test-tracing-plus-cc-execute" FAIL_REGULAR_EXPRESSION
|
||||
"${ROCPROFILER_DEFAULT_FAIL_REGEX}")
|
||||
endforeach()
|
||||
|
||||
set(cmdl_single "GRBM_COUNT")
|
||||
set(cmdl_multiple "SQ_WAVES" "GRBM_GUI_ACTIVE" "SQ_CYCLES:device=16384"
|
||||
"SQ_BUSY_CYCLES:device=65536")
|
||||
|
||||
foreach(_GROUP "single" "multiple")
|
||||
|
||||
set(_TEST_NAME_PREFIX rocprofv3-test-tracing-plus-counter-collection-cmdl-${_GROUP})
|
||||
|
||||
add_test(
|
||||
NAME ${_TEST_NAME_PREFIX}-execute
|
||||
COMMAND
|
||||
$<TARGET_FILE:rocprofiler-sdk::rocprofv3> --hip-trace --hsa-trace --pmc
|
||||
${cmdl_${_GROUP}} -d ${CMAKE_CURRENT_BINARY_DIR}/out_cc_trace -o
|
||||
cmdl/${_GROUP} --output-format JSON PFTRACE CSV --
|
||||
$<TARGET_FILE:simple-transpose>)
|
||||
|
||||
set_tests_properties(
|
||||
${_TEST_NAME_PREFIX}-execute
|
||||
PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${cc-tracing-env}"
|
||||
FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}")
|
||||
|
||||
set(_TEST_OUTPUT_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/out_cc_trace/cmdl/${_GROUP})
|
||||
|
||||
add_test(
|
||||
NAME ${_TEST_NAME_PREFIX}-validate
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input
|
||||
"${_TEST_OUTPUT_PREFIX}_results.json" --pftrace-input
|
||||
"${_TEST_OUTPUT_PREFIX}_results.pftrace" --hsa-input
|
||||
"${_TEST_OUTPUT_PREFIX}_hsa_api_trace.csv" --agent-input
|
||||
"${_TEST_OUTPUT_PREFIX}_agent_info.csv" --counter-input
|
||||
"${_TEST_OUTPUT_PREFIX}_counter_collection.csv")
|
||||
|
||||
set_tests_properties(
|
||||
${_TEST_NAME_PREFIX}-validate
|
||||
PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS
|
||||
"${_TEST_NAME_PREFIX}-execute" FAIL_REGULAR_EXPRESSION
|
||||
"${ROCPROFILER_DEFAULT_FAIL_REGEX}")
|
||||
endforeach()
|
||||
|
||||
在新工单中引用
屏蔽一个用户