CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
126 lines
3.5 KiB
C++
126 lines
3.5 KiB
C++
/*
|
|
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <hip_test_common.hh>
|
|
#include <utils.hh>
|
|
#include "streamCommon.hh"
|
|
/**
|
|
* @addtogroup hipStreamQuery_spt hipStreamQuery_spt
|
|
* @{
|
|
* @ingroup StreamTest
|
|
* `hipStreamQuery_spt(hipStream_t stream)` -
|
|
* Returns status of a stream
|
|
*/
|
|
|
|
/**
|
|
* Test Description
|
|
* ------------------------
|
|
* - Test to query a stream with no work returns hipSuccess or not.
|
|
* Test source
|
|
* ------------------------
|
|
* - /unit/stream/hipStreamQuery_spt.cc
|
|
* Test requirements
|
|
* ------------------------
|
|
* - HIP_VERSION >= 6.2
|
|
*/
|
|
HIP_TEST_CASE(Unit_hipStreamQuery_spt_WithNoWork) {
|
|
hipStream_t stream{nullptr};
|
|
|
|
SECTION("Null Stream") { HIP_CHECK(hipStreamQuery_spt(stream)); }
|
|
|
|
SECTION("Created Stream") {
|
|
HIP_CHECK(hipStreamCreate(&stream));
|
|
HIP_CHECK(hipStreamQuery_spt(stream));
|
|
HIP_CHECK(hipStreamDestroy(stream));
|
|
}
|
|
}
|
|
/**
|
|
* Test Description
|
|
* ------------------------
|
|
* - Test to query a stream with finished work returns hipSuccess or not.
|
|
* Test source
|
|
* ------------------------
|
|
* - /unit/stream/hipStreamQuery_spt.cc
|
|
* Test requirements
|
|
* ------------------------
|
|
* - HIP_VERSION >= 6.2
|
|
*/
|
|
HIP_TEST_CASE(Unit_hipStreamQuery_spt_WithFinishedWork) {
|
|
hipStream_t stream{nullptr};
|
|
|
|
SECTION("Null Stream") {
|
|
hip::stream::empty_kernel<<<dim3(1), dim3(1), 0, stream>>>();
|
|
HIP_CHECK(hipStreamSynchronize(stream));
|
|
|
|
HIP_CHECK(hipStreamQuery_spt(stream));
|
|
}
|
|
|
|
SECTION("Created Stream") {
|
|
HIP_CHECK(hipStreamCreate(&stream));
|
|
hip::stream::empty_kernel<<<dim3(1), dim3(1), 0, stream>>>();
|
|
HIP_CHECK(hipStreamSynchronize(stream));
|
|
|
|
HIP_CHECK(hipStreamQuery_spt(stream));
|
|
HIP_CHECK(hipStreamDestroy(stream));
|
|
}
|
|
}
|
|
/**
|
|
* Test Description
|
|
* ------------------------
|
|
* - Negative cases to query a stream.
|
|
* Test source
|
|
* ------------------------
|
|
* - /unit/stream/hipStreamQuery_spt.cc
|
|
* Test requirements
|
|
* ------------------------
|
|
* - HIP_VERSION >= 6.2
|
|
*/
|
|
#if HT_AMD
|
|
HIP_TEST_CASE(Unit_hipStreamQuery_spt_NegativeCases) {
|
|
SECTION("Submit Work On Stream And Query Null Stream") {
|
|
hipStream_t ValidStream;
|
|
HIP_CHECK(hipStreamCreate(&ValidStream));
|
|
|
|
HIP_CHECK(hipStreamQuery_spt(hip::nullStream));
|
|
LaunchDelayKernel(std::chrono::milliseconds(500), ValidStream);
|
|
HIP_CHECK_ERROR(hipStreamQuery_spt(hip::nullStream), hipSuccess);
|
|
HIP_CHECK(hipDeviceSynchronize());
|
|
HIP_CHECK(hipStreamDestroy(ValidStream));
|
|
}
|
|
SECTION("Submit work to the nullStream") {
|
|
HIP_CHECK(hipStreamQuery_spt(hip::nullStream));
|
|
LaunchDelayKernel(std::chrono::milliseconds(500), hip::nullStream);
|
|
HIP_CHECK_ERROR(hipStreamQuery_spt(hip::nullStream), hipSuccess);
|
|
HIP_CHECK(hipStreamSynchronize(hip::nullStream));
|
|
}
|
|
}
|
|
/**
|
|
* Test Description
|
|
* ------------------------
|
|
* - Test to querying a stream with pending work returns hipErrorNotReady or not.
|
|
* Test source
|
|
* ------------------------
|
|
* - /unit/stream/hipStreamQuery_spt.cc
|
|
* Test requirements
|
|
* ------------------------
|
|
* - HIP_VERSION >= 6.2
|
|
*/
|
|
HIP_TEST_CASE(Unit_hipStreamQuery_spt_WithPendingWork) {
|
|
hipStream_t waitingStream{nullptr};
|
|
HIP_CHECK(hipStreamCreate(&waitingStream));
|
|
LaunchDelayKernel(std::chrono::milliseconds(500), waitingStream);
|
|
HIP_CHECK_ERROR(hipStreamQuery_spt(waitingStream), hipErrorNotReady);
|
|
HIP_CHECK(hipStreamSynchronize(waitingStream));
|
|
HIP_CHECK(hipStreamQuery_spt(waitingStream));
|
|
HIP_CHECK(hipStreamDestroy(waitingStream));
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* End doxygen group StreamTest.
|
|
* @}
|
|
*/
|