From 21d7f35c8420a9b42b1be78dfc4ffd8a56e72bbe Mon Sep 17 00:00:00 2001 From: Rakesh Roy Date: Mon, 20 Jun 2022 21:33:24 +0530 Subject: [PATCH] SWDEV-342025 - Fix hipEventCreateWithFlags API - Return hipErrorInvalidValue if hipEventInterprocess flag is set, but hipEventDisableTiming flag isn't set Change-Id: Ifbb9d83b018c360f312083bb25dba1187bcdaefa --- hipamd/src/hip_event.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hipamd/src/hip_event.cpp b/hipamd/src/hip_event.cpp index b157e88350..3fff536439 100644 --- a/hipamd/src/hip_event.cpp +++ b/hipamd/src/hip_event.cpp @@ -261,7 +261,10 @@ hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) { const unsigned releaseFlags = (hipEventReleaseToDevice | hipEventReleaseToSystem); // can't set any unsupported flags. // can't set both release flags - const bool illegalFlags = (flags & ~supportedFlags) || (flags & releaseFlags) == releaseFlags; + // if hipEventInterprocess flag is set, then hipEventDisableTiming flag also must be set + const bool illegalFlags = (flags & ~supportedFlags) || + ((flags & releaseFlags) == releaseFlags) || + ((flags & hipEventInterprocess) && !(flags & hipEventDisableTiming)); if (!illegalFlags) { hip::Event* e = nullptr; if (flags & hipEventInterprocess) {