55cf0e237e
* 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
83 строки
2.5 KiB
Python
83 строки
2.5 KiB
Python
import subprocess
|
|
from importlib.machinery import SourceFileLoader
|
|
from unittest.mock import patch
|
|
|
|
import pytest
|
|
|
|
rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module()
|
|
|
|
|
|
def pytest_addoption(parser):
|
|
parser.addoption(
|
|
"--call-binary",
|
|
action="store_true",
|
|
default=False,
|
|
help="Call standalone binary instead of main function during tests",
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def binary_handler_profile_rocprof_compute(request):
|
|
def _handler(config, workload_dir, options=[], check_success=True, roof=False):
|
|
if request.config.getoption("--call-binary"):
|
|
baseline_opts = [
|
|
"build/rocprof-compute.bin",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
]
|
|
if not roof:
|
|
baseline_opts.append("--no-roof")
|
|
process = subprocess.run(
|
|
baseline_opts
|
|
+ options
|
|
+ ["--path", workload_dir, "--"]
|
|
+ config["app_1"],
|
|
text=True,
|
|
)
|
|
# verify run status
|
|
if check_success:
|
|
assert process.returncode == 0
|
|
return process.returncode
|
|
else:
|
|
baseline_opts = ["rocprof-compute", "profile", "-n", "app_1", "-VVV"]
|
|
if not roof:
|
|
baseline_opts.append("--no-roof")
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
baseline_opts
|
|
+ options
|
|
+ ["--path", workload_dir, "--"]
|
|
+ config["app_1"],
|
|
):
|
|
rocprof_compute.main()
|
|
# verify run status
|
|
if check_success:
|
|
assert e.value.code == 0
|
|
return e.value.code
|
|
|
|
return _handler
|
|
|
|
|
|
@pytest.fixture
|
|
def binary_handler_analyze_rocprof_compute(request):
|
|
def _handler(arguments):
|
|
if request.config.getoption("--call-binary"):
|
|
process = subprocess.run(
|
|
["build/rocprof-compute.bin", *arguments],
|
|
text=True,
|
|
)
|
|
return process.returncode
|
|
else:
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
["rocprof-compute", *arguments],
|
|
):
|
|
rocprof_compute.main()
|
|
return e.value.code
|
|
|
|
return _handler
|