Files
rocm-systems/README.md
T

71 lines
3.7 KiB
Markdown
Raw Normal View History

2023-10-19 03:47:27 -05:00
# rocprofiler-register
## Overview
2025-03-21 01:23:45 -05:00
The rocprofiler-register library is a helper library that coordinates the modification of the intercept API table(s) of the HSA/HIP/ROCTx
runtime libraries by the ROCprofiler (v2) library. The purpose of this library is to provide a consistent and automated mechanism
2023-10-19 03:47:27 -05:00
of enabling performance analysis in the ROCm runtimes which does not rely on environment variables or unique methods for each runtime
2025-03-21 01:23:45 -05:00
library.
2023-10-19 03:47:27 -05:00
When a runtime is initialized (either explicitly and lazily) and the intercept API table is constructed, it passes this API table to
2025-03-21 01:23:45 -05:00
rocprofiler-register. Rocprofiler-register scans the symbols in the address space and if it detects there is at least one visible symbol named
`rocprofiler_configure` (which is a function provided by tools), it passes the intercept API table to the rocprofiler library (dlopening
2023-10-19 03:47:27 -05:00
the rocprofiler library if it is not already loaded). The rocprofiler library then does an extensive scan for _all_ the instances of
the `rocprofiler_configure` symbols and invokes each of them. The `rocprofiler_configure` function (again, provided by a tool) returns
effectively tells rocprofiler which behaviors it wants to be notified about, features it wants to use (e.g. API tracing, kernel dispatch timing),
2025-03-21 01:23:45 -05:00
etc.
## Environment Variables
| Environment Variable | Description | Default Value |
|-----------------------------------|---------------------------------------------------------------------------|----------------|
| `ROCP_TOOL_LIBRARIES` | List of rocprofiler-sdk tool libraries (space, comma, or colon separated) | Empty (string) |
| `ROCPROFILER_REGISTER_ENABLED` | Set to 0/false/no to disable rocprofiler-register | true (bool) |
| `ROCPROFILER_REGISTER_SECURE` | Additional checks to ensure authenticity of runtime libraries | false (bool) |
| `ROCPROFILER_REGISTER_FORCE_LOAD` | Load rocprofiler-sdk library regardless of whether there is a tool or not | false (bool) |
2023-10-19 03:47:27 -05:00
## Contributing
The default branch is `amd-mainline` but the only branch that should target that branch in a pull requests is the `amd-staging` branch.
> _**All pull-requests should target the `amd-staging` branch**_
### Creating a feature branch
```console
2025-03-21 01:23:45 -05:00
# fetch any updates
2023-10-19 03:47:27 -05:00
git fetch origin
# switch to staging branch
git checkout amd-staging
# update your copy of the staging branch
git pull --rebase
# create your feature branch off of amd-staging
git checkout -b <feature-branch>
```
In the event, your local clone of the repo has a `amd-staging` branch that diverges from the upstream branch,
do a hard reset of your local branch to match the upstream branch: `git reset --hard origin/amd-staging`.
Theoretically, you should never need to do this for `amd-mainline` but this can be applied to that
branch as well.
### Pulling in updates to `amd-staging` to your feature branch
2025-03-21 01:23:45 -05:00
Linear histories are preferred so if another PR is merged into `amd-staging` while your PR is still open, please
2023-10-19 03:47:27 -05:00
select the "Update with rebase" option (i.e. try to avoid a merge commit). From the command line, the git command
would be `git pull --rebase origin amd-staging`.
## Build and Installation
rocprofiler-register has a standard CMake build and install process. E.g. the following configure
2025-03-21 01:23:45 -05:00
rocprofiler-register to build with optimizations and without debug info in a `build-rocp-reg` subdirectory,
2023-10-19 03:47:27 -05:00
build using 4 jobs, and install to `/opt/rocprofiler-register`:
```console
2025-03-21 01:23:45 -05:00
cmake -B build-rocp-reg . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-register
2023-10-19 03:47:27 -05:00
cmake --build build-rocp-reg --target all --parallel 4
cmake --build build-rocp-reg --target install
```