feature: Experimental support of immediate cmd list in-order execution [4/n]

Related-To: LOCI-4332

- Simplify CmdList-Event dependency
- Add waiting on in-order dependency
- Prepare Event for in-order synchronization
- Adjust downloading sync allocation in TBX mode

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2023-05-05 09:14:00 +00:00
committed by Compute-Runtime-Automation
parent ad2acc2b99
commit 23c08f4bca
14 changed files with 200 additions and 115 deletions

View File

@@ -335,10 +335,6 @@ ze_result_t EventPool::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t &
}
ze_result_t Event::destroy() {
if (latestUsedInOrderCmdList) {
latestUsedInOrderCmdList->unsetLastInOrderOutEvent(this->toHandle());
}
delete this;
return ZE_RESULT_SUCCESS;
}
@@ -391,12 +387,13 @@ void Event::resetPackets(bool resetAllPackets) {
void Event::setIsCompleted() {
if (this->isCompleted.load() == STATE_CLEARED) {
this->isCompleted = STATE_SIGNALED;
if (latestUsedInOrderCmdList) {
latestUsedInOrderCmdList->unsetLastInOrderOutEvent(this->toHandle());
latestUsedInOrderCmdList = nullptr;
}
}
}
void Event::enableInOrderExecMode(NEO::GraphicsAllocation &inOrderDependenciesAllocation, uint32_t signalValue) {
inOrderExecEvent = true;
inOrderExecSignalValue = signalValue;
inOrderExecDataAllocation = &inOrderDependenciesAllocation;
}
} // namespace L0

View File

@@ -39,7 +39,6 @@ struct DriverHandle;
struct DriverHandleImp;
struct Device;
struct Kernel;
struct CommandListImp;
#pragma pack(1)
struct IpcEventPoolData {
@@ -204,10 +203,9 @@ struct Event : _ze_event_handle_t {
void setMetricStreamer(MetricStreamer *metricStreamer) {
this->metricStreamer = metricStreamer;
}
void setLatestUsedInOrderCmdList(CommandListImp *newCmdList) {
latestUsedInOrderCmdList = newCmdList;
}
void enableInOrderExecMode(NEO::GraphicsAllocation &inOrderDependenciesAllocation, uint32_t signalValue);
bool isInOrderExecEvent() const { return inOrderExecEvent; }
uint32_t getInOrderExecSignalValue() const { return inOrderExecSignalValue; }
protected:
Event(EventPool *eventPool, int index, Device *device) : device(device), eventPool(eventPool), index(index) {}
@@ -239,12 +237,13 @@ struct Event : _ze_event_handle_t {
Device *device = nullptr;
EventPool *eventPool = nullptr;
Kernel *kernelWithPrintf = nullptr;
CommandListImp *latestUsedInOrderCmdList = nullptr;
NEO::GraphicsAllocation *inOrderExecDataAllocation = nullptr;
uint32_t maxKernelCount = 0;
uint32_t kernelCount = 1u;
uint32_t maxPacketCount = 0;
uint32_t totalEventSize = 0;
uint32_t inOrderExecSignalValue = 0;
ze_event_scope_flags_t signalScope = 0u;
ze_event_scope_flags_t waitScope = 0u;
@@ -257,6 +256,7 @@ struct Event : _ze_event_handle_t {
bool usingContextEndOffset = false;
bool signalAllEventPackets = false;
bool isFromIpcPool = false;
bool inOrderExecEvent = false;
};
struct EventPool : _ze_event_pool_handle_t {

View File

@@ -186,6 +186,9 @@ ze_result_t EventImp<TagSizeT>::queryStatus() {
if (this->downloadAllocationRequired) {
for (auto &csr : csrs) {
csr->downloadAllocation(this->getAllocation(this->device));
if (inOrderExecEvent) {
csr->downloadAllocation(*this->inOrderExecDataAllocation);
}
}
}
@@ -352,9 +355,10 @@ ze_result_t EventImp<TagSizeT>::hostSynchronize(uint64_t timeout) {
template <typename TagSizeT>
ze_result_t EventImp<TagSizeT>::reset() {
if (latestUsedInOrderCmdList) {
latestUsedInOrderCmdList->unsetLastInOrderOutEvent(this->toHandle());
latestUsedInOrderCmdList = nullptr;
if (inOrderExecEvent) {
inOrderExecDataAllocation = nullptr;
inOrderExecSignalValue = 0;
inOrderExecEvent = false;
}
this->resetCompletionStatus();
this->resetDeviceCompletionData(false);