SWDEV-508982 - Handle hipMemPoolCreate, hipMemPoolDestory & hipDeviceSetMemPool during stream capture. (#398)

Этот коммит содержится в:
Patel, Jaydeepkumar
2025-05-27 02:18:21 -07:00
коммит произвёл GitHub
родитель ee2d4a0358
Коммит b751614cd8
+9 -2
Просмотреть файл
@@ -59,7 +59,9 @@ hipError_t hipDeviceSetMemPool(int device, hipMemPool_t mem_pool) {
if ((mem_pool == nullptr) || (device >= g_devices.size())) {
HIP_RETURN(hipErrorInvalidValue);
}
if (!hip::tls.capture_streams_.empty() || !g_captureStreams.empty()) {
HIP_RETURN(hipErrorStreamCaptureUnsupported);
}
auto poolDevice = reinterpret_cast<hip::MemoryPool*>(mem_pool)->Device();
if (poolDevice->deviceId() != device) {
HIP_RETURN(hipErrorInvalidDevice);
@@ -324,7 +326,9 @@ hipError_t hipMemPoolCreate(hipMemPool_t* mem_pool, const hipMemPoolProps* pool_
if (IS_WINDOWS && pool_props->handleTypes == hipMemHandleTypePosixFileDescriptor) {
HIP_RETURN(hipErrorInvalidValue);
}
if (!hip::tls.capture_streams_.empty() || !g_captureStreams.empty()) {
HIP_RETURN(hipErrorStreamCaptureUnsupported);
}
auto device = g_devices[pool_props->location.id];
auto pool = new hip::MemoryPool(device, pool_props);
if (pool == nullptr) {
@@ -340,6 +344,9 @@ hipError_t hipMemPoolDestroy(hipMemPool_t mem_pool) {
if (mem_pool == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
if (!hip::tls.capture_streams_.empty() || !g_captureStreams.empty()) {
HIP_RETURN(hipErrorStreamCaptureUnsupported);
}
hip::MemoryPool* hip_mem_pool = reinterpret_cast<hip::MemoryPool*>(mem_pool);
if (!IsMemPoolValid(hip_mem_pool)) {