From 23ae8bedd1642527f20f6233806ecadbbcbeab8a Mon Sep 17 00:00:00 2001 From: Sourabh Betigeri Date: Thu, 15 Jul 2021 17:17:15 -0700 Subject: [PATCH] SWDEV-292523 - [hip]Change in the signature of streamOperations APIs, particularly 'value' arg to unsigned 'value Change-Id: If97e3de553dfef19c8bf2d9797a6c68ec94a0ff6 [ROCm/hip commit: 6deaba3fa72ff37ac6396a378487b45b7573c806] --- projects/hip/include/hip/hip_runtime_api.h | 10 ++++---- .../streamOperations/hipstream_operations.cpp | 24 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/projects/hip/include/hip/hip_runtime_api.h b/projects/hip/include/hip/hip_runtime_api.h index ebf4c241eb..c548504f5a 100644 --- a/projects/hip/include/hip/hip_runtime_api.h +++ b/projects/hip/include/hip/hip_runtime_api.h @@ -300,7 +300,7 @@ typedef enum __HIP_NODISCARD hipError_t { ///< recorded in a capturing stream. hipErrorStreamCaptureWrongThread = 908, ///< A stream capture sequence not initiated with ///< the hipStreamCaptureModeRelaxed argument to - ///< hipStreamBeginCapture was passed to + ///< hipStreamBeginCapture was passed to ///< hipStreamEndCapture in a different thread. hipErrorUnknown = 999, //< Unknown error. // HSA Runtime Error Codes start here. @@ -1653,7 +1653,7 @@ hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback * @see hipExtMallocWithFlags, hipFree, hipStreamWaitValue64, hipStreamWriteValue64, * hipStreamWriteValue32, hipDeviceGetAttribute */ -hipError_t hipStreamWaitValue32(hipStream_t stream, void* ptr, int32_t value, unsigned int flags, +hipError_t hipStreamWaitValue32(hipStream_t stream, void* ptr, uint32_t value, unsigned int flags, uint32_t mask __dparm(0xFFFFFFFF)); /** * @brief Enqueues a wait command to the stream. @@ -1684,7 +1684,7 @@ hipError_t hipStreamWaitValue32(hipStream_t stream, void* ptr, int32_t value, un * @see hipExtMallocWithFlags, hipFree, hipStreamWaitValue32, hipStreamWriteValue64, * hipStreamWriteValue32, hipDeviceGetAttribute */ -hipError_t hipStreamWaitValue64(hipStream_t stream, void* ptr, int64_t value, unsigned int flags, +hipError_t hipStreamWaitValue64(hipStream_t stream, void* ptr, uint64_t value, unsigned int flags, uint64_t mask __dparm(0xFFFFFFFFFFFFFFFF)); /** * @brief Enqueues a write command to the stream. @@ -1702,7 +1702,7 @@ hipError_t hipStreamWaitValue64(hipStream_t stream, void* ptr, int64_t value, un * @see hipExtMallocWithFlags, hipFree, hipStreamWriteValue32, hipStreamWaitValue32, * hipStreamWaitValue64 */ -hipError_t hipStreamWriteValue32(hipStream_t stream, void* ptr, int32_t value, unsigned int flags); +hipError_t hipStreamWriteValue32(hipStream_t stream, void* ptr, uint32_t value, unsigned int flags); /** * @brief Enqueues a write command to the stream. * @@ -1719,7 +1719,7 @@ hipError_t hipStreamWriteValue32(hipStream_t stream, void* ptr, int32_t value, u * @see hipExtMallocWithFlags, hipFree, hipStreamWriteValue32, hipStreamWaitValue32, * hipStreamWaitValue64 */ -hipError_t hipStreamWriteValue64(hipStream_t stream, void* ptr, int64_t value, unsigned int flags); +hipError_t hipStreamWriteValue64(hipStream_t stream, void* ptr, uint64_t value, unsigned int flags); // end doxygen Stream Memory Operations /** * @} diff --git a/projects/hip/tests/src/runtimeApi/streamOperations/hipstream_operations.cpp b/projects/hip/tests/src/runtimeApi/streamOperations/hipstream_operations.cpp index 2627201df9..f47328d573 100644 --- a/projects/hip/tests/src/runtimeApi/streamOperations/hipstream_operations.cpp +++ b/projects/hip/tests/src/runtimeApi/streamOperations/hipstream_operations.cpp @@ -51,18 +51,18 @@ THE SOFTWARE. #include "test_common.h" // Random predefiend 32 and 64 bit values -constexpr int32_t value32 = 0x70F0F0FF; -constexpr int64_t value64 = 0x7FFF0000FFFF0000; +constexpr uint32_t value32 = 0x70F0F0FF; +constexpr uint64_t value64 = 0x7FFF0000FFFF0000; constexpr unsigned int writeFlag = 0; constexpr float SLEEP_MS = 100; -constexpr int32_t DATA_INIT = 0x1234; -constexpr int32_t DATA_UPDATE = 0X4321; +constexpr uint32_t DATA_INIT = 0x1234; +constexpr uint32_t DATA_UPDATE = 0X4321; struct TEST_WAIT { int compareOp; uint64_t mask; - int64_t waitValue; + uint64_t waitValue; int64_t signalValueFail; int64_t signalValuePass; }; @@ -126,7 +126,7 @@ TEST_WAIT testCases[] = { struct TEST_WAIT32_NO_MASK { int compareOp; - int32_t waitValue; + uint32_t waitValue; int32_t signalValueFail; int32_t signalValuePass; }; @@ -161,7 +161,7 @@ TEST_WAIT32_NO_MASK testCasesNoMask32[] = { struct TEST_WAIT64_NO_MASK { int compareOp; - int64_t waitValue; + uint64_t waitValue; int64_t signalValueFail; int64_t signalValuePass; }; @@ -201,8 +201,8 @@ void testWrite() { hipStream_t stream; hipStreamCreate(&stream); - int64_t* host_ptr64 = (int64_t *) malloc(sizeof(int64_t)); - int32_t* host_ptr32 = (int32_t *) malloc(sizeof(int32_t)); + uint64_t* host_ptr64 = (uint64_t *) malloc(sizeof(uint64_t)); + uint32_t* host_ptr32 = (uint32_t *) malloc(sizeof(uint32_t)); std::cout << " hipStreamWriteValue: testing ... \n"; HIPCHECK(hipExtMallocWithFlags((void **)&signalPtr, 8, hipMallocSignalMemory)); @@ -214,8 +214,8 @@ void testWrite() { *host_ptr32 = 0x0; *signalPtr = 0x0; - hipHostRegister(host_ptr64, sizeof(int64_t), 0); - hipHostRegister(host_ptr32, sizeof(int32_t), 0); + hipHostRegister(host_ptr64, sizeof(uint64_t), 0); + hipHostRegister(host_ptr32, sizeof(uint32_t), 0); // Test writting registered host pointer HIPCHECK(hipStreamWriteValue64(stream, host_ptr64, value64, writeFlag)); @@ -274,7 +274,7 @@ void waitAndWrite64(hipStream_t stream, int64_t* signalPtr, TEST_WAIT tc, int64_ HIPCHECK(hipStreamWriteValue64(stream, dataPtr64, DATA_UPDATE, writeFlag)); } void waitAndWrite32(hipStream_t stream, int64_t* signalPtr, TEST_WAIT tc, int32_t* dataPtr32) { - HIPCHECK(hipStreamWaitValue32(stream, signalPtr, static_cast(tc.waitValue), tc.compareOp, + HIPCHECK(hipStreamWaitValue32(stream, signalPtr, static_cast(tc.waitValue), tc.compareOp, static_cast(tc.mask))); HIPCHECK(hipStreamWriteValue32(stream, dataPtr32, DATA_UPDATE, writeFlag)); }