Repository navigation
Conversation
…peated counter
Under rocprofv3 --replay-mode kernel every pass of a dispatch is written against the
dispatch's single rocpd event, and replay_pass was dropped on the way in. The
counters_collection view sums a (dispatch, counter)'s rocpd_pmc_event rows to fold the
counter's hardware instances, so it also added the passes together: a counter listed in N
--pmc groups, such as the SQ_WAVES / SQ_INSTS_VALU sanity counters the kernel-replay tests put
in every group, came out at N times its value in counters_collection and in the counter CSV
and Perfetto output that rocpd convert builds from it.
- generateRocpd: rows from passes after the first carry {"replay_pass":N} in extdata. Pass 0
and non-replay rows bind "{}", the column default, so their content is unchanged and the
insert batch keeps a single column list.
- counters_collection: divide the summed value by the number of distinct passes that collected
the counter, i.e. the mean over passes of each pass's instance sum. Untagged rows count as
pass 0, so non-replay data and databases written before this change read as before.
- No table change and no schema version bump: readers rebuild views from their own SQL, and
3.0.4 readers without this view still open the new databases.
Tests: the kernel-replay rocprofv3 tests also write rocpd and check every counters_collection
row against the mean of that counter's per-pass JSON values; the rocpd-back-compat
latest-schema database gains replay-tagged counter rows and a CSV check.
e49986f to
385f45e
Compare
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
|
@copilot please give a detailed review of this. |
There was a problem hiding this comment.
🟡 Changes recommended
Perfetto PMC annotations still expose raw replay-pass rows despite the documented averaging behavior.
1 open finding
What changed in this PR
Fixes inflated rocPD counters when the same counter is collected across kernel-replay passes.
Changes:
- Tags PMC rows with their replay pass and averages pass totals in
counters_collection. - Adds kernel-replay and backward-compatibility tests.
- Updates documentation and release notes.
| File | Description |
|---|---|
tests/rocprofv3/kernel-replay/validate.py |
Validates averaged rocPD counters. |
tests/rocprofv3/kernel-replay/conftest.py |
Adds rocPD database fixture. |
tests/rocprofv3/kernel-replay/CMakeLists.txt |
Generates and validates rocPD output. |
tests/rocpd-back-compat/validate.py |
Checks converted counter means. |
tests/rocpd-back-compat/make_db.py |
Adds representative replay-pass data. |
source/share/rocprofiler-sdk-rocpd/versions.yml |
Records the behavioral change. |
source/share/rocprofiler-sdk-rocpd/data_views.sql |
Averages counters across distinct passes. |
source/lib/python/rocpd/README.md |
Documents aggregation semantics. |
source/lib/output/generateRocpd.cpp |
Stores replay-pass metadata. |
source/docs/how-to/using-kernel-replay-rocprofv3.rst |
Documents rocPD replay behavior. |
CHANGELOG.md |
Announces the fix. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Both are outputs of the same kernel-replay run, so the option reads better beside --json-input than at the end of pytest_addoption. It also keeps this change clear of the option that the kernel-iteration-range fix (#11335) appends after --common-counters, so the two PRs merge in either order without a conflict in conftest.py.
Review of
|
The pass tags let counters_collection average a counter over replay passes, but the non-aggregating pmc_events view still listed every pass's rows without saying which pass each came from. It now reports replay_pass, 0 for untagged rows. Tests, following the Copilot review on #13164: - rocpd-back-compat: a counter collected by passes 1 and 2 only, so it has no pass-0 rows and a fractional mean (5.5); pmc_events must report each pass; the Perfetto file converted from the database must carry the pass means. - kernel replay: every raw rocpd_pmc_event row carries exactly its pass's tag, with one row per JSON instance value for each (dispatch, pass), and pmc_events reports the same passes. JIRA ID: ROCM-30873
yhuiYH
left a comment
There was a problem hiding this comment.
We probably want to bump the schema version to identify support for this.
We also added features.py support for backwards compatibility reasons (usually when adding tables or fields to tables). This change seems to only change the data_views, so it may be seamless enough that it doesn't require an added flag to features.py, but just calling it out here: https://github.com/ROCm/rocm-systems/blob/develop/projects/rocprofiler-sdk/source/lib/python/rocpd/features.py#L54-L67
|
No impact on rocprofiler-compute:
|
|
@copilot resolve the merge conflicts on this branch. |
This comment was marked as duplicate.
This comment was marked as duplicate.
1 similar comment
This comment was marked as duplicate.
This comment was marked as duplicate.
…eated-pmc-counter-0e6b # Conflicts: # projects/rocprofiler-sdk/source/share/rocprofiler-sdk-rocpd/versions.yml # projects/rocprofiler-sdk/tests/rocpd-back-compat/CMakeLists.txt # projects/rocprofiler-sdk/tests/rocpd-back-compat/validate.py
Drop the remove-callbacks / set_agents / #11335 Unreleased bullets from this PR so they land via the dedicated docs PR instead of conflicting here.
yhuiYH
left a comment
There was a problem hiding this comment.
Looks like your back-compat tests are still failing on RHEL and SLES.
The following tests FAILED:
1011 - tests.integration.validate.rocpd-back-compat.test_counters_collection_schema_unchanged_from_3_0_5 (Failed)
1012 - tests.integration.validate.rocpd-back-compat.test_pmc_events_replay_pass_absent_before_3_0_6[3.0.0] (Failed)
1013 - tests.integration.validate.rocpd-back-compat.test_pmc_events_replay_pass_absent_before_3_0_6[3.0.1] (Failed)
1014 - tests.integration.validate.rocpd-back-compat.test_pmc_events_replay_pass_absent_before_3_0_6[3.0.2] (Failed)
1015 - tests.integration.validate.rocpd-back-compat.test_pmc_events_replay_pass_absent_before_3_0_6[3.0.3] (Failed)
1016 - tests.integration.validate.rocpd-back-compat.test_pmc_events_replay_pass_absent_before_3_0_6[3.0.4] (Failed)
1017 - tests.integration.validate.rocpd-back-compat.test_pmc_events_replay_pass_absent_before_3_0_6[3.0.5] (Failed)
1018 - tests.integration.validate.rocpd-back-compat.test_pmc_events_report_replay_pass (Failed)
Also, you need to run make format in the build directory to fix the linting and cmake test failures.
… check Address reviewer CI feedback: cmake-format/black cleanups for the rocpd back-compat suite, and ensure Systems PR Bot sees a pre-commit check-run.
RHEL 8.8 / SLES 15.6 CI was failing when counters_collection evaluated
json_extract. The writer only emits {} or {"replay_pass":N}, so parse
the pass with instr/substr/trim instead and keep averaging portable.
Revert the portable instr/substr replay_pass parse that regressed Ubuntu CI, restore json_extract, and make fixture generation fail fast when the wrong schema SQL is loaded. Put every build python*/site-packages on PYTHONPATH and open validate DBs read-only so missing fixtures cannot become empty databases.
…ion-range notes Mirror the approved #13600 Unreleased entries on this branch so ROCm 10.2 coverage can land with either merge vehicle.
|
@copilot Fix the conflicts |
This comment was marked as spam.
This comment was marked as spam.
4 similar comments
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as low quality.
This comment was marked as low quality.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
A preinstalled librocprofiler-sdk-rocpd on LD_LIBRARY_PATH rejects schema 3.0.6, so Ubuntu CI aborts any test that writes rocpd output. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@copilot resolve the merge conflicts in this pull request |
This comment was marked as spam.
This comment was marked as spam.
5 similar comments
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as abuse.
This comment was marked as abuse.
…eated-pmc-counter-0e6b Keep the rocpd 3.0.6 replay average on develop's kernel-replay test helpers, and keep rocprofv3 loading its own librocprofiler-sdk-rocpd. Co-authored-by: Cursor <cursoragent@cursor.com>
This should be fixed now. The make format in the build directory is done. |




Motivation
Under
rocprofv3 --replay-mode kernel --kernel-replay-beta-enabled, rocpd reports a counter at N times its value when N--pmcgroups list it, for example a sanity counter such asSQ_WAVESin every group (the kernel-replay integration test does this on purpose). rocpd is the default output format, so this reaches thecounters_collectionview, the counter CSV and Perfetto output thatrocpd convertbuilds from it, and tools that read the view, such as rocprofiler-compute. Counters listed in a single group, and runs without kernel replay, are correct.Technical Details
Every replay pass of a dispatch shares the dispatch's id, so the rocpd writer puts every pass's counter rows under the dispatch's single event, and
replay_passwas dropped.counters_collectiongroups by dispatch and counter name and takesSUM(value)to add up the counter's hardware instances, so it added the passes together as well.source/lib/output/generateRocpd.cpp: rows from passes after the first carry{"replay_pass":N}inrocpd_pmc_event.extdata. Pass 0 and non-replay rows bind{}, the column default, so their content is unchanged; binding it on every row keeps the insert batch on one column list.source/share/rocprofiler-sdk-rocpd/data_views.sql:counters_collectiondivides the sum by the number of distinct passes that collected the counter, i.e. it reports the mean over passes of each pass's instance sum. Untagged rows count as pass 0, so non-replay data and databases written before this change read exactly as before.versions.ymlhistory.The mean is exact for deterministic counters, since every pass runs against the same restored inputs, and uses every measurement for the others. The individual passes stay in the database.
Issue Tracking
JIRA ID: ROCM-30873
Test Plan
validate.pychecks everycounters_collectionrow against the mean of that counter's per-pass JSON values, in both the plain and the interval run.rocpd-back-compat: the latest-schema database gains a counter in three tagged replay passes with different per-pass sums, a single-pass counter, and an untagged dispatch; the converted CSV must report the means.rocprofv3-test-kernel-replay*,rocprofv3-test-rocpd*,rocpd-back-compat,rocpd-api, rocpd help tests.Test Result
On an 8x MI325X (gfx942) node, Ubuntu 22.04, ROCm 7.14 runtime:
SQ_WAVESandSQ_INSTS_VALU: dispatch 1 reportsSQ_WAVES49152 andSQ_INSTS_VALU1818624 for per-pass values of 16384 and 606208 (exactly 3x); 20 of 50 (dispatch, counter) pairs are wrong. With this change, 0 of 50, both in the database view and in therocpd convertCSV.rocprofv3-test-kernel-replay*7/7,rocprofv3-test-rocpd*36/36, androcpd-back-compat,rocpd-api, rocpd help and the kernel-replay CLI unit test 68/68.Submission Checklist