From d4e36d090070cb8820ba8183abd4863d6d07bd8a Mon Sep 17 00:00:00 2001 From: "Godavarthy Surya, Anusha" Date: Thu, 24 Apr 2025 13:57:09 +0530 Subject: [PATCH] SWDEV-469423 - hipStreamEndCapture graph* can be nullptr (#170) [ROCm/clr commit: e5ce544c4557518693558b298de24e9cb2d49167] --- projects/clr/hipamd/src/hip_graph.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/projects/clr/hipamd/src/hip_graph.cpp b/projects/clr/hipamd/src/hip_graph.cpp index bd286271a5..80196cd917 100644 --- a/projects/clr/hipamd/src/hip_graph.cpp +++ b/projects/clr/hipamd/src/hip_graph.cpp @@ -1245,19 +1245,23 @@ hipError_t hipStreamEndCapture_common(hipStream_t stream, hip::Graph** pGraph) { hipError_t hipStreamEndCapture(hipStream_t stream, hipGraph_t* pGraph) { HIP_INIT_API(hipStreamEndCapture, stream, pGraph); - if (pGraph == nullptr) { - HIP_RETURN(hipErrorInvalidValue); - } hip::Graph* graph; hipError_t status = hipStreamEndCapture_common(stream, &graph); - *pGraph = reinterpret_cast(graph); + if (pGraph != nullptr) { + *pGraph = reinterpret_cast(graph); + } HIP_RETURN(status); } hipError_t hipStreamEndCapture_spt(hipStream_t stream, hipGraph_t* pGraph) { HIP_INIT_API(hipStreamEndCapture, stream, pGraph); PER_THREAD_DEFAULT_STREAM(stream); - HIP_RETURN_DURATION(hipStreamEndCapture_common(stream, reinterpret_cast(pGraph))); + hip::Graph* graph; + hipError_t status = hipStreamEndCapture_common(stream, &graph); + if (pGraph != nullptr) { + *pGraph = reinterpret_cast(graph); + } + HIP_RETURN(status); } hipError_t hipGraphCreate(hipGraph_t* pGraph, unsigned int flags) {