Skip to content

Adding device SPM support - #11879

Merged
SrirakshaNag merged 11 commits into
developfrom
users/SrirakshaNag/spm-device
Oct 8, 2026
Merged

SrirakshaNag merged 11 commits into
developfrom
users/SrirakshaNag/spm-device

Conversation

@SrirakshaNag

@SrirakshaNag SrirakshaNag commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

This PR adds device counting mode to the SPM (Streaming Performance Monitor) service in rocprofiler-sdk.
Device mode samples performance counters without tying them to individual kernel dispatches

Technical Details

On context start (spm_start_agent_ctx):

  1. The tool's callback (rocprofiler_device_counting_service_cb_t) is invoked to supply a profile config for the agent
  2. kfd_start to enable SPM streaming
  3. The AQL start packet is submitted with a completion signal

On context stop (spm_stop_agent_ctx):
Submits an AQL stop packet, waits for completion, then calls kfd_stop to tear down the KFD session

Buffer delivery: Counter samples are decoded and pushed to a rocprofiler_buffer_id_t. The buffer callback delivers rocprofiler_spm_counter_record_t records (timestamp, counter instance ID, agent ID, value) — no dispatch headers since collection is device-scoped.

Issue Tracking

JIRA ID: AIPROFSDK-241

Test Plan

SPM device counting sample have been added in this PR

Test Result

Submission Checklist

@SrirakshaNag
SrirakshaNag requested review from a team as code owners September 18, 2026 19:47
@therock-pr-bot

therock-pr-bot Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rocprofiler-sdk/samples/spm/client.hpp, projects/rocprofiler-sdk/samples/spm/main.cpp, projects/rocprofiler-sdk/samples/spm/spm_device_counting_client.cpp, projects/rocprofiler-sdk/source/include/rocprofiler-sdk/experimental/spm.h, projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/context/context.cpp (+14 more); no test file found
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@bing-ma bing-ma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me overall, except for a couple of minor RFCs.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 24, 2026

@bing-ma bing-ma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me now.

@SrirakshaNag
SrirakshaNag force-pushed the users/SrirakshaNag/spm-device branch from 8df99f5 to af31cba Compare September 29, 2026 22:58
@SrirakshaNag
SrirakshaNag force-pushed the users/SrirakshaNag/spm-device branch 2 times, most recently from c8e41c9 to 4b44e76 Compare October 2, 2026 16:44

@bwelton bwelton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blockers, looks good. Just some general comments/questions.

@SrirakshaNag
SrirakshaNag force-pushed the users/SrirakshaNag/spm-device branch from 236d0c4 to a7bc614 Compare October 5, 2026 21:50
@SrirakshaNag
SrirakshaNag force-pushed the users/SrirakshaNag/spm-device branch from a7bc614 to 6f3797c Compare October 6, 2026 16:56
@SrirakshaNag
SrirakshaNag merged commit d4bbd31 into develop Oct 8, 2026
153 of 158 checks passed
@SrirakshaNag
SrirakshaNag deleted the users/SrirakshaNag/spm-device branch October 8, 2026 18:22
cursor Bot pushed a commit that referenced this pull request Oct 9, 2026
…th-cursor-fixes

Brings in #11967 (thread trace off the per-queue callback registry). The
conflicts in context/context.cpp, hsa/queue.cpp and thread_trace/core.cpp
are where both PRs edit the same lines: thread trace keeps develop's code,
and counter collection's hooks, fast-path gate, per-packet mode and
agent-scoped conflict check sit next to it, as SPM's and PC sampling's
already do. context.cpp also keeps develop's device SPM stop (#11879).

Co-authored-by: Vivek Kale <vivek.kale@amd.com>
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

cursor Bot pushed a commit that referenced this pull request Oct 10, 2026
develop now carries the final thread trace (#11967) and counters (#11970)
callback removals. Conflicts in context/context.cpp, counters/core.cpp,
counters/sample_processing.cpp and hsa/queue.cpp were resolved as unions:

- Git applied both develop's and this branch's insertion of the same code
  at different positions, so one copy of each was dropped: the counters and
  thread trace enter and exit hook calls in hsa/queue.cpp (this branch's
  placement kept), and dispatch_counter_collection_service::intersects() in
  context/context.cpp. Every service hook is called once.
- start_context() keeps this branch's PC sampling start under the context
  start marker (d4b7863) and takes develop's new device SPM start
  (#11879) after the counters agent start.
- The interception and per-packet gates take develop's form, which ANDs or
  ORs the same per-agent predicates; comments keep this branch's wording
  from c590486.

Co-authored-by: Vivek Kale <vivek.kale@amd.com>
anujshuk-amd pushed a commit that referenced this pull request Oct 12, 2026
## Motivation
This PR adds device counting mode to the SPM (Streaming Performance
Monitor) service in rocprofiler-sdk.
Device mode samples performance counters without tying them to
individual kernel dispatches

## Technical Details

On context start (spm_start_agent_ctx):
1. The tool's callback (rocprofiler_device_counting_service_cb_t) is
invoked to supply a profile config for the agent
2. kfd_start to enable SPM streaming
3. The AQL start packet is submitted with a completion signal

On context stop (spm_stop_agent_ctx):
Submits an AQL stop packet, waits for completion, then calls kfd_stop to
tear down the KFD session

Buffer delivery: Counter samples are decoded and pushed to a
rocprofiler_buffer_id_t. The buffer callback delivers
rocprofiler_spm_counter_record_t records (timestamp, counter instance
ID, agent ID, value) — no dispatch headers since collection is
device-scoped.

## Issue Tracking

JIRA ID: AIPROFSDK-241

## Test Plan

SPM device counting sample have been added in this PR

## Test Result

<!-- Briefly summarize test outcomes. -->

## Submission Checklist

- [ ] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants