SWDEV-491253 - Create stream capture test for kernel APIs (#1189)

Este commit está contenido en:
vstojilj
2025-11-27 17:40:11 +01:00
cometido por GitHub
padre 1c09c87cc7
commit 259010f2d5
Se han modificado 6 ficheros con 108 adiciones y 9 borrados
@@ -188,8 +188,6 @@ TEST_CASE("Unit_hipExtLaunchKernel_Negative_Parameters") {
* - HIP_VERSION >= 6.0
*/
TEST_CASE("Unit_hipExtLaunchKernel_capturehipExtLaunchKernel") {
hipGraph_t graph{nullptr};
hipGraphExec_t graphExec{nullptr};
hipStream_t stream;
HIP_CHECK(hipStreamCreate(&stream));
int* A_d;
@@ -197,24 +195,21 @@ TEST_CASE("Unit_hipExtLaunchKernel_capturehipExtLaunchKernel") {
A_h = reinterpret_cast<int*>(malloc(sizeof(int)));
HIP_CHECK(hipMalloc(reinterpret_cast<void**>(&A_d), sizeof(int)));
void* args[1] = {&A_d};
// Begin Capture operation
HIP_CHECK(hipStreamBeginCapture(stream, hipStreamCaptureModeGlobal));
GENERATE_CAPTURE();
BEGIN_CAPTURE(stream);
HIP_CHECK(hipExtLaunchKernel(reinterpret_cast<void*>(kernel_42), dim3{1, 1, 1}, dim3{1, 1, 1},
args, 0, stream, nullptr, nullptr, 0u));
// End Capture
HIP_CHECK(hipStreamEndCapture(stream, &graph));
END_CAPTURE(stream);
// Create and Launch Executable Graphs
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
HIP_CHECK(hipGraphLaunch(graphExec, stream));
HIP_CHECK(hipStreamSynchronize(stream));
HIP_CHECK(hipMemcpyDtoH(A_h, A_d, sizeof(int)));
REQUIRE(A_h != nullptr);
REQUIRE(*A_h == 42);
HIP_CHECK(hipGraphExecDestroy(graphExec));
HIP_CHECK(hipGraphDestroy(graph));
HIP_CHECK(hipStreamDestroy(stream));
HIP_CHECK(hipFree(A_d));
free(A_h);