From c07468e53c7cced343fca30cc8ff6adf1e62893a Mon Sep 17 00:00:00 2001 From: "Li, Todd tiantuo" Date: Wed, 12 Feb 2025 05:48:14 -0800 Subject: [PATCH] SWDEV-510271 - [6.4 Preview] fix hipCreateSurfaceObject & hipDestroySurfaceObject during stream capture Change-Id: I19e149549c271d847f52b72e04cb2427ca194b24 --- hipamd/src/hip_surface.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hipamd/src/hip_surface.cpp b/hipamd/src/hip_surface.cpp index cd40e254ef..6b62e025c7 100644 --- a/hipamd/src/hip_surface.cpp +++ b/hipamd/src/hip_surface.cpp @@ -66,6 +66,12 @@ hipError_t ihipCreateSurfaceObject(hipSurfaceObject_t* pSurfObject, return hipErrorInvalidValue; } + if (DEBUG_HIP_7_PREVIEW & amd::CHANGE_HIP_STREAM_CAPTURE_API) { + 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 +102,12 @@ hipError_t ihipDestroySurfaceObject(hipSurfaceObject_t surfaceObject) { return hipSuccess; } + if (DEBUG_HIP_7_PREVIEW & amd::CHANGE_HIP_STREAM_CAPTURE_API) { + if (!hip::tls.capture_streams_.empty() || !g_captureStreams.empty()) { + HIP_RETURN(hipErrorStreamCaptureUnsupported); + } + } + return ihipFree(surfaceObject); }