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

This commit is contained in:
vstojilj
2025-11-27 17:40:11 +01:00
committed by GitHub
parent 1c09c87cc7
commit 259010f2d5
6 changed files with 108 additions and 9 deletions
@@ -213,6 +213,39 @@ TEST_CASE("Unit_hipModuleLaunchCooperativeKernel_Negative_Parameters") {
#endif
}
/**
* Test Description
* ------------------------
* - Test `hipModuleLaunchCooperativeKernel` when it is captured.
* Test source
* ------------------------
* - unit/module/hipModuleLaunchCooperativeKernel.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.5
*/
TEST_CASE("Unit_hipModuleLaunchCooperativeKernel_Verify_Capture") {
if (!DeviceAttributesSupport(0, hipDeviceAttributeCooperativeLaunch)) {
HipTest::HIP_SKIP_TEST("CooperativeLaunch not supported");
return;
}
auto mg = ModuleGuard::InitModule("launch_kernel_module.code");
hipStream_t stream;
HIP_CHECK(hipStreamCreate(&stream));
GENERATE_CAPTURE();
BEGIN_CAPTURE(stream);
hipFunction_t f = GetKernel(mg.module(), "CoopKernel");
HIP_CHECK(hipModuleLaunchCooperativeKernel(f, 2, 2, 1, 1, 1, 1, 0, stream, nullptr));
END_CAPTURE(stream);
HIP_CHECK(hipDeviceSynchronize());
HIP_CHECK(hipStreamDestroy(stream));
}
/**
* End doxygen group ModuleTest.
* @}
@@ -318,3 +318,21 @@ TEST_CASE("Unit_hipModuleLaunchKernel_Fntl") {
REQUIRE(testStatus == true);
}
}
TEST_CASE("Unit_hipModuleLaunchKernel_Verify_Capture") {
hipStream_t stream;
HIP_CHECK(hipStreamCreate(&stream));
auto mg = ModuleGuard::InitModule("launch_kernel_module.code");
GENERATE_CAPTURE();
BEGIN_CAPTURE(stream);
hipFunction_t f = GetKernel(mg.module(), "NOPKernel");
HIP_CHECK(hipModuleLaunchKernel(f, 1, 1, 1, 1, 1, 1, 0, stream, nullptr, nullptr));
END_CAPTURE(stream);
HIP_CHECK(hipDeviceSynchronize());
HIP_CHECK(hipStreamDestroy(stream));
}