From 24cdff6cce27d1fda7a7bbbece222a3b017f865e Mon Sep 17 00:00:00 2001 From: "Li, Todd tiantuo" Date: Wed, 28 May 2025 01:16:17 -0700 Subject: [PATCH] SWDEV-516511 - fix hipCreateSurfaceObject & hipDestroySurfaceObject when capturing stream (#412) --- hipamd/src/hip_surface.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hipamd/src/hip_surface.cpp b/hipamd/src/hip_surface.cpp index cd40e254ef..f01e288887 100644 --- a/hipamd/src/hip_surface.cpp +++ b/hipamd/src/hip_surface.cpp @@ -66,6 +66,10 @@ hipError_t ihipCreateSurfaceObject(hipSurfaceObject_t* pSurfObject, return hipErrorInvalidValue; } + if (!hip::tls.capture_streams_.empty() || !g_captureStreams.empty()) { + HIP_RETURN(hipErrorStreamCaptureUnsupported); + } + amd::Image* image = nullptr; cl_mem memObj = reinterpret_cast(pResDesc->res.array.array->data); if (!is_valid(memObj)) { @@ -96,6 +100,10 @@ hipError_t ihipDestroySurfaceObject(hipSurfaceObject_t surfaceObject) { return hipSuccess; } + if (!hip::tls.capture_streams_.empty() || !g_captureStreams.empty()) { + HIP_RETURN(hipErrorStreamCaptureUnsupported); + } + return ihipFree(surfaceObject); }