Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ def list_blocks(self) -> None:
)

print(f"{'INDEX':<8} {'BLOCK ALIAS':<16} {'BLOCK NAME'}")
panel_alias_dict = {value: key for key, value in get_panel_alias().items()}
for key, value in self._arch_configs[arch].metric_list.items():
panel_alias_dict = get_panel_alias()
if key.count(".") > 0:
continue
print(f"{key:<8} {panel_alias_dict[value]:<16} {value}")
print(f"{key:<8} {panel_alias_dict[key]:<16} {value}")

sys.exit(0)

Expand Down
3 changes: 2 additions & 1 deletion projects/rocprofiler-compute/src/rocprof_compute_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,11 @@ def list_blocks(self) -> None:
parser.build_dfs(arch_configs=ac, filter_metrics=[], sys_info=sys_info)

print(f"{'INDEX':<8} {'BLOCK ALIAS':<16} {'BLOCK NAME'}")
panel_alias_dict = {value: key for key, value in get_panel_alias().items()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove duplicate list_blocks in analyze mode (profile mode is missing this!)

Ideally we should remove all the general options handling out of this if block

, then we can remove duplicate list_blocks handling in analyze mode. General options should not care about the mode IMO.

Also I dont know why we mandate --list-metrics with --config-dir, that check should be removed as well.

I will let you decide, if you want to handle it here or in a different PR

for key, value in ac.metric_list.items():
if key.count(".") > 0:
continue
print(f"{key:<8} {get_panel_alias()[value]:<16} {value}")
print(f"{key:<8} {panel_alias_dict[key]:<16} {value}")
sys.exit(0)
else:
console_error("Unsupported arch")
Expand Down
26 changes: 26 additions & 0 deletions projects/rocprofiler-compute/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7556,6 +7556,32 @@ def test_list_metrics(binary_handler_analyze_rocprof_compute, capsys):
assert "5.2 -> Command processor packet processor (CPC)" in output


def test_list_blocks(binary_handler_analyze_rocprof_compute, capsys):
return_code = binary_handler_analyze_rocprof_compute(["--list-blocks", "gfx90a"])
assert return_code == 0

# Test output
output = capsys.readouterr().out
assert "INDEX" in output
assert "BLOCK ALIAS" in output
assert "BLOCK NAME" in output

# Verify specific block id, alias, and name mappings
lines = output.strip().splitlines()
block_entries = {}
for line in lines[1:]: # skip header
parts = line.split()
if len(parts) >= 3:
block_id = parts[0]
block_alias = parts[1]
block_name = " ".join(parts[2:])
block_entries[block_id] = (block_alias, block_name)

assert block_entries["0"] == ("topstats", "Top Stats")
assert block_entries["1"] == ("sysinfo", "System Info")
assert block_entries["6"] == ("spi", "Workgroup Manager (SPI)")


# =============================================================================
# TESTS FOR AMDSMI INTERFACE
# =============================================================================
Expand Down
Loading