Skip to content

fix(rocprofiler-compute): Preserve PC sampling code object identity - #13742

Merged
vedithal-amd merged 2 commits into
rocprofiler-compute-developfrom
users/habajpai-amd/pc-sampling-fix
Oct 19, 2026
Merged

vedithal-amd merged 2 commits into
rocprofiler-compute-developfrom
users/habajpai-amd/pc-sampling-fix

Conversation

@habajpai-amd

@habajpai-amd habajpai-amd commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Prevent JAX/PyTorch PC sampling finalization failures when GPU addresses are reused.

Technical Details

  • Decode instructions using the code object ID and relative address.
  • Add a regression test for reused addresses.

Issue Tracking

JIRA ID: ROCM-32558

Test Plan

  • Run collector tests.
  • Validate JAX sampling and PyTorch cold-cache training on MI350X.
  • Check clean exit, cleanup and ISA output.

Test Result

  • All 68 PC sampling collector tests passed, including the new test for this bug.
  • JAX and PyTorch validation passed.

Submission Checklist

@habajpai-amd
habajpai-amd marked this pull request as ready for review October 19, 2026 16:08
@habajpai-amd
habajpai-amd requested review from a team and prbasyal-amd as code owners October 19, 2026 16:08
Copilot AI balanced review requested due to automatic review settings October 19, 2026 16:08

Copilot AI 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.

🟢 Approval recommended

The focused change matches the object-relative decoding contract and includes regression coverage, with no unresolved issues identified.

No open issues 🎉

What changed in this PR

Preserves code object identity during PC sampling decoding, preventing finalization failures when GPU addresses are reused.

Changes:

  • Decodes instructions using the code object ID and relative address.
  • Adds regression coverage for reused addresses within and beyond the older object’s range.
  • Documents the fix in the changelog.
File Description
projects/​rocprofiler-compute/​src/​lib/​pc_sampling_collector/​tests/​test_code_object_translator.h Defines the translator test fixture.
projects/​rocprofiler-compute/​src/​lib/​pc_sampling_collector/​tests/​test_code_object_translator.cpp Tests decoding distinct objects sharing a load address.
projects/​rocprofiler-compute/​src/​lib/​pc_sampling_collector/​tests/​CMakeLists.txt Registers the new test files.
projects/​rocprofiler-compute/​src/​lib/​pc_sampling_collector/​code_object_translator.cpp Uses object-specific instruction lookup.
projects/​rocprofiler-compute/​CHANGELOG.md Records the JAX and PyTorch sampling fix.

Review effort: Balanced

@feizheng10 feizheng10 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.

Two non-blocking notes.

@vedithal-amd vedithal-amd 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.

LGTM. Decoding by code object id plus offset matches how rocprofv3 decodes samples, and the new test fails without the change: the reused address decodes the old object, and the lookup past the old range throws. Also verified locally on gfx950: cold-cache torch.compile max-autotune runs now write the ISA listing with both stochastic and host_trap.

@vedithal-amd
vedithal-amd merged commit eb0a462 into rocprofiler-compute-develop Oct 19, 2026
76 checks passed
@vedithal-amd
vedithal-amd deleted the users/habajpai-amd/pc-sampling-fix branch October 19, 2026 21:55
vedithal-amd pushed a commit that referenced this pull request Oct 25, 2026
…13742)

## Motivation

<!-- Explain the purpose of this PR and the goals it aims to achieve.
-->
Prevent JAX/PyTorch PC sampling finalization failures when GPU addresses
are reused.

## Technical Details

<!-- Explain the changes along with any relevant GitHub links. -->
- Decode instructions using the code object ID and relative address.
- Add a regression test for reused addresses.

## Issue Tracking

<!-- Include a GitHub Issue and/or JIRA ID. Do not post any full JIRA
links here. -->
<!-- GitHub issue: #1234 -->
<!-- JIRA ID: EXAMPLECOMPONENT-1234 -->
JIRA ID: ROCM-32558

## Test Plan

<!-- Explain any relevant testing done to verify this PR. -->
- Run collector tests.
- Validate JAX sampling and PyTorch cold-cache training on MI350X.
- Check clean exit, cleanup and ISA output.

## Test Result

<!-- Briefly summarize test outcomes. -->
- All 68 PC sampling collector tests passed, including the new test for
this bug.
- JAX and PyTorch validation passed.

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
vedithal-amd pushed a commit that referenced this pull request Oct 26, 2026
…13742)

## Motivation

<!-- Explain the purpose of this PR and the goals it aims to achieve.
-->
Prevent JAX/PyTorch PC sampling finalization failures when GPU addresses
are reused.

## Technical Details

<!-- Explain the changes along with any relevant GitHub links. -->
- Decode instructions using the code object ID and relative address.
- Add a regression test for reused addresses.

## Issue Tracking

<!-- Include a GitHub Issue and/or JIRA ID. Do not post any full JIRA
links here. -->
<!-- GitHub issue: #1234 -->
<!-- JIRA ID: EXAMPLECOMPONENT-1234 -->
JIRA ID: ROCM-32558

## Test Plan

<!-- Explain any relevant testing done to verify this PR. -->
- Run collector tests.
- Validate JAX sampling and PyTorch cold-cache training on MI350X.
- Check clean exit, cleanup and ISA output.

## Test Result

<!-- Briefly summarize test outcomes. -->
- All 68 PC sampling collector tests passed, including the new test for
this bug.
- JAX and PyTorch validation passed.

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
lamikr pushed a commit that referenced this pull request Oct 27, 2026
…13742)

## Motivation

<!-- Explain the purpose of this PR and the goals it aims to achieve.
-->
Prevent JAX/PyTorch PC sampling finalization failures when GPU addresses
are reused.

## Technical Details

<!-- Explain the changes along with any relevant GitHub links. -->
- Decode instructions using the code object ID and relative address.
- Add a regression test for reused addresses.

## Issue Tracking

<!-- Include a GitHub Issue and/or JIRA ID. Do not post any full JIRA
links here. -->
<!-- GitHub issue: #1234 -->
<!-- JIRA ID: EXAMPLECOMPONENT-1234 -->
JIRA ID: ROCM-32558

## Test Plan

<!-- Explain any relevant testing done to verify this PR. -->
- Run collector tests.
- Validate JAX sampling and PyTorch cold-cache training on MI350X.
- Check clean exit, cleanup and ISA output.

## Test Result

<!-- Briefly summarize test outcomes. -->
- All 68 PC sampling collector tests passed, including the new test for
this bug.
- JAX and PyTorch validation passed.

## Submission Checklist

- [x] 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