Skip to content

refactor(rocprofiler-sdk): migrate SPM off the per-queue callback registry#8887

Open
amd-vkale wants to merge 1 commit into
ROCm:developfrom
amd-vkale:users/vkale/remove-callbacks-spm
Open

refactor(rocprofiler-sdk): migrate SPM off the per-queue callback registry#8887
amd-vkale wants to merge 1 commit into
ROCm:developfrom
amd-vkale:users/vkale/remove-callbacks-spm

Conversation

@amd-vkale

@amd-vkale amd-vkale commented Jul 20, 2026

Copy link
Copy Markdown

Motivation

The purpose of this PR is to Isolate the SPM slice of the callback-removal effort (reference PRs #8730 / #8586) into a small, single-service change, per review guidance to land callback removal one service at a time. This is independent of kernel replay feature in PR #7960 and #8622 but it aids it.

Technical Details

SPM no longer registers a queue_callbacks_t with the HSA queue controller. Instead the HSA write interceptor and async signal handler call explicit free functions:

  • spm::write_hook / signal_completion_hook / is_any_active (new spm/queue_hooks.{hpp,cpp}) iterating active dispatch_spm contexts and calling the existing pre_kernel_call / post_kernel_call
  • hsa/queue_hooks/client_ids.hpp: stable inst_pkt producer tags

The per-queue callback registry is intentionally retained for counters, thread-trace and pc-sampling; those migrate in follow-up PRs. The WriteInterceptor gate and should_batch predicate detect SPM via is_any_active() (it no longer contributes to queue.get_notifiers()). Removes the now-unused queue_id from spm_counter_callback_info and updates spm tests off iterate_callbacks.

Issue Tracking

Aids PR #7960 and addresses kernel replay feature in AIPROFSDK-68. This PR also can help for other features requiring the removal of the SPM per-queue callback registry.

Test Plan

Test Result

Submission Checklist

@therock-pr-bot

therock-pr-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🚫 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.

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ Unit Test

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

@amd-vkale
amd-vkale force-pushed the users/vkale/remove-callbacks-spm branch 4 times, most recently from 8515be4 to 99b69d8 Compare July 20, 2026 23:15
…istry

Isolates the SPM slice of the callback-removal effort (reference PRs ROCm#8730 /
ROCm#8586) into a small, single-service change, per review guidance to land callback
removal one service at a time. Independent of kernel replay.

SPM no longer registers a queue_callbacks_t with the HSA queue controller.
Instead the HSA write interceptor and async signal handler call explicit free
functions:
  - spm::write_hook / signal_completion_hook / is_any_active
    (new spm/queue_hooks.{hpp,cpp}) iterating active dispatch_spm contexts and
    calling the existing pre_kernel_call / post_kernel_call
  - hsa/queue_hooks/client_ids.hpp: stable inst_pkt producer tags

The per-queue callback registry is intentionally retained for counters,
thread-trace and pc-sampling; those migrate in follow-up PRs. The WriteInterceptor
gate and should_batch predicate detect SPM via is_any_active() (it no longer
contributes to queue.get_notifiers()). Removes the now-unused queue_id from
spm_counter_callback_info and updates spm tests off iterate_callbacks.

Co-authored-by: Cursor <cursoragent@cursor.com>
@amd-vkale
amd-vkale force-pushed the users/vkale/remove-callbacks-spm branch from 99b69d8 to 194cdec Compare July 20, 2026 23:18
@amd-vkale
amd-vkale marked this pull request as ready for review July 20, 2026 23:18
@amd-vkale
amd-vkale requested review from a team as code owners July 20, 2026 23:18
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.

2 participants