2019-01-25 17:20:32 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "runtime/helpers/csr_deps.h"
|
|
|
|
|
2019-01-25 17:20:32 +08:00
|
|
|
#include "runtime/command_queue/command_queue.h"
|
|
|
|
#include "runtime/event/event.h"
|
|
|
|
#include "runtime/helpers/properties_helper.h"
|
|
|
|
#include "runtime/helpers/timestamp_packet.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2019-09-04 17:34:23 +08:00
|
|
|
void CsrDependencies::fillFromEventsRequest(const EventsRequest &eventsRequest, CommandStreamReceiver ¤tCsr,
|
|
|
|
DependenciesType depsType) {
|
2019-01-25 17:20:32 +08:00
|
|
|
for (cl_uint i = 0; i < eventsRequest.numEventsInWaitList; i++) {
|
|
|
|
auto event = castToObjectOrAbort<Event>(eventsRequest.eventWaitList[i]);
|
|
|
|
if (event->isUserEvent()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto timestampPacketContainer = event->getTimestampPacketNodes();
|
|
|
|
if (!timestampPacketContainer || timestampPacketContainer->peekNodes().empty()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2019-07-15 20:28:09 +08:00
|
|
|
auto sameCsr = (&event->getCommandQueue()->getGpgpuCommandStreamReceiver() == ¤tCsr);
|
2019-06-12 17:07:37 +08:00
|
|
|
bool pushDependency = (DependenciesType::OnCsr == depsType && sameCsr) ||
|
|
|
|
(DependenciesType::OutOfCsr == depsType && !sameCsr) ||
|
|
|
|
(DependenciesType::All == depsType);
|
2019-01-25 17:20:32 +08:00
|
|
|
|
2019-06-12 17:07:37 +08:00
|
|
|
if (pushDependency) {
|
2019-01-25 17:20:32 +08:00
|
|
|
this->push_back(timestampPacketContainer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-04 17:34:23 +08:00
|
|
|
|
|
|
|
void CsrDependencies::makeResident(CommandStreamReceiver &commandStreamReceiver) const {
|
|
|
|
for (auto ×tampPacketContainer : *this) {
|
|
|
|
timestampPacketContainer->makeResident(commandStreamReceiver);
|
|
|
|
}
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|