SWDEV-514841 - Remove invalid stream tests on AMD platform

[ROCm/hip-tests commit: 0c1a7bf155]
Šī revīzija ir iekļauta:
Xie, Pengda
2025-05-08 16:25:23 -07:00
revīziju iesūtīja GitHub
vecāks 035c860b2a
revīzija dd6d3a6cd3
22 mainīti faili ar 9 papildinājumiem un 280 dzēšanām
@@ -230,15 +230,10 @@
"=== Disabling tests which no longer behave the same on nvidia platform ===",
"Unit_hipGraphInstantiateWithParams_Negative",
"Unit_hipGraphAddChildGraphNode_OrgGraphAsChildGraph",
"Unit_hipStreamBeginCapture_Negative_Parameters",
"Unit_hipStreamDestroy_Negative_DoubleDestroy",
"Unit_hipDeviceSynchronize_Positive_Nullstream",
"Unit_hipDeviceSynchronize_Functional",
"Unit_hipGetSetDeviceFlags_InvalidFlag",
"Unit_hipDeviceReset_Positive_Basic",
"Unit_hipDeviceReset_Positive_Threaded",
"Unit_hipModuleLaunchKernel_Negative_Parameters",
"Unit_hipModuleGetTexRef_Positive_Basic",
"Unit_hipLaunchCooperativeKernel_Negative_Parameters"
"Unit_hipModuleGetTexRef_Positive_Basic"
]
}
@@ -62,15 +62,10 @@
"=== Disabling tests which no longer behave the same on nvidia platform ===",
"Unit_hipGraphInstantiateWithParams_Negative",
"Unit_hipGraphAddChildGraphNode_OrgGraphAsChildGraph",
"Unit_hipStreamBeginCapture_Negative_Parameters",
"Unit_hipStreamDestroy_Negative_DoubleDestroy",
"Unit_hipDeviceSynchronize_Positive_Nullstream",
"Unit_hipDeviceSynchronize_Functional",
"Unit_hipGetSetDeviceFlags_InvalidFlag",
"Unit_hipDeviceReset_Positive_Basic",
"Unit_hipDeviceReset_Positive_Threaded",
"Unit_hipModuleLaunchKernel_Negative_Parameters",
"Unit_hipModuleGetTexRef_Positive_Basic",
"Unit_hipLaunchCooperativeKernel_Negative_Parameters"
"Unit_hipModuleGetTexRef_Positive_Basic"
]
}
@@ -241,8 +241,8 @@ TEST_CASE("Unit_hipGetSetDeviceFlags_InvalidFlag") {
0b101, // schedule flags should not overlap
0b110, // schedule flags should not overlap
0b111, // schedule flags should not overlap
0b100000, // out of bounds
//0b100000, // out of bounds is no longer invalid
0xFFFF);
CAPTURE(invalidFlag);
HIP_CHECK_ERROR(hipSetDeviceFlags(invalidFlag), hipErrorInvalidValue);
}
}
@@ -176,13 +176,4 @@ TEST_CASE("Unit_hipLaunchCooperativeKernel_Negative_Parameters") {
dim3{1, 1, 1}, nullptr, max, nullptr),
hipErrorCooperativeLaunchTooLarge);
}
SECTION("Invalid stream") {
hipStream_t stream = nullptr;
HIP_CHECK(hipStreamCreate(&stream));
HIP_CHECK(hipStreamDestroy(stream));
HIP_CHECK_ERROR(hipLaunchCooperativeKernel(reinterpret_cast<void*>(kernel), dim3{1, 1, 1},
dim3{1, 1, 1}, nullptr, 0, stream),
hipErrorContextIsDestroyed);
}
}
}
@@ -95,46 +95,6 @@ TEST_CASE("Unit_hipGraphLaunch_Negative") {
HIP_CHECK(hipGraphDestroy(graph));
HIP_CHECK(hipStreamDestroy(stream));
}
/* In this case in CUDA setup this api call leads to undefined behavior
So enabling this test only for AMD and checking with hipSuccess */
#if HT_AMD
SECTION("Destroy stream and try to launch respective executable graph") {
constexpr size_t Nbytes = 1024;
hipGraph_t graph;
hipGraphExec_t graphExec;
hipStream_t stream;
hipGraphNode_t memsetNode;
char *devData;
HIP_CHECK(hipMalloc(&devData, Nbytes));
HIP_CHECK(hipGraphCreate(&graph, 0));
HIP_CHECK(hipStreamCreate(&stream));
hipMemsetParams memsetParams{};
memset(&memsetParams, 0, sizeof(memsetParams));
memsetParams.dst = reinterpret_cast<void*>(devData);
memsetParams.value = 0;
memsetParams.pitch = 0;
memsetParams.elementSize = sizeof(char);
memsetParams.width = Nbytes;
memsetParams.height = 1;
HIP_CHECK(hipGraphAddMemsetNode(&memsetNode, graph, nullptr, 0,
&memsetParams));
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
HIP_CHECK(hipGraphLaunch(graphExec, stream));
HIP_CHECK(hipStreamSynchronize(stream));
HIP_CHECK(hipStreamDestroy(stream));
// Launch again after destroy stream
ret = hipGraphLaunch(graphExec, stream);
REQUIRE(hipSuccess != ret);
HIP_CHECK(hipFree(devData));
HIP_CHECK(hipGraphExecDestroy(graphExec));
HIP_CHECK(hipGraphDestroy(graph));
}
#endif
SECTION("Destroy graph and try to launch respective executable graph") {
constexpr size_t Nbytes = 1024;
hipGraph_t graph;
@@ -29,7 +29,9 @@ THE SOFTWARE.
* enqueues a host function call in a stream
*/
#if HT_NVIDIA
static void hostNodeCallbackDummy(void* data) { REQUIRE(data == nullptr); }
#endif
static void hostNodeCallback(void* data) {
float** userData = static_cast<float**>(data);
@@ -67,16 +69,6 @@ TEST_CASE("Unit_hipLaunchHostFunc_Negative_Parameters") {
SECTION("Pass functions as nullptr") {
HIP_CHECK_ERROR(hipLaunchHostFunc(stream, nullptr, nullptr), hipErrorInvalidValue);
}
#if HT_AMD
SECTION("Pass uninitialized stream") {
hipHostFn_t fn = hostNodeCallbackDummy;
constexpr auto InvalidStream = [] {
StreamGuard sg(Streams::created);
return sg.stream();
};
HIP_CHECK_ERROR(hipLaunchHostFunc(InvalidStream(), fn, nullptr), hipErrorContextIsDestroyed);
}
#endif
}
/**
@@ -199,14 +199,6 @@ TEST_CASE("Unit_hipStreamBeginCapture_Negative_Parameters") {
SECTION("Creating hipStream with invalid mode") {
HIP_CHECK_ERROR(hipStreamBeginCapture(stream, hipStreamCaptureMode(-1)), hipErrorInvalidValue);
}
SECTION("Stream capture on uninitialized stream returns error code.") {
constexpr auto InvalidStream = [] {
StreamGuard sg(Streams::created);
return sg.stream();
};
HIP_CHECK_ERROR(hipStreamBeginCapture(InvalidStream(), hipStreamCaptureModeGlobal),
hipErrorContextIsDestroyed);
}
}
/**
@@ -62,15 +62,6 @@ TEST_CASE("Unit_hipStreamEndCapture_Negative_Parameters") {
SECTION("End capture on stream where capture has not yet started") {
HIP_CHECK_ERROR(hipStreamEndCapture(stream, &graph), hipErrorIllegalState);
}
#if HT_AMD
SECTION("Destroy stream and try to end capture") {
hipStream_t destroyed_stream;
HIP_CHECK(hipStreamCreate(&destroyed_stream));
HIP_CHECK(hipStreamBeginCapture(destroyed_stream, hipStreamCaptureModeGlobal));
HIP_CHECK(hipStreamDestroy(destroyed_stream));
HIP_CHECK_ERROR(hipStreamEndCapture(destroyed_stream, &graph), hipErrorContextIsDestroyed);
}
#endif
}
/**
@@ -80,17 +80,6 @@ TEST_CASE("Unit_hipStreamEndCapture_Negative") {
REQUIRE(hipErrorIllegalState == ret);
HIP_CHECK(hipStreamDestroy(stream));
}
#if HT_AMD
SECTION("Destroy stream and try to end capture") {
hipStream_t stream;
hipGraph_t graph;
HIP_CHECK(hipStreamCreate(&stream));
HIP_CHECK(hipStreamBeginCapture(stream, hipStreamCaptureModeGlobal));
HIP_CHECK(hipStreamDestroy(stream));
ret = hipStreamEndCapture(stream, &graph);
REQUIRE(hipErrorContextIsDestroyed == ret);
}
#endif
SECTION("Destroy graph and try to end capture in between") {
hipStream_t stream{nullptr};
hipGraph_t graph{nullptr};
@@ -123,12 +123,6 @@ TEST_CASE("Unit_hipMallocAsync_Negative_Parameters") {
HIP_CHECK_ERROR(hipMallocAsync(nullptr, alloc_size, stream.stream()), hipErrorInvalidValue);
}
SECTION("invalid stream handle") {
HIP_CHECK_ERROR(
hipMallocAsync(reinterpret_cast<void**>(&p), alloc_size, reinterpret_cast<hipStream_t>(-1)),
hipErrorInvalidHandle);
}
SECTION("Size is max size_t") {
HIP_CHECK_ERROR(hipMallocAsync(reinterpret_cast<void**>(&p), max_size, stream.stream()),
hipErrorOutOfMemory);
@@ -134,12 +134,6 @@ TEST_CASE("Unit_hipMallocFromPoolAsync_Negative_Parameters") {
hipErrorInvalidValue);
}
SECTION("Invalid stream handle") {
HIP_CHECK_ERROR(hipMallocFromPoolAsync(static_cast<void**>(&p), alloc_size, mempool.mempool(),
reinterpret_cast<hipStream_t>(-1)),
hipErrorInvalidHandle);
}
SECTION("Size is max size_t") {
HIP_CHECK_ERROR(hipMallocFromPoolAsync(static_cast<void**>(&p), max_size, mempool.mempool(),
stream.stream()),
@@ -155,13 +155,4 @@ TEST_CASE("Unit_hipMemPrefetchAsync_Negative_Parameters") {
HIP_CHECK_ERROR(hipMemPrefetchAsync(alloc.ptr(), kPageSize, hipInvalidDeviceId),
hipErrorInvalidDevice);
}
#if HT_AMD
SECTION("Invalid stream") {
hipStream_t stream;
HIP_CHECK(hipStreamCreate(&stream));
HIP_CHECK(hipStreamDestroy(stream));
HIP_CHECK_ERROR(hipMemPrefetchAsync(alloc.ptr(), kPageSize, device, stream),
hipErrorContextIsDestroyed);
}
#endif
}
@@ -80,10 +80,6 @@ TEST_CASE("Unit_hipMemcpyAsync_Positive_Synchronization_Behavior") {
TEST_CASE("Unit_hipMemcpyAsync_Negative_Parameters") {
using namespace std::placeholders;
constexpr auto InvalidStream = [] {
StreamGuard sg(Streams::created);
return sg.stream();
};
SECTION("Host to device") {
LinearAllocGuard<int> device_alloc(LinearAllocs::hipMalloc, kPageSize);
@@ -97,13 +93,6 @@ TEST_CASE("Unit_hipMemcpyAsync_Negative_Parameters") {
static_cast<hipMemcpyKind>(-1), nullptr),
hipErrorInvalidMemcpyDirection);
}
#if HT_AMD
SECTION("Invalid stream") {
HIP_CHECK_ERROR(hipMemcpyAsync(device_alloc.ptr(), host_alloc.ptr(), kPageSize,
hipMemcpyHostToDevice, InvalidStream()),
hipErrorContextIsDestroyed);
}
#endif
}
SECTION("Device to host") {
@@ -118,14 +107,6 @@ TEST_CASE("Unit_hipMemcpyAsync_Negative_Parameters") {
static_cast<hipMemcpyKind>(-1), nullptr),
hipErrorInvalidMemcpyDirection);
}
#if HT_AMD
SECTION("Invalid stream") {
HIP_CHECK_ERROR(hipMemcpyAsync(host_alloc.ptr(), device_alloc.ptr(), kPageSize,
hipMemcpyDeviceToHost, InvalidStream()),
hipErrorContextIsDestroyed);
}
#endif
}
SECTION("Host to host") {
@@ -140,13 +121,6 @@ TEST_CASE("Unit_hipMemcpyAsync_Negative_Parameters") {
static_cast<hipMemcpyKind>(-1), nullptr),
hipErrorInvalidMemcpyDirection);
}
#if HT_AMD
SECTION("Invalid stream") {
HIP_CHECK_ERROR(hipMemcpyAsync(dst_alloc.ptr(), src_alloc.ptr(), kPageSize,
hipMemcpyHostToHost, InvalidStream()),
hipErrorContextIsDestroyed);
}
#endif
}
SECTION("Device to device") {
@@ -162,12 +136,5 @@ TEST_CASE("Unit_hipMemcpyAsync_Negative_Parameters") {
static_cast<hipMemcpyKind>(-1), nullptr),
hipErrorInvalidMemcpyDirection);
}
#if HT_AMD
SECTION("Invalid stream") {
HIP_CHECK_ERROR(hipMemcpyAsync(dst_alloc.ptr(), src_alloc.ptr(), kPageSize,
hipMemcpyDeviceToDevice, InvalidStream()),
hipErrorContextIsDestroyed);
}
#endif
}
}
@@ -25,11 +25,6 @@ THE SOFTWARE.
#include <resource_guards.hh>
#include <utils.hh>
static hipStream_t InvalidStream() {
StreamGuard sg(Streams::created);
return sg.stream();
}
TEST_CASE("Unit_hipMemcpyDtoHAsync_Positive_Basic") {
const auto stream_type = GENERATE(Streams::nullstream, Streams::perThread, Streams::created);
const StreamGuard stream_guard(stream_type);
@@ -70,14 +65,6 @@ TEST_CASE("Unit_hipMemcpyDtoHAsync_Negative_Parameters") {
return hipMemcpyDtoHAsync(dst, reinterpret_cast<hipDeviceptr_t>(src), count, nullptr);
},
host_alloc.ptr(), device_alloc.ptr(), kPageSize);
#if HT_AMD
SECTION("Invalid stream") {
HIP_CHECK_ERROR(
hipMemcpyDtoHAsync(host_alloc.ptr(), reinterpret_cast<hipDeviceptr_t>(device_alloc.ptr()),
kPageSize, InvalidStream()),
hipErrorContextIsDestroyed);
}
#endif
}
TEST_CASE("Unit_hipMemcpyHtoDAsync_Positive_Basic") {
@@ -116,13 +103,6 @@ TEST_CASE("Unit_hipMemcpyHtoDAsync_Negative_Parameters") {
return hipMemcpyHtoDAsync(reinterpret_cast<hipDeviceptr_t>(dst), src, count, nullptr);
},
device_alloc.ptr(), host_alloc.ptr(), kPageSize);
#if HT_AMD
SECTION("Invalid stream") {
HIP_CHECK_ERROR(hipMemcpyHtoDAsync(reinterpret_cast<hipDeviceptr_t>(device_alloc.ptr()),
host_alloc.ptr(), kPageSize, InvalidStream()),
hipErrorContextIsDestroyed);
}
#endif
}
TEST_CASE("Unit_hipMemcpyDtoDAsync_Positive_Basic") {
@@ -167,14 +147,6 @@ TEST_CASE("Unit_hipMemcpyDtoDAsync_Negative_Parameters") {
reinterpret_cast<hipDeviceptr_t>(src), count, nullptr);
},
dst_alloc.ptr(), src_alloc.ptr(), kPageSize);
#if HT_AMD
SECTION("Invalid stream") {
HIP_CHECK_ERROR(hipMemcpyDtoDAsync(reinterpret_cast<hipDeviceptr_t>(dst_alloc.ptr()),
reinterpret_cast<hipDeviceptr_t>(src_alloc.ptr()), kPageSize,
InvalidStream()),
hipErrorContextIsDestroyed);
}
#endif
}
/**
@@ -181,12 +181,6 @@ TEST_CASE("Unit_hipStreamAttachMemAsync_Negative_Parameters") {
LinearAllocGuard<hipDeviceptr_t> managed(LinearAllocs::hipMallocManaged, kPageSize,
hipMemAttachHost);
SECTION("invalid stream") {
HIP_CHECK(hipStreamDestroy(stream.stream()));
HIP_CHECK_ERROR(hipStreamAttachMemAsync(stream.stream(), managed.ptr()),
hipErrorContextIsDestroyed);
}
SECTION("dev_ptr == nullptr") {
HIP_CHECK_ERROR(hipStreamAttachMemAsync(stream.stream(), nullptr), hipErrorInvalidValue);
}
@@ -221,4 +215,4 @@ TEST_CASE("Unit_hipStreamAttachMemAsync_Negative_Parameters") {
hipErrorInvalidValue);
}
}
}
}
@@ -212,18 +212,6 @@ template <ExtModuleLaunchKernelSig* func> void ModuleLaunchKernelNegativeParamet
hipErrorInvalidValue);
}
SECTION("Invalid stream") {
hipStream_t stream = nullptr;
HIP_CHECK(hipStreamCreate(&stream));
HIP_CHECK(hipStreamDestroy(stream));
hipError_t err = hipErrorInvalidValue;
#if HT_NVIDIA
err = hipErrorContextIsDestroyed;
#endif
HIP_CHECK_ERROR(func(f, 1, 1, 1, 1, 1, 0, 0, stream, nullptr, nullptr, nullptr, nullptr, 0u),
err);
}
SECTION("Passing kernel_args and extra simultaneously") {
hipFunction_t f = GetKernel(mg.module(), "Kernel42");
LinearAllocGuard<int> result_dev(LinearAllocs::hipMalloc, sizeof(int));
@@ -28,13 +28,6 @@ TEST_CASE("Unit_hipStreamDestroy_Default") {
HIP_CHECK(hipStreamDestroy(stream));
}
TEST_CASE("Unit_hipStreamDestroy_Negative_DoubleDestroy") {
hipStream_t stream{};
HIP_CHECK(hipStreamCreate(&stream));
HIP_CHECK(hipStreamDestroy(stream));
HIP_CHECK_ERROR(hipStreamDestroy(stream), hipErrorContextIsDestroyed);
}
TEST_CASE("Unit_hipStreamDestroy_Negative_NullStream") {
HIP_CHECK_ERROR(hipStreamDestroy(nullptr), hipErrorInvalidResourceHandle);
}
@@ -62,32 +62,6 @@ TEST_CASE("Unit_hipStreamQuery_WithFinishedWork") {
}
}
#if !HT_NVIDIA
/**
* @brief Check that submitting work to a destroyed stream sets its status as
* hipErrorContextIsDestroyed
*
* Test removed for Nvidia devices because it returns unexpected error
*/
TEST_CASE("Unit_hipStreamQuery_WithDestroyedStream") {
hipStream_t stream{nullptr};
HIP_CHECK(hipStreamCreate(&stream));
HIP_CHECK(hipStreamDestroy(stream));
HIP_CHECK_ERROR(hipStreamQuery(stream), hipErrorContextIsDestroyed);
}
/**
* @brief Check that submitting work to an uninitialized stream sets its status as
* hipErrorContextIsDestroyed
*
* Test removed for Nvidia devices because it returns unexpected error
*/
TEST_CASE("Unit_hipStreamQuery_WithUninitializedStream") {
hipStream_t stream{reinterpret_cast<hipStream_t>(0xFFFF)};
HIP_CHECK_ERROR(hipStreamQuery(stream), hipErrorContextIsDestroyed);
}
#endif
#if HT_AMD /* Disabled because frequency based wait is timing out on nvidia platforms */
/**
@@ -94,17 +94,6 @@ TEST_CASE("Unit_hipStreamQuery_spt_WithFinishedWork") {
*/
#if HT_AMD
TEST_CASE("Unit_hipStreamQuery_spt_NegativeCases") {
SECTION("Query Destroyed Stream") {
hipStream_t stream{nullptr};
HIP_CHECK(hipStreamCreate(&stream));
HIP_CHECK(hipStreamDestroy(stream));
HIP_CHECK_ERROR(hipStreamQuery_spt(stream), hipErrorContextIsDestroyed);
}
SECTION("Query Uninitialized Stream") {
hipStream_t streamUnInit{reinterpret_cast<hipStream_t>(0xFFFF)};
HIP_CHECK_ERROR(hipStreamQuery_spt(streamUnInit),
hipErrorContextIsDestroyed);
}
SECTION("Submit Work On Stream And Query Null Stream") {
hipStream_t ValidStream;
HIP_CHECK(hipStreamCreate(&ValidStream));
@@ -33,19 +33,6 @@ TEST_CASE("Unit_hipStreamSynchronize_EmptyStream") {
HIP_CHECK(hipStreamDestroy(stream));
}
#if !HT_NVIDIA
/**
* @brief Check that synchronization of uninitialized stream sets its status to
* hipErrorContextIsDestroyed
*
* Test removed for Nvidia devices because it returns unexpected error
*/
TEST_CASE("Unit_hipStreamSynchronize_UninitializedStream") {
hipStream_t stream{reinterpret_cast<hipStream_t>(0xFFFF)};
HIP_CHECK_ERROR(hipStreamSynchronize(stream), hipErrorContextIsDestroyed);
}
#endif
#if HT_AMD /* Disabled because frequency based wait is timing out on nvidia platforms */
/**
@@ -166,4 +153,4 @@ TEST_CASE("Unit_hipStreamSynchronize_NullStreamAndStreamPerThread") {
HIP_CHECK_ERROR(hipStreamQuery(hip::nullStream), hipSuccess);
}
#endif
} // namespace hipStreamSynchronizeTest
} // namespace hipStreamSynchronizeTest
@@ -59,10 +59,6 @@ TEST_CASE("Unit_hipStreamSynchronize_spt_EmptyStream") {
*/
#if HT_AMD
TEST_CASE("Unit_hipStreamSynchronize_spt_UninitializedStream") {
hipStream_t stream{reinterpret_cast<hipStream_t>(0xFFFF)};
HIP_CHECK_ERROR(hipStreamSynchronize_spt(stream), hipErrorContextIsDestroyed);
}
/**
* Test Description
* ------------------------
@@ -19,7 +19,6 @@ THE SOFTWARE.
/*
Testcase Scenarios :
Unit_hipStreamWaitEvent_Negative - Test unsuccessful hipStreamWaitEvent when either event or flags are invalid
Unit_hipStreamWaitEvent_UninitializedStream_Negative - Test unsuccessful hipStreamWaitEvent when stream is uninitialized
Unit_hipStreamWaitEvent_Default - Test simple waiting for an event with hipStreamWaitEvent api
Unit_hipStreamWaitEvent_DifferentStreams - Test waiting for an event on a different stream with hipStreamWaitEvent api
*/
@@ -65,20 +64,6 @@ TEST_CASE("Unit_hipStreamWaitEvent_Negative") {
}
}
/* Test removed for Nvidia devices because it returns unexpected error */
#if !HT_NVIDIA
TEST_CASE("Unit_hipStreamWaitEvent_UninitializedStream_Negative") {
hipStream_t stream{reinterpret_cast<hipStream_t>(0xFFFF)};
hipEvent_t event{nullptr};
HIP_CHECK(hipEventCreate(&event));
HIP_CHECK_ERROR(hipStreamWaitEvent(stream, event, 0), hipErrorInvalidHandle);
HIP_CHECK(hipEventDestroy(event));
}
#endif
TEST_CASE("Unit_hipStreamWaitEvent_Default") {
hipStream_t stream{nullptr};
hipEvent_t waitEvent{nullptr};