Skip to content

fix(clr): match SVM frees by range so hipFree accepts offset pointers - #12525

Merged
satyanveshd merged 2 commits into
developfrom
users/sdittaka/fixhipfree
Oct 8, 2026
Merged

satyanveshd merged 2 commits into
developfrom
users/sdittaka/fixhipfree

Conversation

@satyanveshd

@satyanveshd satyanveshd commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Address regressions with hipFree/hipHostFree when a pointer offset to the base pointer is passed.

Technical Details

Do not just check the passed pointer if it matches with the base pointer, while removing the pointers from svm buffer map. Instead check if that pointer is in the range of the allocation and remove if it is so.

Issue Tracking

JIRA ID: ROCM-31847

Test Plan

HACC single gpu tests should run fine.

Test Result

PASS

Submission Checklist

@satyanveshd
satyanveshd requested a review from a team as a code owner September 30, 2026 13:10
Copilot AI balanced review requested due to automatic review settings September 30, 2026 13:10
@therock-pr-bot

therock-pr-bot Bot commented Sep 30, 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/clr/rocclr/platform/memory.cpp, projects/clr/rocclr/platform/memory.hpp, projects/hip-tests/catch/unit/memory/hipFree.cc; 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?

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.

Copilot review overview

🟡 Changes recommended

Targeted regression tests for offset and boundary pointers are missing.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Updates SVM allocation tracking so hipFree and hipHostFree can release allocations using interior pointers.

Changes:

  • Finds SVM allocations by address range.
  • Resolves interior pointers to their allocation base before freeing.
File Description
projects/​clr/​rocclr/​platform/​memory.hpp Updates the internal removal signature.
projects/​clr/​rocclr/​platform/​memory.cpp Implements range lookup and base-pointer freeing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread projects/clr/rocclr/platform/memory.cpp Resolved

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

🤖 AI-assisted pre-review (for @mangupta)

@satyanveshd
satyanveshd force-pushed the users/sdittaka/fixhipfree branch from 35b367a to a9acc8b Compare October 1, 2026 07:51
@mangupta

mangupta commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🤖 AI-assisted pre-review (for @mangupta)

Re-reviewed the updated head (a9acc8baae9a) — no new findings at or above the posting threshold.

@satyanveshd
satyanveshd merged commit a970e27 into develop Oct 8, 2026
306 of 312 checks passed
@satyanveshd
satyanveshd deleted the users/sdittaka/fixhipfree branch October 8, 2026 16:27
systems-assistant Bot pushed a commit to ROCm/clr that referenced this pull request Oct 8, 2026
 pointers (#12525)

## Motivation

Address regressions with hipFree/hipHostFree when a pointer offset to
the base pointer is passed.

## Technical Details

Do not just check the passed pointer if it matches with the base
pointer, while removing the pointers from svm buffer map. Instead check
if that pointer is in the range of the allocation and remove if it is
so.

## Issue Tracking

JIRA ID: ROCM-31847

## Test Plan

HACC single gpu tests should run fine.

## Test Result

PASS

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
[rocm-systems] ROCm/rocm-systems#12525 (commit a970e27)
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

anujshuk-amd pushed a commit that referenced this pull request Oct 12, 2026
…#12525)

## Motivation

Address regressions with hipFree/hipHostFree when a pointer offset to
the base pointer is passed.

## Technical Details

Do not just check the passed pointer if it matches with the base
pointer, while removing the pointers from svm buffer map. Instead check
if that pointer is in the range of the allocation and remove if it is
so.

## Issue Tracking

JIRA ID: ROCM-31847

## Test Plan

HACC single gpu tests should run fine.

## Test Result

PASS

## 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