[rocprofiler-compute] Add database output format to analyze mode (#748)

Analysis data dump

* Add `--output-format` and `--output-name` option to analyze mode

* Remove `--output` and `-save-dfs` option to analyze mode

* Add documentation on `rocpd` output format and analysis database file

* Create sqlite3 database using object relation mapping (ORM) provided
  by sqlalchemy library

* Fix metrics config to remove metrics marked as `null`, fix `Unit` header, add
  missing `title`

* Add test cases to ensure analysis data dump work
이 커밋은 다음에 포함됨:
vedithal-amd
2025-08-26 14:15:05 -04:00
커밋한 사람 GitHub
부모 09cfa97156
커밋 323d06c79c
41개의 변경된 파일과 1130개의 추가작업 그리고 117개의 파일을 삭제
+1 -1
파일 보기
@@ -213,4 +213,4 @@ extlinks = {
}
# Uncomment if facing rate limit exceed issue with local build
external_projects_remote_repository = ""
# external_projects_remote_repository = ""
바이너리 파일은 표시되지 않음.

이후

너비:  |  높이:  |  크기: 66 KiB

바이너리 파일은 표시되지 않음.

이후

너비:  |  높이:  |  크기: 17 KiB

+102
파일 보기
@@ -318,10 +318,12 @@ Per-kernel roofline analysis
When analyzing specific kernels, the roofline analysis provides detailed metrics for each filtered kernel:
.. code-block:: shell-session
$ rocprof-compute analyze -p workloads/vcopy/MI200/ -k 0 -b 4
This generates enhanced roofline output showing per-kernel performance rates and arithmetic intensity calculations:
.. code-block:: text
================================================================================
4. Roofline
================================================================================
@@ -372,6 +374,7 @@ Per-kernel roofline analysis
Analyze multiple kernels for comparison:
.. code-block:: shell-session
$ rocprof-compute analyze -p workloads/vcopy/MI200/ -k 0 1 2 -b 4
Baseline comparison
@@ -384,3 +387,102 @@ Baseline comparison
.. code-block:: shell
rocprof-compute analyze -p workload1/path/ -k 0 -p workload2/path/ -k 1
Analysis output format
======================
Use the ``--output-format <format>`` analyze mode option to specify the output format of the
analysis report. Supported formats are ``stdout``, ``txt``, ``csv``, and ``db``. The default output
format is ``stdout``.
* ``stdout`` format:
* Print analysis report to the terminal.
* NOTE: This option will not generate any file or folder.
* ``txt`` format:
* Generate a file named ``rocprof_compute_<uuid>.txt`` in the current working directory.
* This file contains the entire analysis report as printed on the terminal.
* This is useful in case of searching across long analysis reports.
* NOTE: This option will disable output of analysis report to terminal.
* ``csv`` format:
* Generate a folder named ``rocprof_compute_<uuid>`` in the current working directory.
* This folder contains multiple csv files representing the data in each metric table in the analysis report.
* This is useful for further programmatic analysis of analysis reports.
* NOTE: This will print the analysis report to the terminal as well.
* ``db`` format:
* NOTE: This only works when provided workload paths are created using ``--format-rocprof-output rocpd`` profile mode option.
* Generate a file named ``rocprof_compute_<uuid>.db`` in the current working directory.
* This is a SQLite database file containing all the data in the analysis report structured according to :ref:`analysis database schema <analysis-database>`.
* This is useful for further programmatic analysis of analysis reports.
* NOTE: This option will disable output of analysis report to terminal.
Default file/folder name ``rocprofiler_compute_<uuid>`` can be overriden using ``--output-name <name>`` analyze mode option.
.. _analysis-database:
Analysis database schema
========================
Analysis database tables
.. image:: ../../data/analyze/analysis_data_dump_schema.png
:align: center
:alt: Analysis database tables
Analysis database views
.. image:: ../../data/analyze/analysis_data_dump_views.png
:align: center
:alt: Analysis database views
Analysis database example
.. note::
Some metrics cannot be calculated when corresponding counters are missing as shown in the warnings below
.. note::
It is possible to merge the analysis data dump for multiple workload folders (resulting from multiple profiles) by repeating ``-p`` option for each workload
.. code-block:: shell-session
$ rocprof-compute analyze --verbose --db test -p workloads/vmem/MI300X_A1 -p workloads/vmem1/MI300X_A1
DEBUG Execution mode = analyze
__ _
_ __ ___ ___ _ __ _ __ ___ / _| ___ ___ _ __ ___ _ __ _ _| |_ ___
| '__/ _ \ / __| '_ \| '__/ _ \| |_ _____ / __/ _ \| '_ ` _ \| '_ \| | | | __/ _ \
| | | (_) | (__| |_) | | | (_) | _|_____| (_| (_) | | | | | | |_) | |_| | || __/
|_| \___/ \___| .__/|_| \___/|_| \___\___/|_| |_| |_| .__/ \__,_|\__\___|
|_| |_|
INFO Analysis mode = db
DEBUG [omnisoc init]
DEBUG [omnisoc init]
DEBUG [analysis] prepping to do some analysis
INFO [analysis] deriving rocprofiler-compute metrics...
WARNING Roofline ceilings not found for /app/projects/rocprofiler-compute/workloads/vmem/MI300X_A1.
WARNING Roofline ceilings not found for /app/projects/rocprofiler-compute/workloads/vmem1/MI300X_A1.
WARNING PC sampling data not found for /app/projects/rocprofiler-compute/workloads/vmem/MI300X_A1.
WARNING PC sampling data not found for /app/projects/rocprofiler-compute/workloads/vmem1/MI300X_A1.
DEBUG Collected dispatch data
DEBUG Applied analysis mode filters
DEBUG Calculated dispatch data
DEBUG Collected metrics data
WARNING Failed to evaluate expression for 3.1.25 - Value: to_round(to_avg(
(pmc_df.get("TCP_TCP_LATENCY_sum") / pmc_df.get("TCP_TA_TCP_STATE_READ_sum")).where((pmc_df.get("TCP_TA_TCP_STATE_READ_sum") != 0), None)), 0) - unsupported operand type(s) for /: 'NoneType' and 'float'
WARNING Failed to evaluate expression for 3.1.39 - Value: to_round((to_avg(
(pmc_df.get("pmc_perf_ACCUM") / pmc_df.get("SQC_ICACHE_REQ")).where((pmc_df.get("SQC_ICACHE_REQ") != 0), None)) * 100), 0) - unsupported operand type(s) for /: 'NoneType' and 'float'
WARNING Failed to evaluate expression for 3.1.25 - Value: to_round(to_avg(
(pmc_df.get("TCP_TCP_LATENCY_sum") / pmc_df.get("TCP_TA_TCP_STATE_READ_sum")).where((pmc_df.get("TCP_TA_TCP_STATE_READ_sum") != 0), None)), 0) - unsupported operand type(s) for /: 'NoneType' and 'float'
WARNING Failed to evaluate expression for 3.1.39 - Value: to_round((to_avg(
(pmc_df.get("pmc_perf_ACCUM") / pmc_df.get("SQC_ICACHE_REQ")).where((pmc_df.get("SQC_ICACHE_REQ") != 0), None)) * 100), 0) - unsupported operand type(s) for /: 'NoneType' and 'float'
DEBUG Calculated metric values
DEBUG Calculated roofline data points
DEBUG [analysis] generating analysis
DEBUG SQLite database initialized with name: test.db
DEBUG Initialized database: test.db
DEBUG Completed writing database
+1 -1
파일 보기
@@ -22,7 +22,7 @@ options.
* :doc:`cli`
* :doc:`grafana-gui`
* :doc:`standalone-gui`
* :doc:`text-based user interface (TUI)`
* :doc:`tui`
.. note::
+35
파일 보기
@@ -24,6 +24,15 @@ Profiling with ROCm Compute Profiler yields the following benefits.
* :ref:`Automate counter collection <profiling-routine>`: ROCm Compute Profiler handles all
of your profiling via pre-configured input files.
* :ref:`Profiling output format <profiling-output-format>`: ROCm Compute Profile can adjust the
output format of underlying rocprof tool which changes the output format of raw performance
counter data in the workload folder created during profiling. Supported output formats are
``json``, ``csv``, and ``rocpd``. The default output format is ``csv``.
.. note::
The default output format will be changed to ``rocpd`` in a future release of ROCm Compute Profiler.
* :ref:`Filtering <filtering>`: Apply runtime filters to speed up the profiling
process.
@@ -217,6 +226,32 @@ an Instinct MI210 vs an Instinct MI250.
-rw-r--r-- 1 auser agroup 650 Mar 1 15:15 sysinfo.csv
-rw-r--r-- 1 auser agroup 399 Mar 1 15:15 timestamps.csv
.. _profiling-output-format:
Profiling output format
-----------------------
Use the ``--format-rocprof-output <format>`` profile mode option to specify the output format
of the underlying ``rocprof`` tool. The following formats are supported:
* ``csv`` format:
* Ask underlying rocprof tool to dump raw performance counter data in csv format.
* The generated csv files across multiple runs of rocprof are processed and dumped into the workload directory as csv files.
* Multiple csv files are merged into single pmc_perf.csv file in workload directory.
* ``json`` format:
* Ask underlying rocprof tool to dump raw performance counter data in json format.
* The generated json files across multiple runs of rocprof are processed and dumped into the workload directory as csv files.
* Multiple csv files are merged into single pmc_perf.csv file in workload directory.
* ``rocpd`` format:
* Ask underlying rocprof tool to dump raw performance counter data in rocpd format.
* Multiple ``rocpd`` database files containding counter collection data are merged into a single csv under the workload folder.
The database files are then removed.
* Use ``--retain-rocpd-output`` profile mode option to preserve the ``rocpd`` database(s) in the workload folder.
This is useful for custom analysis of profiling data.
.. _filtering:
Filtering