Added testing for hipStreamSynchronize and hipStreamQuery (#2572)

[ROCm/hip commit: b7f5db36d2]
This commit is contained in:
Fábio
2022-08-08 04:59:20 +01:00
committed by GitHub
parent 132de2d9a3
commit f3ed780a7b
5 changed files with 290 additions and 62 deletions
@@ -24,33 +24,12 @@ THE SOFTWARE.
namespace hip {
inline namespace stream {
/* Empty kernel to ensure work finishes on the stream quickly */
__global__ void empty_kernel();
const hipStream_t nullStream = nullptr;
const hipStream_t streamPerThread = hipStreamPerThread;
/**
* @brief Kernel that signals a semaphore to change value from 0 to 1.
*
* @param semaphore the semaphore that needs to be signaled.
*/
__global__ void signaling_kernel(int* semaphore = nullptr);
/**
* @brief Kernel that busy waits until the specified semaphore goes from 0 to 1.
*
* @param semaphore the semaphore to wait for.
*/
__global__ void waiting_kernel(int* semaphore = nullptr);
/**
* @brief Creates a thread that runs a signaling_kernel on a non-blocking stream.
* hipStreamNonBlocking is used here to avoid interfering with tests for the Null Stream.
* You must call HIP_CHECK_THREAD_FINALIZE after joining this thread.
*
* @param semaphore memory location to signal
* @return std::thread thread that has to be joined after the testing is done.
*/
std::thread startSignalingThread(int* semaphore = nullptr);
// Checks stream for valid values of flags and priority
bool checkStream(hipStream_t stream);