diff --git a/level_zero/core/source/event/event.cpp b/level_zero/core/source/event/event.cpp index 151a5721f5..56690922de 100644 --- a/level_zero/core/source/event/event.cpp +++ b/level_zero/core/source/event/event.cpp @@ -40,6 +40,8 @@ struct EventImp : public Event { ze_result_t queryStatus() override { uint64_t *hostAddr = static_cast(hostAddress); + uint32_t queryVal = Event::STATE_CLEARED; + auto alloc = &(this->eventPool->getAllocation()); if (metricTracer != nullptr) { @@ -55,7 +57,9 @@ struct EventImp : public Event { hostAddr = reinterpret_cast(timeStampAddress); } - return *hostAddr == Event::STATE_CLEARED ? ZE_RESULT_NOT_READY : ZE_RESULT_SUCCESS; + memcpy_s(static_cast(&queryVal), sizeof(uint32_t), static_cast(hostAddr), sizeof(uint32_t)); + + return queryVal == Event::STATE_CLEARED ? ZE_RESULT_NOT_READY : ZE_RESULT_SUCCESS; } ze_result_t reset() override; @@ -244,7 +248,7 @@ ze_result_t EventImp::hostEventSetValue(uint32_t eventVal) { auto hostAddr = static_cast(hostAddress); UNRECOVERABLE_IF(hostAddr == nullptr); - *(hostAddr) = eventVal; + memcpy_s(static_cast(hostAddr), sizeof(uint32_t), static_cast(&eventVal), sizeof(uint32_t)); makeAllocationResident();