SWDEV-491252 - Add stream capture testcases to host allocation APIs (#590)

* SWDEV-491252 - Add stream capture testcases to host allocation APIs

* SWDEV-491252 - Add stream capture behavior testcase for hipFreeHost

* SWDEV-491252 - Refactor capture testcases

* SWDEV-491252 - Run clang-format

---------

Co-authored-by: Marko Arandjelovic <Marko.Arandjelovic@amd.com>
This commit is contained in:
systems-assistant[bot]
2025-09-02 16:58:02 +02:00
committed by GitHub
parent 0468340d03
commit bfbb005c42
10 changed files with 165 additions and 1 deletions
@@ -99,4 +99,26 @@ TEST_CASE("Unit_hipHostGetDevicePointer_UseCase") {
}
HIP_CHECK(hipHostFree(hPtr));
}
}
TEST_CASE("Unit_hipHostGetDevicePointer_Capture") {
if (!DeviceAttributesSupport(0, hipDeviceAttributeCanMapHostMemory)) {
HipTest::HIP_SKIP_TEST("Device does not support mapping host memory");
return;
}
int* host_ptr = nullptr;
int* device_ptr = nullptr;
HIP_CHECK(hipHostMalloc(&host_ptr, sizeof(int)));
hipStream_t stream = nullptr;
HIP_CHECK(hipStreamCreate(&stream));
GENERATE_CAPTURE();
BEGIN_CAPTURE(stream);
HIP_CHECK(hipHostGetDevicePointer(reinterpret_cast<void**>(&device_ptr), host_ptr, 0));
END_CAPTURE(stream);
HIP_CHECK(hipStreamDestroy(stream));
HIP_CHECK(hipHostFree(host_ptr));
}