From 3b525ad2987b7e88f074597a8eebd899bb1b28fb Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Wed, 13 Apr 2022 13:00:38 +0000 Subject: [PATCH] SWDEV-332371 - Address seg fault with hip event tests on Windows Change-Id: I0367f6dbb395b3032c97692c5bde6e99d503c6a9 --- hipamd/src/hip_event.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hipamd/src/hip_event.cpp b/hipamd/src/hip_event.cpp index f879c348ab..54a103de5f 100644 --- a/hipamd/src/hip_event.cpp +++ b/hipamd/src/hip_event.cpp @@ -251,9 +251,6 @@ hipError_t Event::addMarker(hipStream_t stream, amd::Command* command, bool reco } // namespace hip // ================================================================================================ hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) { - if (event == nullptr) { - return hipErrorInvalidValue; - } #if !defined(_MSC_VER) unsigned supportedFlags = hipEventDefault | hipEventBlockingSync | hipEventDisableTiming | hipEventReleaseToDevice | hipEventReleaseToSystem | hipEventInterprocess; @@ -288,11 +285,21 @@ hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) { hipError_t hipEventCreateWithFlags(hipEvent_t* event, unsigned flags) { HIP_INIT_API(hipEventCreateWithFlags, event, flags); + + if (event == nullptr) { + return hipErrorInvalidValue; + } + HIP_RETURN(ihipEventCreateWithFlags(event, flags), *event); } hipError_t hipEventCreate(hipEvent_t* event) { HIP_INIT_API(hipEventCreate, event); + + if (event == nullptr) { + return hipErrorInvalidValue; + } + HIP_RETURN(ihipEventCreateWithFlags(event, 0), *event); }