[rocPRIM] Fix memory leaks in different unit tests#1176
Merged
Conversation
amd-hsong
reviewed
Aug 13, 2025
amd-hsong
previously approved these changes
Aug 13, 2025
umfranzw
previously approved these changes
Aug 15, 2025
Contributor
umfranzw
left a comment
There was a problem hiding this comment.
This looks good to me, pending CI validation.
Contributor
Author
|
Hi @umfranzw and @amd-hsong I had to make a hotfix since an unit test was failing due to my changes. If I could get your approvals again that would be great |
amd-hsong
approved these changes
Aug 18, 2025
assistant-librarian Bot
pushed a commit
to ROCm/rocPRIM
that referenced
this pull request
Sep 30, 2025
[rocPRIM] Fix memory leaks in different unit tests ## Motivation TCT reported multiple memory leaks coming from different rocPRIM unit tests. Specifically: - `test_device_merge_inplace.cpp` - `test_device_transform.cpp` - `test_hipgraph_basic.cpp` ## Technical Details In `test_device_merge_inplace.cpp` in the `Basic` test, `d_temp_storage` was never freed manually. We added a call to `free_manually()` to address this issue. In `test_device_transform.cpp` in the `UnalignedPointer` test, `d_unaligned` and `d_input` were allocated but never freed. We added a call to `hipFree` at the end of the test to address this issue. In `test_hipgraph_basic.cpp` the wrong call to free for `d_data` was used. Instead of calling `hipFree`, `hipFreeAsync` should be called instead since it was allocated with `hipMallocAsync`. Also the order of freeing was not correct, and needed to be rearranged. ## Test Plan Run valgrind with these tests locally to check for test failures and memory leaks. As well as CI checks. ## Test Result When valgrind was ran locally no failures and leaks are observed.
3 tasks
SreecharanGundaboluAMD
added a commit
that referenced
this pull request
May 26, 2026
## Motivation This PR adds `gfx1250` support for **miopen** brining in changes from `gfx1250` branch to `develop`. ## Original Commits The following 75 commits from `gfx1250` are included: <details> <summary>View all 75 commits</summary> | Commit | Author | Date | Message | |--------|--------|------|----------| | e6b719a | Choudhary, Rahul | 2026-04-20 | Gfx1250 develop slice 04 (#1195) | | 622fa63 | a1-rocm-devops_amdeng | 2026-04-20 | Merge branch 'gfx1250' into gfx1250-develop-slice-04 | | 8e86859 | Sivasuntharampillai, Haresh | 2026-04-15 | Develop Merge into GFX1250 (#1176) | | 84ac4fb | Gundabolu, Sree Charan | 2026-04-15 | [mi450] Enable Extra warp sync types (#1092) | | 8ba0569 | a1-rocm-devops_amdeng | 2026-04-15 | Merge branch 'gfx1250' into gfx1250-develop-slice-02 | | b60e2ca | Sivasuntharampillai, Haresh | 2026-04-10 | Merger auto-merge-rocm-libraries-develop-to-gfx1250-787 into gfx1250-compute-external-merge-new-787 (#949) | | c2b7e0a | Christina, Jenifer | 2026-04-03 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-to-gfx1250-787 | | fddc0a4 | Gundabolu, Sree Charan | 2026-04-02 | [miopen] fix ck targets bug (#1089) | | c4fee07 | a1-rocm-devops_amdeng | 2026-03-18 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-to-gfx1250-787 | | 56dcfbe | Choudhary, Rahul | 2026-03-17 | Merger auto-merge-rocm-libraries-develop-to-gfx1250-768 into gfx1250-compute-external-merge-new-768 (#815) | | c893ae6 | Silin, Illia | 2026-03-13 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-to-gfx1250-768 | | f593ef4 | Gundabolu, Sree Charan | 2026-03-11 | [miopen] Cleanup, clang-format fix, re-enable fusion solvers (#893) | | 628de4e | a1-rocm-devops_amdeng | 2026-03-06 | Merge remote-tracking branch 'origin/gfx1250' into auto-merge-rocm-libraries-develop-to-gfx1250-768 | | 2621228 | Sivasuntharampillai, Haresh | 2026-02-25 | Merger auto-merge-rocm-libraries-develop-to-gfx1250-745 into gfx1250-compute-external-merge-new-745 (#724) | | 8b78e71 | Gundabolu, Sree Charan | 2026-02-25 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-to-gfx1250-745 | | 6ece737 | Uphoff, Carsten | 2026-02-25 | Fix gcn_reduce for gfx1250 and wave size 32 (#727) | | 7031baf | a1-rocm-devops_amdeng | 2026-02-17 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-to-gfx1250-745 | | 292d919 | Choudhary, Rahul | 2026-02-09 | Merger auto-merge-rocm-libraries-develop-737 into gfx1250-compute-external-merge-new-737 (#664) | | f526087 | Sivasuntharampillai, Haresh | 2026-02-06 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-737 | | 2be0ac1 | Gundabolu, Sree Charan | 2026-01-29 | remove Winograd support for gfx125x (#656) | | 5bcc357 | Choudhary, Rahul | 2026-01-26 | Merger auto-merge-rocm-libraries-develop-734 into gfx1250-compute-external-merge-new-734 (#650) | | 81284af | Choudhary, Rahul | 2026-01-23 | Merger auto-merge-rocm-libraries-develop-730 into gfx1250-compute-external-merge-new-730 (#641) | | f291150 | Sivasuntharampillai, Haresh | 2026-01-22 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-730 | | a75361c | Sivasuntharampillai, Haresh | 2026-01-21 | Merge pull request #632 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-727 | | 2f66954 | Henderson, Nathan | 2026-01-19 | Merge remote-tracking branch 'origin/gfx1250' into auto-merge-rocm-libraries-develop-727 | | 4554323 | Sivasuntharampillai, Haresh | 2026-01-16 | Merge pull request #617 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-723 | | 9f1e78f | Gundabolu, Sree Charan | 2026-01-15 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-723 | | 578b3a5 | Sivasuntharampillai, Haresh | 2026-01-15 | Fix leading whitespace in backward_per_activation_fused.cpp (#602) | | 5e63aa6 | Sivasuntharampillai, Haresh | 2026-01-15 | Merge pull request #603 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-721 | | 8ee7d9b | Joao P. L. de Carvalho | 2026-01-13 | Merge remote-tracking branch 'origin/gfx1250' into auto-merge-rocm-libraries-develop-721 | | 458d1d4 | Sivasuntharampillai, Haresh | 2026-01-12 | Merge pull request #596 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-717 | | 5874b52 | Joao P. L. de Carvalho | 2026-01-09 | Merge remote-tracking branch 'origin/gfx1250' into auto-merge-rocm-libraries-develop-717 | | c4acfdd | Sivasuntharampillai, Haresh | 2026-01-09 | Merge pull request #565 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-715 | | 48df659 | hsivasun_amdeng | 2026-01-08 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-715 | | 0f8aa29 | Sivasuntharampillai, Haresh | 2026-01-07 | Merge pull request #583 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-686 | | 1b18743 | hsivasun_amdeng | 2026-01-07 | Revert "Merger auto-merge-rocm-libraries-develop-686 into gfx1250-compute-external-merge-new-686 (#502)" | | d58a75d | rocm_devops, a1 | 2025-12-24 | Merger auto-merge-rocm-libraries-develop-686 into gfx1250-compute-external-merge-new-686 (#502) | | 78c5a6a | hsivasun_amdeng | 2025-12-19 | Resolve conflicts | | e595abf | Sivasuntharampillai, Haresh | 2025-12-16 | Merge pull request #475 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-678 | | 972e06e | Choudhary, Rahul | 2025-12-09 | Merge pull request #466 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-673 | | 2c89689 | Gundabolu, Sree Charan | 2025-12-07 | Revert "MIOpen:feature:tf32:demonstrate tf32 in conv3d on MI30X platform (#1414)" (#486) | | f7d7abf | Choudhary, Rahul | 2025-12-04 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-673 | | 1cbaf5d | Choudhary, Rahul | 2025-12-04 | Comment out composable_kernel dependency for npi conflict | | 6e812f0 | Caio Salvador Rohwedder | 2025-12-04 | Merge remote-tracking branch 'origin/gfx1250' into auto-merge-rocm-libraries-develop-678 | | ee904c2 | Choudhary, Rahul | 2025-12-02 | Merge pull request #443 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-664 | | dc333a6 | Choudhary, Rahul | 2025-11-25 | resolving develop to npi merge conflcit | | 4ce9ecd | Choudhary, Rahul | 2025-11-25 | Fix merge conflict in requirements.txt, ck hash not needed in npi | | d82ab7b | Joao P. L. de Carvalho | 2025-11-19 | Merge remote-tracking branch 'origin/gfx1250' into auto-merge-rocm-libraries-develop-664 | | 6006f54 | Choudhary, Rahul | 2025-11-17 | Merge pull request #361 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-632 | | 53031dd | hsivasun_amdeng | 2025-11-06 | Fix remaining MIOpen Files | | d7f8ba9 | hsivasun_amdeng | 2025-11-06 | Fix MIOpen File | | ea6ae17 | hsivasun_amdeng | 2025-11-06 | Fix Conflicts | | 25e4fcd | Choudhary, Rahul | 2025-10-28 | Merge pull request #356 from AMD-ROCm-Internal/rahulc/develop_snapshot_1002_69082b | | 95b8027 | hsivasun_amdeng | 2025-10-23 | Resolve merge conflicts in hipblaslt and hipsparselt files | | daf8693 | Choudhary, Rahul | 2025-10-20 | Merge pull request #350 from AMD-ROCm-Internal/rahulc/develop_pre_hipDNN_snapshot_0924_84fe628 | | 5562e40 | Choudhary, Rahul | 2025-10-20 | Merge branch 'rahulc/gfx1250_reverted_PR148_9118d8adbe' into rahulc/develop_pre_hipDNN_snapshot_0924_84fe628 | | 2ef828d | Choudhary, Rahul | 2025-10-15 | Merge pull request #345 from AMD-ROCm-Internal/rahulc/develop_snpashot_091825 | | b1952f3 | hsivasun_amdeng | 2025-10-15 | Resolve merge conflict by incorporating changes from split PRs 299, 301, 302, 303,309, 314 | | bc31bc9 | Choudhary, Rahul | 2025-10-14 | Merge pull request #341 from Auto merge rocm libraries develop 595 resolve hipblaslt rocblas conflicts | | 38e58b3 | Choudhary, Rahul | 2025-10-14 | Merge pull request #336 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-590 | | 1eb4135 | Choudhary, Rahul | 2025-10-14 | Merge pull request #335 from AMD-ROCm-Internal/develop_snapshot_090925 | | a18958e | Choudhary, Rahul | 2025-09-18 | Merge pull request #183 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-595-resolve-hipblaslt-rocblas-conflicts | | 2d78484 | jichang | 2025-09-17 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-595 | | d13e390 | Choudhary, Rahul | 2025-09-11 | Merge pull request #171 from AMD-ROCm-Internal/auto-merge-rocm-libraries-develop-590 | | 84284d1 | Choudhary, Rahul | 2025-09-11 | Merge branch 'gfx1250' into auto-merge-rocm-libraries-develop-590 | | 90c7822 | Choudhary, Rahul | 2025-09-10 | Merge pull request #168 from AMD-ROCm-Internal/develop_snapshot_090925 | | bd50e7c | Choudhary, Rahul | 2025-09-10 | Merge branch 'new-gfx1250-from-develop-082125' into develop_snapshot_090925 | | 2040c29 | Choudhary, Rahul | 2025-08-26 | Merge pull request #148 from AMD-ROCm-Internal/rahchoud_amdeng-patch-8 | | 9118d8a | Gundabolu, Sree Charan | 2025-08-26 | Fix path to CK in requirements.txt | | b9eec8b | rahchoud | 2025-08-26 | adding gfx1250 specific changes | | 7d9dca0 | Choudhary, Rahul | 2025-08-25 | Update MIOPEN_USE_AMDGCN definition for GFX125X | | 3f8c33a | Choudhary, Rahul | 2025-08-25 | Update MIOPEN_USE_AMDGCN definition condition | | 3b86bbb | Choudhary, Rahul | 2025-08-25 | Update AMDGCN condition for MIOPEN_USE_AMDGCN | | 07aa109 | Choudhary, Rahul | 2025-08-25 | Update MIOPEN_USE_AMDGCN condition for compatibility | | 85a34ac | Choudhary, Rahul | 2025-08-25 | [miopen] adding gfx1250 target and related changes | </details> ## Test Plan - [x] Can be built locally. - [x] Passes CI. ## Test Result <!-- Briefly summarize test outcomes. --> ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
TCT reported multiple memory leaks coming from different rocPRIM unit tests. Specifically:
test_device_merge_inplace.cpptest_device_transform.cpptest_hipgraph_basic.cppTechnical Details
In
test_device_merge_inplace.cppin theBasictest,d_temp_storagewas never freed manually. We added a call tofree_manually()to address this issue.In
test_device_transform.cppin theUnalignedPointertest,d_unalignedandd_inputwere allocated but never freed. We added a call tohipFreeat the end of the test to address this issue.In
test_hipgraph_basic.cppthe wrong call to free ford_datawas used. Instead of callinghipFree,hipFreeAsyncshould be called instead since it was allocated withhipMallocAsync. Also the order of freeing was not correct, and needed to be rearranged.Test Plan
Run valgrind with these tests locally to check for test failures and memory leaks. As well as CI checks.
Test Result
When valgrind was ran locally no failures and leaks are observed.