Fix dependency resolve in level zero black box tests

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-02-20 12:51:01 +00:00
committed by Compute-Runtime-Automation
parent ac5d719e25
commit b4544f6f78
10 changed files with 105 additions and 31 deletions

View File

@@ -97,8 +97,9 @@ ze_result_t EventPool::initialize(DriverHandle *driver, Context *context, uint32
this->isHostVisibleEventPoolAllocation = !(isEventPoolDeviceAllocationFlagSet());
auto neoDevice = devices[0]->getNEODevice();
if (this->isDeviceEventPoolAllocation) {
NEO::AllocationProperties allocationProperties{*rootDeviceIndices.begin(), this->eventPoolSize, allocationType, devices[0]->getNEODevice()->getDeviceBitfield()};
NEO::AllocationProperties allocationProperties{*rootDeviceIndices.begin(), this->eventPoolSize, allocationType, neoDevice->getDeviceBitfield()};
allocationProperties.alignment = eventAlignment;
auto memoryManager = driver->getMemoryManager();
@@ -111,7 +112,6 @@ ze_result_t EventPool::initialize(DriverHandle *driver, Context *context, uint32
this->isShareableEventMemory = (graphicsAllocation->peekInternalHandle(memoryManager, handle) == 0);
}
}
} else {
NEO::AllocationProperties allocationProperties{*rootDeviceIndices.begin(), this->eventPoolSize, allocationType, systemMemoryBitfield};
allocationProperties.alignment = eventAlignment;
@@ -119,17 +119,18 @@ ze_result_t EventPool::initialize(DriverHandle *driver, Context *context, uint32
eventPoolPtr = driver->getMemoryManager()->createMultiGraphicsAllocationInSystemMemoryPool(rootDeviceIndices,
allocationProperties,
*eventPoolAllocations);
if (eventPoolFlags & ZE_EVENT_POOL_FLAG_IPC) {
this->isShareableEventMemory = eventPoolAllocations->getDefaultGraphicsAllocation()->isShareableHostMemory;
}
allocatedMemory = (nullptr != eventPoolPtr);
}
if (!allocatedMemory) {
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
}
if (neoDevice->getDefaultEngine().commandStreamReceiver->isTbxMode()) {
eventPoolAllocations->getDefaultGraphicsAllocation()->setWriteMemoryOnly(true);
}
return ZE_RESULT_SUCCESS;
}
@@ -289,6 +290,10 @@ ze_result_t EventPool::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t &
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
}
if (neoDevice->getDefaultEngine().commandStreamReceiver->isTbxMode()) {
alloc->setWriteMemoryOnly(true);
}
eventPool->context = context;
eventPool->eventPoolAllocations =
std::make_unique<NEO::MultiGraphicsAllocation>(static_cast<uint32_t>(context->rootDeviceIndices.size()));

View File

@@ -240,16 +240,6 @@ template <typename TagSizeT>
ze_result_t EventImp<TagSizeT>::hostEventSetValue(TagSizeT eventVal) {
UNRECOVERABLE_IF(hostAddress == nullptr);
if (this->downloadAllocationRequired) {
auto eventAllocation = &this->getAllocation(device);
auto memoryIface = this->device->getNEODevice()->getRootDeviceEnvironment().memoryOperationsInterface.get();
if (NEO::MemoryOperationsStatus::SUCCESS != memoryIface->isResident(nullptr, *eventAllocation)) {
ArrayRef<NEO::GraphicsAllocation *> allocationArray(&eventAllocation, 1);
memoryIface->makeResident(nullptr, allocationArray);
}
}
if (isEventTimestampFlagSet()) {
return hostEventSetValueTimestamps(eventVal);
}
@@ -271,6 +261,16 @@ ze_result_t EventImp<TagSizeT>::hostEventSetValue(TagSizeT eventVal) {
setRemainingPackets(eventVal, packetHostAddr, packets);
}
if (this->downloadAllocationRequired) {
auto memoryIface = this->device->getNEODevice()->getRootDeviceEnvironment().memoryOperationsInterface.get();
auto eventAllocation = &this->getAllocation(device);
ArrayRef<NEO::GraphicsAllocation *> allocationArray(&eventAllocation, 1);
memoryIface->makeResident(nullptr, allocationArray);
constexpr uint32_t allBanks = std::numeric_limits<uint32_t>::max();
eventAllocation->setTbxWritable(true, allBanks);
}
return ZE_RESULT_SUCCESS;
}