SWDEV-292018 - Switch to internal signals for markers
Add ref counting to ProfilingSignal class to track the last release. If a signal was used in the marker, then don't reuse it, but create a new one for internal usage. Don't rely on HSA callback for the command status update if there are no pending dispatches. Change-Id: I19f14ed9d80acfe79993b343b2187635f8428a20
This commit is contained in:
committed by
Maneesh Gupta
orang tua
6408b9b906
melakukan
ff15c0893e
@@ -232,11 +232,12 @@ void Event::processCallbacks(int32_t status) const {
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr bool kCpuWait = true;
|
||||
// ================================================================================================
|
||||
bool Event::awaitCompletion() {
|
||||
if (status() > CL_COMPLETE) {
|
||||
// Notifies current command queue about waiting
|
||||
if (!notifyCmdQueue()) {
|
||||
// Notifies the current command queue about waiting
|
||||
if (!notifyCmdQueue(kCpuWait)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -262,7 +263,7 @@ bool Event::awaitCompletion() {
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
bool Event::notifyCmdQueue() {
|
||||
bool Event::notifyCmdQueue(bool cpu_wait) {
|
||||
HostQueue* queue = command().queue();
|
||||
if (AMD_DIRECT_DISPATCH) {
|
||||
ScopedLock l(notify_lock_);
|
||||
@@ -271,7 +272,7 @@ bool Event::notifyCmdQueue() {
|
||||
(HwEvent() == nullptr) &&
|
||||
!notified_.test_and_set()) {
|
||||
// Make sure the queue is draining the enqueued commands.
|
||||
amd::Command* command = new amd::Marker(*queue, false, nullWaitList, this);
|
||||
amd::Command* command = new amd::Marker(*queue, false, nullWaitList, this, cpu_wait);
|
||||
if (command == NULL) {
|
||||
notified_.clear();
|
||||
return false;
|
||||
@@ -341,7 +342,7 @@ void Command::enqueue() {
|
||||
// Notify all commands about the waiter. Barrier will be sent in order to obtain
|
||||
// HSA signal for a wait on the current queue
|
||||
std::for_each(eventWaitList().begin(), eventWaitList().end(),
|
||||
std::mem_fun(&Command::notifyCmdQueue));
|
||||
std::bind2nd(std::mem_fun(&Command::notifyCmdQueue), !kCpuWait));
|
||||
|
||||
// The batch update must be lock protected to avoid a race condition
|
||||
// when multiple threads submit/flush/update the batch at the same time
|
||||
|
||||
Reference in New Issue
Block a user