Implement interface to rocprofiler sdk (#695)

* Setting ROCPROF=rocprofiler-sdk environment variable will use rocprofiler-sdk C++ library instead of rocprofv3 python script

* Add runtime option --rocprofiler-sdk-library-path to use custom version of rocprofiler sdk library
    * Add --rocprofiler-sdk-library-path conftest option for tests

* Setup appropriate environment variables to inject rocprofiler sdk code to user command
    * Add env. vars. for counter collection and filtering
    * Add env. vars. for pc sampling

* Use python bindings to list counters supported by rocprofiler sdk
This commit is contained in:
vedithal-amd
2025-05-13 10:48:21 -04:00
committed by GitHub
parent d527d77337
commit 5cb86e31fc
16 changed files with 424 additions and 66 deletions
+14
View File
@@ -15,12 +15,26 @@ def pytest_addoption(parser):
help="Call standalone binary instead of main function during tests",
)
parser.addoption(
"--rocprofiler-sdk-library-path",
type=str,
default="/opt/rocm/lib/librocprofiler-sdk.so",
help="Path to the rocprofiler-sdk library",
)
@pytest.fixture
def binary_handler_profile_rocprof_compute(request):
def _handler(
config, workload_dir, options=[], check_success=True, roof=False, app_name="app_1"
):
if request.config.getoption("--rocprofiler-sdk-library-path"):
options.extend(
[
"--rocprofiler-sdk-library-path",
request.config.getoption("--rocprofiler-sdk-library-path"),
],
)
if request.config.getoption("--call-binary"):
baseline_opts = [
"build/rocprof-compute.bin",
+12 -5
View File
@@ -323,15 +323,22 @@ def gpu_soc():
soc = gpu_soc()
# Set rocprofv2 as profiler if MI300
if soc == "MI100":
os.environ["ROCPROF"] = "rocprof"
if "ROCPROF" not in os.environ.keys():
if soc == "MI100":
os.environ["ROCPROF"] = "rocprof"
else:
os.environ["ROCPROF"] = "rocprofv3"
else:
os.environ["ROCPROF"] = "rocprofv3"
def using_v3():
return "ROCPROF" in os.environ.keys() and os.environ["ROCPROF"].endswith("rocprofv3")
return "ROCPROF" not in os.environ.keys() or (
"ROCPROF" in os.environ.keys()
and (
os.environ["ROCPROF"].endswith("rocprofv3")
or os.environ["ROCPROF"] == "rocprofiler-sdk"
)
)
Baseline_dir = str(Path("tests/workloads/vcopy/" + soc).resolve())