Skip to content

Commit 8946cdc

Browse files
kliegeoisassistant-librarian[bot]
authored andcommitted
[rocm-libraries] ROCm/rocm-libraries#1726 (commit a589ab3)
[rocSPARSE] sync before hipFree. (#1705) Propagate #1705 to 7.0.
1 parent dc63d50 commit 8946cdc

14 files changed

+95
-11
lines changed

.jenkins/common.groovy

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,6 @@ def runCoverageCommand (platform, project, gfilter, String dirmode = "release")
123123
"""
124124

125125
platform.runCommand(this, command)
126-
127-
publishHTML([allowMissing: false,
128-
alwaysLinkToLastBuild: false,
129-
keepAll: false,
130-
reportDir: "${project.paths.project_build_prefix}/build/${dirmode}/coverage-report",
131-
reportFiles: "index.html",
132-
reportName: "Code coverage report",
133-
reportTitles: "Code coverage report"])
134126
}
135127

136128
}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
Documentation for rocSPARSE is available at
44
[https://rocm.docs.amd.com/projects/rocSPARSE/en/latest/](https://rocm.docs.amd.com/projects/rocSPARSE/en/latest/).
55

6+
## rocSPARSE 4.0.3 for ROCm 7.0.2
7+
8+
### Resolved issues
9+
10+
* Resolved an issue causing premature deallocation of internal buffers still in use.
11+
612
## rocSPARSE 4.0.2 for ROCm 7.0.0
713

814
### Added

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
223223
endif( )
224224

225225
# Setup version
226-
set(VERSION_STRING "4.0.2")
226+
set(VERSION_STRING "4.0.3")
227227
set(SOVERSION_STRING "1.0")
228228

229229
rocm_setup_version(VERSION ${VERSION_STRING})

library/src/auxiliary/rocsparse_auxiliary.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,14 @@ try
12981298
ROCSPARSE_ROUTINE_TRACE;
12991299

13001300
ROCSPARSE_CHECKARG_POINTER(0, hyb);
1301+
1302+
// Due to the changes in the hipFree introduced in HIP 7.0
1303+
// https://rocm.docs.amd.com/projects/HIP/en/latest/hip-7-changes.html#update-hipfree
1304+
// we need to introduce a device synchronize here as the below hipFree calls are now asynchronous.
1305+
// hipFree() previously had an implicit wait for synchronization purpose which is applicable for all memory allocations.
1306+
// This wait has been disabled in the HIP 7.0 runtime for allocations made with hipMallocAsync and hipMallocFromPoolAsync.
1307+
RETURN_IF_HIP_ERROR(hipDeviceSynchronize());
1308+
13011309
// Clean up ELL part
13021310
if(hyb->ell_col_ind != nullptr)
13031311
{
@@ -4977,6 +4985,13 @@ try
49774985

49784986
ROCSPARSE_CHECKARG_POINTER(0, descr);
49794987

4988+
// Due to the changes in the hipFree introduced in HIP 7.0
4989+
// https://rocm.docs.amd.com/projects/HIP/en/latest/hip-7-changes.html#update-hipfree
4990+
// we need to introduce a device synchronize here as the below hipFree calls are now asynchronous.
4991+
// hipFree() previously had an implicit wait for synchronization purpose which is applicable for all memory allocations.
4992+
// This wait has been disabled in the HIP 7.0 runtime for allocations made with hipMallocAsync and hipMallocFromPoolAsync.
4993+
RETURN_IF_HIP_ERROR(hipDeviceSynchronize());
4994+
49804995
// Clean up row pointer array
49814996
if(descr->csr_row_ptr_C != nullptr)
49824997
{

library/src/common/rocsparse_handle.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ _rocsparse_handle::~_rocsparse_handle()
152152
{
153153
ROCSPARSE_ROUTINE_TRACE;
154154

155+
// Due to the changes in the hipFree introduced in HIP 7.0
156+
// https://rocm.docs.amd.com/projects/HIP/en/latest/hip-7-changes.html#update-hipfree
157+
// we need to introduce a device synchronize here as the below hipFree calls are now asynchronous.
158+
// hipFree() previously had an implicit wait for synchronization purpose which is applicable for all memory allocations.
159+
// This wait has been disabled in the HIP 7.0 runtime for allocations made with hipMallocAsync and hipMallocFromPoolAsync.
160+
PRINT_IF_HIP_ERROR(hipDeviceSynchronize());
161+
155162
PRINT_IF_HIP_ERROR(rocsparse_hipFree(buffer));
156163
PRINT_IF_HIP_ERROR(rocsparse_hipFree(sone));
157164
PRINT_IF_HIP_ERROR(rocsparse_hipFree(done));

library/src/common/rocsparse_mat_info.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ _rocsparse_mat_info::~_rocsparse_mat_info()
187187
// Clear csritsv info struct
188188
WARNING_IF_ROCSPARSE_ERROR(rocsparse::destroy_csritsv_info(this->csritsv_info));
189189

190+
// Due to the changes in the hipFree introduced in HIP 7.0
191+
// https://rocm.docs.amd.com/projects/HIP/en/latest/hip-7-changes.html#update-hipfree
192+
// we need to introduce a device synchronize here as the below hipFree calls are now asynchronous.
193+
// hipFree() previously had an implicit wait for synchronization purpose which is applicable for all memory allocations.
194+
// This wait has been disabled in the HIP 7.0 runtime for allocations made with hipMallocAsync and hipMallocFromPoolAsync.
195+
WARNING_IF_HIP_ERROR(hipDeviceSynchronize());
196+
190197
// Clear zero pivot
191198
WARNING_IF_HIP_ERROR(rocsparse_hipFree(this->zero_pivot));
192199

library/src/common/rocsparse_trm_info.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727

2828
rocsparse::trm_info_t::~trm_info_t()
2929
{
30+
// Due to the changes in the hipFree introduced in HIP 7.0
31+
// https://rocm.docs.amd.com/projects/HIP/en/latest/hip-7-changes.html#update-hipfree
32+
// we need to introduce a device synchronize here as the below hipFree calls are now asynchronous.
33+
// hipFree() previously had an implicit wait for synchronization purpose which is applicable for all memory allocations.
34+
// This wait has been disabled in the HIP 7.0 runtime for allocations made with hipMallocAsync and hipMallocFromPoolAsync.
35+
WARNING_IF_HIP_ERROR(hipDeviceSynchronize());
36+
3037
WARNING_IF_HIP_ERROR(rocsparse_hipFree(this->row_map));
3138
this->row_map = nullptr;
3239

library/src/conversion/rocsparse_csxsldu_preprocess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace rocsparse
5757

5858
if(temp_alloc)
5959
{
60-
RETURN_IF_HIP_ERROR(rocsparse_hipFree(temp_storage_ptr));
60+
RETURN_IF_HIP_ERROR(rocsparse_hipFreeAsync(temp_storage_ptr, handle->stream));
6161
}
6262

6363
return rocsparse_status_success;

library/src/conversion/rocsparse_extract.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ struct _rocsparse_extract_descr
3838
int64_t* m_device_nnz{};
3939
virtual ~_rocsparse_extract_descr()
4040
{
41+
// Due to the changes in the hipFree introduced in HIP 7.0
42+
// https://rocm.docs.amd.com/projects/HIP/en/latest/hip-7-changes.html#update-hipfree
43+
// we need to introduce a device synchronize here as the below hipFree calls are now asynchronous.
44+
// hipFree() previously had an implicit wait for synchronization purpose which is applicable for all memory allocations.
45+
// This wait has been disabled in the HIP 7.0 runtime for allocations made with hipMallocAsync and hipMallocFromPoolAsync.
46+
WARNING_IF_HIP_ERROR(hipDeviceSynchronize());
47+
4148
std::ignore = rocsparse_hipFree(this->m_device_nnz);
4249
}
4350

library/src/conversion/rocsparse_sparse_to_sparse.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,14 @@ try
175175
&ind_type,
176176
&base,
177177
&val_type));
178+
179+
// Due to the changes in the hipFree introduced in HIP 7.0
180+
// https://rocm.docs.amd.com/projects/HIP/en/latest/hip-7-changes.html#update-hipfree
181+
// we need to introduce a device synchronize here as the below hipFree calls are now asynchronous.
182+
// hipFree() previously had an implicit wait for synchronization purpose which is applicable for all memory allocations.
183+
// This wait has been disabled in the HIP 7.0 runtime for allocations made with hipMallocAsync and hipMallocFromPoolAsync.
184+
RETURN_IF_HIP_ERROR(hipDeviceSynchronize());
185+
178186
RETURN_IF_HIP_ERROR(rocsparse_hipFree(row));
179187
RETURN_IF_HIP_ERROR(rocsparse_hipFree(col));
180188
RETURN_IF_HIP_ERROR(rocsparse_hipFree(val));

0 commit comments

Comments
 (0)