SWDEV-439581 - hip event flags clean up

Change-Id: I2197762d912da41a8b53b32b3446f0a958c988a6


[ROCm/clr commit: 6ec5074d74]
This commit is contained in:
Ajay
2024-05-17 12:08:20 -07:00
committed by Maneesh Gupta
parent 42209c5a9b
commit 5b731168ca
6 changed files with 19 additions and 15 deletions
+7 -7
View File
@@ -74,12 +74,12 @@ hipError_t Event::synchronize() {
auto hip_device = g_devices[deviceId()];
// Check HW status of the ROCcrl event. Note: not all ROCclr modes support HW status
static constexpr bool kWaitCompletion = true;
if (!hip_device->devices()[0]->IsHwEventReady(*event_, kWaitCompletion, flags)) {
if (!hip_device->devices()[0]->IsHwEventReady(*event_, kWaitCompletion, flags_)) {
if (event_->HwEvent() != nullptr) {
amd::Command* command = nullptr;
hipError_t status = recordCommand(command, event_->command().queue(), flags);
hipError_t status = recordCommand(command, event_->command().queue(), flags_);
command->enqueue();
hip_device->devices()[0]->IsHwEventReady(command->event(), kWaitCompletion, flags);
hip_device->devices()[0]->IsHwEventReady(command->event(), kWaitCompletion, flags_);
command->release();
} else {
event_->awaitCompletion();
@@ -93,7 +93,7 @@ bool Event::awaitEventCompletion() {
}
bool EventDD::awaitEventCompletion() {
return g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_, true, flags);
return g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_, true, flags_);
}
hipError_t Event::elapsedTime(Event& eStop, float& ms) {
@@ -104,7 +104,7 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
return hipErrorInvalidHandle;
}
if (flags & hipEventDisableTiming) {
if (flags_ & hipEventDisableTiming) {
return hipErrorInvalidHandle;
}
@@ -120,7 +120,7 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
return hipErrorInvalidHandle;
}
if ((flags | eStop.flags) & hipEventDisableTiming) {
if ((flags_ | eStop.flags_) & hipEventDisableTiming) {
return hipErrorInvalidHandle;
}
@@ -224,7 +224,7 @@ hipError_t Event::streamWait(hipStream_t stream, uint flags) {
hipError_t Event::recordCommand(amd::Command*& command, amd::HostQueue* stream,
uint32_t ext_flags ) {
if (command == nullptr) {
int32_t releaseFlags = ((ext_flags == 0) ? flags : ext_flags) &
int32_t releaseFlags = ((ext_flags == 0) ? flags_ : ext_flags) &
(hipEventReleaseToDevice | hipEventReleaseToSystem |
hipEventDisableSystemFence);
if (releaseFlags & hipEventDisableSystemFence) {
+3 -3
View File
@@ -102,13 +102,13 @@ class Event {
if (type == Query) {
ready = g_devices[deviceId()]->devices()[0]->IsHwEventReadyForcedWait(*event_);
} else {
ready = g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_, flags);
ready = g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_, false, flags_);
}
return ready;
}
public:
Event(unsigned int flags) : flags(flags), lock_("hipEvent_t", true),
Event(uint32_t flags) : flags_(flags), lock_("hipEvent_t", true),
event_(nullptr), unrecorded_(false), stream_(nullptr) {
// No need to init event_ here as addMarker does that
device_id_ = hip::getCurrentDevice()->deviceId(); // Created in current device ctx
@@ -119,7 +119,7 @@ class Event {
event_->release();
}
}
unsigned int flags;
uint32_t flags_; //!< flags associated with the event
virtual hipError_t query();
virtual hipError_t synchronize();
+1 -1
View File
@@ -405,7 +405,7 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
if (stopEvent != nullptr) {
hip::Event* eStop = reinterpret_cast<hip::Event*>(stopEvent);
if (eStop->flags & hipEventDisableSystemFence) {
if (eStop->flags_ & hipEventDisableSystemFence) {
command->setEventScope(amd::Device::kCacheStateIgnore);
} else {
command->setEventScope(amd::Device::kCacheStateSystem);
+2 -1
View File
@@ -1930,7 +1930,8 @@ class Device : public RuntimeObject {
virtual bool IsHwEventReady(
const amd::Event& event, //!< AMD event for HW status validation
bool wait = false, //!< If true then forces the event completion
int hip_event_flags = 0) const {
uint32_t hip_event_flags = 0 //!< flags associated with the event. 0 = hipEventDefault
) const {
return false;
};
@@ -2924,13 +2924,16 @@ bool Device::IsHwEventReadyForcedWait(const amd::Event& event) const {
}
// ================================================================================================
bool Device::IsHwEventReady(const amd::Event& event, bool wait, int hip_event_flags) const {
bool Device::IsHwEventReady(const amd::Event& event, bool wait, uint32_t hip_event_flags) const {
void* hw_event =
(event.NotifyEvent() != nullptr) ? event.NotifyEvent()->HwEvent() : event.HwEvent();
if (hw_event == nullptr) {
ClPrint(amd::LOG_INFO, amd::LOG_SIG, "No HW event");
return false;
} else if (wait) {
// hipEventBlockingSync
// when set the CPU gives up host thread for other work
// when not set the CPU enters a busy-wait on the event to occur
constexpr int kHipEventBlockingSync = 0x1;
bool active_wait = !(hip_event_flags & kHipEventBlockingSync) && ActiveWait();
return WaitForSignal(reinterpret_cast<ProfilingSignal*>(hw_event)->signal_, active_wait);
@@ -288,7 +288,7 @@ class NullDevice : public amd::Device {
}
bool IsHwEventReady(const amd::Event& event, bool wait = false,
int hip_event_flags = 0) const override {
uint32_t hip_event_flags = 0) const override {
return false;
}
@@ -488,7 +488,7 @@ class Device : public NullDevice {
cl_set_device_clock_mode_output_amd* pSetClockModeOutput);
virtual bool IsHwEventReady(const amd::Event& event, bool wait = false,
int hip_event_flags = 0) const;
uint32_t hip_event_flags = 0) const;
virtual bool IsHwEventReadyForcedWait(const amd::Event& event) const;
virtual void getHwEventTime(const amd::Event& event, uint64_t* start, uint64_t* end) const;
virtual void ReleaseGlobalSignal(void* signal) const;