SWDEV-502365 - Track last used command

- This change tries to save extra synchronization packets we may insert
  as we didnt track the completion signals for every command. We track
the current enqueued command until it exits the enqueue stage. We also
record the exit scope to know if we flushed the caches
- Handle correct release scopes and store completion signal as HW events
- Use a new finishCommand implementation to only wait for the command
  passed as the argument

Change-Id: Ie4350c5dd24f5d48dfa6ccbabd892f0544caadcc


[ROCm/clr commit: e03e4f3b5d]
This commit is contained in:
Saleel Kudchadker
2024-12-03 23:45:31 +00:00
parent 77840f1cb9
commit c8f39ec2b0
12 changed files with 148 additions and 92 deletions
+12 -5
View File
@@ -88,10 +88,13 @@ class Event : public RuntimeObject {
std::atomic<CallBackEntry*> callbacks_; //!< linked list of callback entries.
std::atomic<int32_t> status_; //!< current execution status.
std::atomic_flag notified_; //!< Command queue was notified
void* hw_event_; //!< HW event ID associated with SW event
Event* notify_event_; //!< Notify event, which should contain HW signal
const Device* device_; //!< Device, this event associated with
int32_t event_scope_; //!< 2 - system scope, 1 - device scope,
std::atomic<int32_t> event_entry_scope_; //!< Command entry scope
//!< 2 - system scope, 1 - device scope,
//!< 0 - ignore, -1 - invalid
protected:
@@ -219,11 +222,15 @@ class Event : public RuntimeObject {
//! Returns notify even associated with the current command
Event* NotifyEvent() const { return notify_event_; }
//! Get release scope of the event
int32_t getEventScope() const { return event_scope_; }
//! Get entry scope of the event
int32_t getCommandEntryScope() const {
return event_entry_scope_.load(std::memory_order_relaxed);
}
//! Set release scope for the event
void setEventScope(int32_t scope) { event_scope_ = scope; }
//! Set entry scope for the event
void setCommandEntryScope(int32_t scope) {
event_entry_scope_.store(scope, std::memory_order_relaxed);
}
};
union CopyMetadata {