SWDEV-483130: Replace calls to deprecated functions hipHostMalloc/hipHostFree (#1070)

* SWDEV-483130: Replace calls to deprecated functions hipHostMalloc/hipHostFree

* SWDEV-483130: Replace calls to deprecated functions hipHostMalloc/hipHostFree. Moved definitions from lib/commons/defines.hpp to samples/common/defines.hpp and tests/common/defines.hpp

* Updated comment for clarity

* Update tests/rocprofv3/aborted-app/validate.py

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Formatting

* Formatting

* Updated CHANGELOG

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

[ROCm/rocprofiler-sdk commit: 8d7be2e4b4]
This commit is contained in:
itrowbri
2024-09-12 18:31:00 -05:00
committed by GitHub
parent d008463d50
commit 6099e623a4
16 changed files with 63 additions and 26 deletions
@@ -40,8 +40,9 @@ find_package(Threads REQUIRED)
add_executable(buffered-api-tracing)
target_sources(buffered-api-tracing PRIVATE main.cpp)
target_link_libraries(
buffered-api-tracing PRIVATE buffered-api-tracing-client Threads::Threads
rocprofiler-sdk::samples-build-flags)
buffered-api-tracing
PRIVATE buffered-api-tracing-client Threads::Threads
rocprofiler-sdk::samples-build-flags rocprofiler-sdk::samples-common-library)
rocprofiler_samples_get_preload_env(PRELOAD_ENV buffered-api-tracing-client)
rocprofiler_samples_get_ld_library_path_env(LIBRARY_PATH_ENV)
@@ -22,6 +22,7 @@
#include "client.hpp"
#include "common/defines.hpp"
#include "hip/hip_runtime.h"
#include <chrono>
@@ -315,7 +316,7 @@ run_scratch(int rank, int tid, hipStream_t stream, int, char** argv)
const auto* exe_name = ::basename(argv[0]);
uint64_t* data_ptr = nullptr;
HIP_API_CALL(hipHostMalloc(&data_ptr, sizeof(uint64_t), 0));
HIP_API_CALL(HIP_HOST_ALLOC_FUNC(&data_ptr, sizeof(uint64_t), 0));
*data_ptr = 0;
test_kern_small<<<1000, 1, 0, stream>>>(data_ptr);
@@ -68,3 +68,11 @@
throw std::runtime_error(errmsg.str()); \
} \
}
#if HIP_VERSION >= 60300000
# define HIP_HOST_ALLOC_FUNC hipExtHostAlloc
# define HIP_HOST_FREE_FUNC hipFreeHost
#else
# define HIP_HOST_ALLOC_FUNC hipHostMalloc
# define HIP_HOST_FREE_FUNC hipHostFree
#endif
@@ -42,7 +42,7 @@ target_sources(external-correlation-id-request PRIVATE main.cpp)
target_link_libraries(
external-correlation-id-request
PRIVATE external-correlation-id-request-client Threads::Threads
rocprofiler-sdk::samples-build-flags)
rocprofiler-sdk::samples-build-flags rocprofiler-sdk::samples-common-library)
rocprofiler_samples_get_preload_env(PRELOAD_ENV external-correlation-id-request-client)
rocprofiler_samples_get_ld_library_path_env(LIBRARY_PATH_ENV)
@@ -20,6 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include "common/defines.hpp"
#include "hip/hip_runtime.h"
#include <chrono>
@@ -304,7 +305,7 @@ run_scratch(int rank, int tid, hipStream_t stream, int, char** argv)
const auto* exe_name = ::basename(argv[0]);
uint64_t* data_ptr = nullptr;
HIP_API_CALL(hipHostMalloc(&data_ptr, sizeof(uint64_t), 0));
HIP_API_CALL(HIP_HOST_ALLOC_FUNC(&data_ptr, sizeof(uint64_t), 0));
*data_ptr = 0;
test_kern_small<<<1000, 1, 0, stream>>>(data_ptr);
@@ -39,8 +39,10 @@ find_package(Threads REQUIRED)
add_executable(pc-sampling)
target_sources(pc-sampling PRIVATE main.cpp)
target_link_libraries(pc-sampling PRIVATE pc-sampling-client Threads::Threads
rocprofiler-sdk::samples-build-flags)
target_link_libraries(
pc-sampling
PRIVATE pc-sampling-client Threads::Threads rocprofiler-sdk::samples-build-flags
rocprofiler-sdk::samples-common-library)
rocprofiler_samples_get_preload_env(PRELOAD_ENV pc-sampling-client)
rocprofiler_samples_get_ld_library_path_env(LIBRARY_PATH_ENV)
@@ -20,6 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include "common/defines.hpp"
#include "hip/hip_runtime.h"
#include <chrono>
@@ -304,7 +305,7 @@ run_scratch(int rank, int tid, hipStream_t stream, int, char** argv)
const auto* exe_name = ::basename(argv[0]);
uint64_t* data_ptr = nullptr;
HIP_API_CALL(hipHostMalloc(&data_ptr, sizeof(uint64_t), 0));
HIP_API_CALL(HIP_HOST_ALLOC_FUNC(&data_ptr, sizeof(uint64_t), 0));
*data_ptr = 0;
test_kern_small<<<1000, 1, 0, stream>>>(data_ptr);