Skip to content

Commit 1521513

Browse files
SWDEV-508982 - [6.4 Preview] - Handle hipMemPoolCreate, hipMemPoolDestory & hipDeviceSetMemPool during stream capture. (#131)
1 parent 4944fc9 commit 1521513

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

hipamd/src/hip_mempool.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ hipError_t hipDeviceSetMemPool(int device, hipMemPool_t mem_pool) {
5959
if ((mem_pool == nullptr) || (device >= g_devices.size())) {
6060
HIP_RETURN(hipErrorInvalidValue);
6161
}
62-
62+
if (!hip::tls.capture_streams_.empty() || !g_captureStreams.empty()) {
63+
HIP_RETURN(hipErrorStreamCaptureUnsupported);
64+
}
6365
auto poolDevice = reinterpret_cast<hip::MemoryPool*>(mem_pool)->Device();
6466
if (poolDevice->deviceId() != device) {
6567
HIP_RETURN(hipErrorInvalidDevice);
@@ -328,7 +330,9 @@ hipError_t hipMemPoolCreate(hipMemPool_t* mem_pool, const hipMemPoolProps* pool_
328330
if (IS_WINDOWS && pool_props->handleTypes == hipMemHandleTypePosixFileDescriptor) {
329331
HIP_RETURN(hipErrorInvalidValue);
330332
}
331-
333+
if (!hip::tls.capture_streams_.empty() || !g_captureStreams.empty()) {
334+
HIP_RETURN(hipErrorStreamCaptureUnsupported);
335+
}
332336
auto device = g_devices[pool_props->location.id];
333337
auto pool = new hip::MemoryPool(device, pool_props);
334338
if (pool == nullptr) {
@@ -344,6 +348,9 @@ hipError_t hipMemPoolDestroy(hipMemPool_t mem_pool) {
344348
if (mem_pool == nullptr) {
345349
HIP_RETURN(hipErrorInvalidValue);
346350
}
351+
if (!hip::tls.capture_streams_.empty() || !g_captureStreams.empty()) {
352+
HIP_RETURN(hipErrorStreamCaptureUnsupported);
353+
}
347354
hip::MemoryPool* hip_mem_pool = reinterpret_cast<hip::MemoryPool*>(mem_pool);
348355

349356
if (!IsMemPoolValid(hip_mem_pool)) {

0 commit comments

Comments
 (0)