Analysis report block based filtering for profiling (#566)

* Analysis report block based filtering for profiling

* Profiling mode changes

- `-b` option now additionally accepts metric id(s), similar to `-b` option in analyze mode (e.g. 6, 6.2, 6.23)
    - Only counters mentioned in the selected analysis report blocks will be collected
        - Add parsing logic to identify hardware counters from analysis report blocks
        - Add filtering logic to only write filtered counters in perfmon files
        - Log not collected counters in one line
- `--list-metrics` option added in profile mode to list possible metric id(s) similar to analyze mode
- Write arguments provided during profiling in profiling_configuration.yaml file

* Analysis mode changes

- During analysis mode, only show report blocks selected during profiling
    - If `-b` option is provided in analysis mode, then follow provided filters
- Do not show empty tables in analysis report

* Miscellaneous changes

- Update CHANGELOG
- Add test cases
    - Instruction mix report block filter
    - Instruction mix and Memory chart report block filter
    - Instruction mix report block filter and CPC hardware block filter
    - TA hardware block filter
    - --list-metrics in profile mode should work
- Move binary handler fixtures to conftest.py to avoid importing
  fixtures
- cmake file in tests directory has been updated to compile sample/vmem.hip for testing

* Public documentation changes

- Use the term "Hardware report block" instead of "Hardware block"
- Add documentation for "--list-metrics" option in profile mode
- Add example of filtering by hardware report block such as instruction
  mix and wavefront launch statistics
- Add deprecation warning for hardware component (sq, tcc) based filtering
This commit is contained in:
vedithal-amd
2025-03-10 14:42:56 -04:00
committed by GitHub
orang tua 0aefd15b7b
melakukan 55cf0e237e
27 mengubah file dengan 748 tambahan dan 199 penghapusan
+15 -2
Melihat File
@@ -191,7 +191,7 @@ def capture_subprocess_output(subprocess_args, new_env=None, profileMode=False):
global rocprof_args
# Format command for debug messages, formatting for rocprofv1 and rocprofv2
command = " ".join(rocprof_args)
console_debug("subprocess", "Running: " + command)
console_debug("subprocess", "Running: " + command + " " + " ".join(subprocess_args))
# Start subprocess
# bufsize = 1 means output is line buffered
# universal_newlines = True is required for line buffering
@@ -820,7 +820,7 @@ def gen_sysinfo(
df["workload_name"] = workload_name
blocks = []
if ip_blocks == None:
if not ip_blocks:
t = ["SQ", "LDS", "SQC", "TA", "TD", "TCP", "TCC", "SPI", "CPC", "CPF"]
blocks += t
else:
@@ -1249,3 +1249,16 @@ def merge_counters_spatial_multiplex(df_multi_index):
final_df = pd.concat(result_dfs, keys=coll_levels, axis=1, copy=False)
return final_df
def convert_metric_id_to_panel_idx(metric_id):
# "4.02" -> 402
# "4.23" -> 423
# "4" -> 400
tokens = metric_id.split(".")
if len(tokens) == 1:
return int(tokens[0]) * 100
elif len(tokens) == 2:
return int(tokens[0]) * 100 + int(tokens[1])
else:
raise Exception(f"Invalid metric id: {metric_id}")