SWDEV-366636 - Fix performance drop in TF-RCCL models
Change-Id: Ie04219daacc29654d0f47e1c15ed5cd78d88d8c8
[ROCm/clr commit: a2785c68b2]
Tá an tiomantas seo le fáil i:
tiomanta ag
Anusha Godavarthy Surya
tuismitheoir
ec60a2ad11
tiomantas
18edb0d97c
@@ -30,21 +30,21 @@ namespace hip {
|
||||
static amd::Monitor eventSetLock{"Guards global event set"};
|
||||
static std::unordered_set<hipEvent_t> eventSet;
|
||||
|
||||
bool Event::ready() {
|
||||
bool Event::ready(eventType type) {
|
||||
if (event_->status() != CL_COMPLETE) {
|
||||
event_->notifyCmdQueue();
|
||||
}
|
||||
// Check HW status of the ROCcrl event. Note: not all ROCclr modes support HW status
|
||||
bool ready = g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_);
|
||||
bool ready = CheckHwEvent(type);
|
||||
if (!ready) {
|
||||
ready = (event_->status() == CL_COMPLETE);
|
||||
}
|
||||
return ready;
|
||||
}
|
||||
|
||||
bool EventDD::ready() {
|
||||
bool EventDD::ready(eventType type) {
|
||||
// Check HW status of the ROCcrl event. Note: not all ROCclr modes support HW status
|
||||
bool ready = g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_);
|
||||
bool ready = CheckHwEvent(type);
|
||||
// FIXME: Remove status check entirely
|
||||
if (!ready) {
|
||||
ready = (event_->status() == CL_COMPLETE);
|
||||
@@ -60,7 +60,7 @@ hipError_t Event::query() {
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
return ready() ? hipSuccess : hipErrorNotReady;
|
||||
return ready(Query) ? hipSuccess : hipErrorNotReady;
|
||||
}
|
||||
|
||||
hipError_t Event::synchronize() {
|
||||
@@ -108,7 +108,7 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
|
||||
return hipErrorInvalidHandle;
|
||||
}
|
||||
|
||||
if (!ready()) {
|
||||
if (!ready(ElapsedTime)) {
|
||||
return hipErrorNotReady;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
|
||||
return hipErrorInvalidHandle;
|
||||
}
|
||||
|
||||
if (!ready() || !eStop.ready()) {
|
||||
if (!ready(ElapsedTime) || !eStop.ready(ElapsedTime)) {
|
||||
return hipErrorNotReady;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ hipError_t Event::streamWait(hipStream_t stream, uint flags) {
|
||||
hip::Stream* hip_stream = hip::getStream(stream);
|
||||
// Access to event_ object must be lock protected
|
||||
amd::ScopedLock lock(lock_);
|
||||
if ((event_ == nullptr) || (event_->command().queue() == hip_stream) || ready()) {
|
||||
if ((event_ == nullptr) || (event_->command().queue() == hip_stream) || ready(StreamWait)) {
|
||||
return hipSuccess;
|
||||
}
|
||||
if (!event_->notifyCmdQueue()) {
|
||||
|
||||
@@ -89,6 +89,7 @@ class EventMarker : public amd::Marker {
|
||||
}
|
||||
};
|
||||
|
||||
enum eventType { Query, StreamWait, ElapsedTime };
|
||||
class Event {
|
||||
/// event recorded on stream where capture is active
|
||||
bool onCapture_;
|
||||
@@ -96,6 +97,16 @@ class Event {
|
||||
hipStream_t captureStream_ = nullptr;
|
||||
/// Previous captured nodes before event record
|
||||
std::vector<hipGraphNode_t> nodesPrevToRecorded_;
|
||||
protected:
|
||||
bool CheckHwEvent(eventType type) {
|
||||
bool ready;
|
||||
if (type == Query) {
|
||||
ready = g_devices[deviceId()]->devices()[0]->IsHwEventReadyForcedWait(*event_);
|
||||
} else {
|
||||
ready = g_devices[deviceId()]->devices()[0]->IsHwEventReady(*event_);
|
||||
}
|
||||
return ready;
|
||||
}
|
||||
|
||||
public:
|
||||
Event(unsigned int flags) : flags(flags), lock_("hipEvent_t", true),
|
||||
@@ -170,7 +181,7 @@ class Event {
|
||||
return hipErrorInvalidConfiguration;
|
||||
}
|
||||
virtual bool awaitEventCompletion();
|
||||
virtual bool ready();
|
||||
virtual bool ready(eventType type);
|
||||
virtual int64_t time(bool getStartTs) const;
|
||||
|
||||
protected:
|
||||
@@ -190,7 +201,7 @@ class EventDD : public Event {
|
||||
virtual ~EventDD() {}
|
||||
|
||||
virtual bool awaitEventCompletion();
|
||||
virtual bool ready();
|
||||
virtual bool ready(eventType type);
|
||||
virtual int64_t time(bool getStartTs) const;
|
||||
};
|
||||
|
||||
|
||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir