mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Revert "Use device allocation for events if host visibility not set"
This reverts commit b204a4f135.
Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
76db4ce59a
commit
db892eaa95
@@ -19,8 +19,6 @@
|
||||
#include "shared/source/memory_manager/memory_operations_handler.h"
|
||||
#include "shared/source/utilities/cpuintrinsics.h"
|
||||
|
||||
#include "level_zero/core/source/cmdlist/cmdlist.h"
|
||||
#include "level_zero/core/source/cmdqueue/cmdqueue.h"
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/tools/source/metrics/metric.h"
|
||||
@@ -58,52 +56,23 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, uint32_t numDevices,
|
||||
maxRootDeviceIndex = rootDeviceIndices[0];
|
||||
}
|
||||
|
||||
if (this->devices.size() > 1) {
|
||||
this->allocOnDevice = false;
|
||||
}
|
||||
|
||||
if (allocOnDevice) {
|
||||
ze_command_queue_desc_t cmdQueueDesc = {};
|
||||
cmdQueueDesc.ordinal = 0;
|
||||
cmdQueueDesc.index = 0;
|
||||
cmdQueueDesc.flags = 0;
|
||||
cmdQueueDesc.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC;
|
||||
cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
eventPoolCommandList =
|
||||
CommandList::createImmediate(
|
||||
static_cast<DeviceImp *>(this->devices[0])->neoDevice->getHardwareInfo().platform.eProductFamily,
|
||||
this->devices[0],
|
||||
&cmdQueueDesc,
|
||||
true,
|
||||
NEO::EngineGroupType::RenderCompute,
|
||||
returnValue);
|
||||
|
||||
if (!this->eventPoolCommandList) {
|
||||
this->allocOnDevice = false;
|
||||
}
|
||||
}
|
||||
|
||||
eventPoolAllocations = new NEO::MultiGraphicsAllocation(maxRootDeviceIndex);
|
||||
|
||||
uint32_t rootDeviceIndex = rootDeviceIndices.at(0);
|
||||
auto deviceBitfield = devices[0]->getNEODevice()->getDeviceBitfield();
|
||||
auto allocationType = isEventPoolUsedForTimestamp ? NEO::GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER : NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
|
||||
if (this->allocOnDevice) {
|
||||
allocationType = NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
|
||||
}
|
||||
|
||||
NEO::AllocationProperties eventPoolAllocationProperties{rootDeviceIndex,
|
||||
true,
|
||||
alignUp<size_t>(numEvents * eventSize, MemoryConstants::pageSize64k),
|
||||
allocationType,
|
||||
deviceBitfield.count() > 1,
|
||||
false,
|
||||
deviceBitfield};
|
||||
eventPoolAllocationProperties.alignment = MemoryConstants::cacheLineSize;
|
||||
NEO::AllocationProperties unifiedMemoryProperties{rootDeviceIndex,
|
||||
true,
|
||||
alignUp<size_t>(numEvents * eventSize, MemoryConstants::pageSize64k),
|
||||
isEventPoolUsedForTimestamp ? NEO::GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER
|
||||
: NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
|
||||
deviceBitfield.count() > 1,
|
||||
deviceBitfield.count() > 1,
|
||||
deviceBitfield};
|
||||
unifiedMemoryProperties.alignment = eventAlignment;
|
||||
|
||||
void *eventPoolPtr = driver->getMemoryManager()->createMultiGraphicsAllocation(rootDeviceIndices,
|
||||
eventPoolAllocationProperties,
|
||||
unifiedMemoryProperties,
|
||||
*eventPoolAllocations);
|
||||
if (!eventPoolPtr) {
|
||||
return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY;
|
||||
@@ -119,11 +88,6 @@ EventPoolImp::~EventPoolImp() {
|
||||
}
|
||||
delete eventPoolAllocations;
|
||||
eventPoolAllocations = nullptr;
|
||||
|
||||
if (eventPoolCommandList) {
|
||||
eventPoolCommandList->destroy();
|
||||
eventPoolCommandList = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t EventPoolImp::getIpcHandle(ze_ipc_event_pool_handle_t *pIpcHandle) {
|
||||
@@ -158,10 +122,6 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
|
||||
event->timestampsData = std::make_unique<TimestampPacketStorage>();
|
||||
}
|
||||
|
||||
if (eventPool->allocOnDevice) {
|
||||
event->allocOnDevice = true;
|
||||
}
|
||||
|
||||
auto alloc = eventPool->getAllocation().getGraphicsAllocation(device->getNEODevice()->getRootDeviceIndex());
|
||||
|
||||
uint64_t baseHostAddr = reinterpret_cast<uint64_t>(alloc->getUnderlyingBuffer());
|
||||
@@ -172,10 +132,6 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
|
||||
event->csr = static_cast<DeviceImp *>(device)->neoDevice->getDefaultEngine().commandStreamReceiver;
|
||||
event->reset();
|
||||
|
||||
if (event->allocOnDevice) {
|
||||
eventPool->eventPoolCommandList->appendEventReset(event->toHandle());
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
@@ -232,10 +188,6 @@ void EventImp::assignTimestampData(void *address) {
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t Event::getGpuAddress() {
|
||||
return gpuAddress;
|
||||
}
|
||||
|
||||
ze_result_t Event::destroy() {
|
||||
delete this;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
@@ -340,10 +292,6 @@ ze_result_t EventImp::hostSynchronize(uint64_t timeout) {
|
||||
}
|
||||
|
||||
ze_result_t EventImp::reset() {
|
||||
if (allocOnDevice) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
resetPackets();
|
||||
return hostEventSetValue(Event::STATE_INITIAL);
|
||||
}
|
||||
|
||||
@@ -48,18 +48,17 @@ struct Event : _ze_event_handle_t {
|
||||
|
||||
void increasePacketsInUse() { packetsInUse++; }
|
||||
void resetPackets() { packetsInUse = 0; }
|
||||
uint64_t getGpuAddress() { return gpuAddress; }
|
||||
uint32_t getPacketsInUse() { return packetsInUse; }
|
||||
uint64_t getTimestampPacketAddress();
|
||||
virtual uint64_t getGpuAddress();
|
||||
|
||||
void *hostAddress = nullptr;
|
||||
uint64_t gpuAddress;
|
||||
uint32_t packetsInUse;
|
||||
uint64_t gpuAddress = 0u;
|
||||
|
||||
ze_event_scope_flags_t signalScope = 0u;
|
||||
ze_event_scope_flags_t waitScope = 0u;
|
||||
bool isTimestampEvent = false;
|
||||
bool allocOnDevice = false;
|
||||
|
||||
std::unique_ptr<TimestampPacketStorage> timestampsData = nullptr;
|
||||
uint64_t globalStartTS;
|
||||
@@ -119,12 +118,9 @@ struct EventPool : _ze_event_pool_handle_t {
|
||||
|
||||
virtual NEO::MultiGraphicsAllocation &getAllocation() { return *eventPoolAllocations; }
|
||||
|
||||
virtual size_t getEventSize() = 0;
|
||||
virtual uint32_t getEventSize() = 0;
|
||||
|
||||
bool isEventPoolUsedForTimestamp = false;
|
||||
bool allocOnDevice = false;
|
||||
|
||||
CommandList *eventPoolCommandList = nullptr;
|
||||
|
||||
protected:
|
||||
NEO::MultiGraphicsAllocation *eventPoolAllocations = nullptr;
|
||||
@@ -135,10 +131,6 @@ struct EventPoolImp : public EventPool {
|
||||
if (flags & ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP) {
|
||||
isEventPoolUsedForTimestamp = true;
|
||||
}
|
||||
|
||||
if (!(flags & ZE_EVENT_POOL_FLAG_HOST_VISIBLE)) {
|
||||
allocOnDevice = true;
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t initialize(DriverHandle *driver,
|
||||
@@ -156,7 +148,7 @@ struct EventPoolImp : public EventPool {
|
||||
|
||||
ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) override;
|
||||
|
||||
size_t getEventSize() override { return eventSize; }
|
||||
uint32_t getEventSize() override { return eventSize; }
|
||||
size_t getNumEvents() { return numEvents; }
|
||||
|
||||
Device *getDevice() override { return devices[0]; }
|
||||
|
||||
Reference in New Issue
Block a user