mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
Always pass device bitfield to AllocationProperties in constructor
Related-To: NEO-4722 Change-Id: Ie2475bf92a3189bcb9073bec5bf5af709e597c5d Signed-off-by: Andrzej Swierczynski <andrzej.swierczynski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
146fc900c3
commit
77f50e5444
@@ -100,7 +100,8 @@ struct EventPoolImp : public EventPool {
|
||||
NEO::AllocationProperties properties(
|
||||
device->getRootDeviceIndex(), count * eventSize,
|
||||
isEventPoolUsedForTimestamp ? NEO::GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER
|
||||
: NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
: NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
|
||||
device->getNEODevice()->getDeviceBitfield());
|
||||
properties.alignment = MemoryConstants::cacheLineSize;
|
||||
eventPoolAllocation = driver->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ ze_result_t FenceImp::queryStatus() {
|
||||
|
||||
bool FenceImp::initialize() {
|
||||
NEO::AllocationProperties properties(
|
||||
cmdQueue->getDevice()->getRootDeviceIndex(), MemoryConstants::cacheLineSize, NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
cmdQueue->getDevice()->getRootDeviceIndex(), MemoryConstants::cacheLineSize, NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, cmdQueue->getDevice()->getNEODevice()->getDeviceBitfield());
|
||||
properties.alignment = MemoryConstants::cacheLineSize;
|
||||
allocation = cmdQueue->getDevice()->getDriverHandle()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||
UNRECOVERABLE_IF(allocation == nullptr);
|
||||
|
||||
@@ -100,7 +100,7 @@ void KernelImmutableData::initialize(NEO::KernelInfo *kernelInfo, NEO::MemoryMan
|
||||
auto kernelIsaSize = kernelInfo->heapInfo.KernelHeapSize;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(
|
||||
{device->getRootDeviceIndex(), kernelIsaSize, NEO::GraphicsAllocation::AllocationType::KERNEL_ISA});
|
||||
{device->getRootDeviceIndex(), kernelIsaSize, NEO::GraphicsAllocation::AllocationType::KERNEL_ISA, device->getDeviceBitfield()});
|
||||
UNRECOVERABLE_IF(allocation == nullptr);
|
||||
if (kernelInfo->heapInfo.pKernelHeap != nullptr) {
|
||||
memoryManager.copyMemoryToAllocation(allocation, kernelInfo->heapInfo.pKernelHeap, kernelIsaSize);
|
||||
@@ -149,7 +149,7 @@ void KernelImmutableData::initialize(NEO::KernelInfo *kernelInfo, NEO::MemoryMan
|
||||
privateSurfaceSize *= computeUnitsUsedForSratch * kernelDescriptor->kernelAttributes.simdSize;
|
||||
UNRECOVERABLE_IF(privateSurfaceSize == 0);
|
||||
this->privateMemoryGraphicsAllocation.reset(memoryManager.allocateGraphicsMemoryWithProperties(
|
||||
{device->getRootDeviceIndex(), privateSurfaceSize, NEO::GraphicsAllocation::AllocationType::PRIVATE_SURFACE}));
|
||||
{device->getRootDeviceIndex(), privateSurfaceSize, NEO::GraphicsAllocation::AllocationType::PRIVATE_SURFACE, device->getDeviceBitfield()}));
|
||||
|
||||
UNRECOVERABLE_IF(this->privateMemoryGraphicsAllocation == nullptr);
|
||||
patchWithImplicitSurface(crossThredDataArrayRef, surfaceStateHeapArrayRef,
|
||||
|
||||
@@ -34,7 +34,7 @@ ze_result_t DriverHandleImp::openIpcMemHandle(ze_device_handle_t hDevice, ze_ipc
|
||||
NEO::osHandle osHandle = static_cast<NEO::osHandle>(handle);
|
||||
NEO::AllocationProperties unifiedMemoryProperties{neoDevice->getRootDeviceIndex(),
|
||||
MemoryConstants::pageSize,
|
||||
NEO::GraphicsAllocation::AllocationType::BUFFER};
|
||||
NEO::GraphicsAllocation::AllocationType::BUFFER, neoDevice->getDeviceBitfield()};
|
||||
unifiedMemoryProperties.subDevicesBitfield = neoDevice->getDeviceBitfield();
|
||||
NEO::GraphicsAllocation *alloc =
|
||||
this->getMemoryManager()->createGraphicsAllocationFromSharedHandle(osHandle,
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace L0 {
|
||||
|
||||
NEO::GraphicsAllocation *PrintfHandler::createPrintfBuffer(Device *device) {
|
||||
NEO::AllocationProperties properties(
|
||||
device->getRootDeviceIndex(), PrintfHandler::printfBufferSize, NEO::GraphicsAllocation::AllocationType::PRINTF_SURFACE);
|
||||
device->getRootDeviceIndex(), PrintfHandler::printfBufferSize, NEO::GraphicsAllocation::AllocationType::PRINTF_SURFACE, device->getNEODevice()->getDeviceBitfield());
|
||||
properties.alignment = MemoryConstants::pageSize64k;
|
||||
auto allocation = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ bool MetricsLibrary::createMetricQuery(const uint32_t slotsCount, QueryHandle_1_
|
||||
|
||||
// Allocate gpu memory.
|
||||
NEO::AllocationProperties properties(
|
||||
metricContext.getDevice().getRootDeviceIndex(), gpuReportSize.ValueUInt32 * slotsCount, NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
metricContext.getDevice().getRootDeviceIndex(), gpuReportSize.ValueUInt32 * slotsCount, NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, metricContext.getDevice().getNEODevice()->getDeviceBitfield());
|
||||
properties.alignment = 64u;
|
||||
pAllocation = metricContext.getDevice().getDriverHandle()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
|
||||
@@ -474,7 +474,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMMemFill(void *svmPtr,
|
||||
commandStreamReceieverOwnership.unlock();
|
||||
|
||||
if (!patternAllocation) {
|
||||
patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({getDevice().getRootDeviceIndex(), patternSize, allocationType});
|
||||
patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({getDevice().getRootDeviceIndex(), patternSize, allocationType, getDevice().getDeviceBitfield()});
|
||||
}
|
||||
|
||||
if (patternSize == 1) {
|
||||
|
||||
@@ -106,21 +106,22 @@ void DeviceQueue::allocateResources() {
|
||||
|
||||
uint32_t alignedQueueSize = alignUp(queueSize, MemoryConstants::pageSize);
|
||||
auto rootDeviceIndex = device->getRootDeviceIndex();
|
||||
queueBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, alignedQueueSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
auto deviceBitfield = device->getDeviceBitfield();
|
||||
queueBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, alignedQueueSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, deviceBitfield});
|
||||
|
||||
auto eventPoolBufferSize = static_cast<size_t>(caps.maxOnDeviceEvents) * sizeof(IGIL_DeviceEvent) + sizeof(IGIL_EventPool);
|
||||
eventPoolBufferSize = alignUp(eventPoolBufferSize, MemoryConstants::pageSize);
|
||||
eventPoolBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, eventPoolBufferSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
eventPoolBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, eventPoolBufferSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, deviceBitfield});
|
||||
|
||||
auto maxEnqueue = static_cast<size_t>(alignedQueueSize) / sizeof(IGIL_CommandHeader);
|
||||
auto expectedStackSize = maxEnqueue * sizeof(uint32_t) * 3; // 3 full loads of commands
|
||||
expectedStackSize = alignUp(expectedStackSize, MemoryConstants::pageSize);
|
||||
stackBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, expectedStackSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
stackBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, expectedStackSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, deviceBitfield});
|
||||
memset(stackBuffer->getUnderlyingBuffer(), 0, stackBuffer->getUnderlyingBufferSize());
|
||||
|
||||
auto queueStorageSize = alignedQueueSize * 2; // place for 2 full loads of queue_t
|
||||
queueStorageSize = alignUp(queueStorageSize, MemoryConstants::pageSize);
|
||||
queueStorageBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, queueStorageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
queueStorageBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, queueStorageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, deviceBitfield});
|
||||
memset(queueStorageBuffer->getUnderlyingBuffer(), 0, queueStorageBuffer->getUnderlyingBufferSize());
|
||||
|
||||
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
@@ -129,9 +130,9 @@ void DeviceQueue::allocateResources() {
|
||||
// Additional padding of PAGE_SIZE for PageFaults just after DSH to satisfy hw requirements
|
||||
auto dshSize = (PARALLEL_SCHEDULER_HW_GROUPS + 2) * MAX_DSH_SIZE_PER_ENQUEUE * 8 + IDTSize + colorCalcStateSize + MemoryConstants::pageSize;
|
||||
dshSize = alignUp(dshSize, MemoryConstants::pageSize);
|
||||
dshBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, dshSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
dshBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, dshSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, deviceBitfield});
|
||||
|
||||
debugQueue = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
debugQueue = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, deviceBitfield});
|
||||
debugData = (DebugDataBuffer *)debugQueue->getUnderlyingBuffer();
|
||||
memset(debugQueue->getUnderlyingBuffer(), 0, debugQueue->getUnderlyingBufferSize());
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ void DeviceQueueHw<GfxFamily>::allocateSlbBuffer() {
|
||||
slbSize += (4 * MemoryConstants::pageSize); // +4 pages spec restriction
|
||||
slbSize = alignUp(slbSize, MemoryConstants::pageSize);
|
||||
|
||||
slbBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), slbSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
slbBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), slbSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, device->getDeviceBitfield()});
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -280,7 +280,7 @@ cl_int Kernel::initialize() {
|
||||
retVal = CL_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
privateSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), static_cast<size_t>(privateSurfaceSize), GraphicsAllocation::AllocationType::PRIVATE_SURFACE});
|
||||
privateSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), static_cast<size_t>(privateSurfaceSize), GraphicsAllocation::AllocationType::PRIVATE_SURFACE, device.getDeviceBitfield()});
|
||||
if (privateSurface == nullptr) {
|
||||
retVal = CL_OUT_OF_RESOURCES;
|
||||
break;
|
||||
@@ -1697,7 +1697,7 @@ void Kernel::createReflectionSurface() {
|
||||
kernelReflectionSize += blockCount * alignUp(maxConstantBufferSize, sizeof(void *));
|
||||
kernelReflectionSize += parentImageCount * sizeof(IGIL_ImageParamters);
|
||||
kernelReflectionSize += parentSamplerCount * sizeof(IGIL_ParentSamplerParams);
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), kernelReflectionSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), kernelReflectionSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, device.getDeviceBitfield()});
|
||||
|
||||
for (uint32_t i = 0; i < blockCount; i++) {
|
||||
const KernelInfo *pBlockInfo = blockManager->getBlockKernelInfo(i);
|
||||
@@ -1771,7 +1771,7 @@ void Kernel::createReflectionSurface() {
|
||||
|
||||
if (DebugManager.flags.ForceDispatchScheduler.get()) {
|
||||
if (this->isSchedulerKernel && kernelReflectionSurface == nullptr) {
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, device.getDeviceBitfield()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo)
|
||||
return;
|
||||
}
|
||||
kernel = multiDispatchInfo.peekMainKernel();
|
||||
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), printfSurfaceSize, GraphicsAllocation::AllocationType::PRINTF_SURFACE});
|
||||
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({device.getRootDeviceIndex(), printfSurfaceSize, GraphicsAllocation::AllocationType::PRINTF_SURFACE, device.getDeviceBitfield()});
|
||||
*reinterpret_cast<uint32_t *>(printfSurface->getUnderlyingBuffer()) = printfSurfaceInitialDataSize;
|
||||
|
||||
auto printfPatchAddress = ptrOffset(reinterpret_cast<uintptr_t *>(kernel->getCrossThreadData()),
|
||||
|
||||
@@ -363,7 +363,7 @@ void Program::allocateBlockPrivateSurfaces(uint32_t rootDeviceIndex) {
|
||||
|
||||
if (privateSize > 0 && blockKernelManager->getPrivateSurface(i) == nullptr) {
|
||||
privateSize *= getDevice().getDeviceInfo().computeUnitsUsedForScratch * info->getMaxSimdSize();
|
||||
auto *privateSurface = this->executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, privateSize, GraphicsAllocation::AllocationType::PRIVATE_SURFACE});
|
||||
auto *privateSurface = this->executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, privateSize, GraphicsAllocation::AllocationType::PRIVATE_SURFACE, getDevice().getDeviceBitfield()});
|
||||
blockKernelManager->pushPrivateSurface(privateSurface, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
||||
|
||||
GraphicsAllocation *mcsAlloc = nullptr;
|
||||
if (texInfo.globalShareHandleMCS) {
|
||||
AllocationProperties allocProperties(context->getDevice(0)->getRootDeviceIndex(), 0, GraphicsAllocation::AllocationType::MCS);
|
||||
AllocationProperties allocProperties(context->getDevice(0)->getRootDeviceIndex(), 0, GraphicsAllocation::AllocationType::MCS, context->getDeviceBitfieldForAllocation());
|
||||
mcsAlloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandleMCS, allocProperties, false);
|
||||
if (texInfo.pGmmResInfoMCS) {
|
||||
DEBUG_BREAK_IF(mcsAlloc->getDefaultGmm() != nullptr);
|
||||
|
||||
@@ -798,12 +798,11 @@ struct CommandStreamReceiverHwLog : public UltCommandStreamReceiver<FamilyType>
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithBothCSCallsFlushOnce) {
|
||||
CommandStreamReceiverHwLog<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
commandStreamReceiver.setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
commandStreamReceiver.initializeTagAllocation();
|
||||
commandStreamReceiver.createPreemptionAllocation();
|
||||
commandStream.getSpace(sizeof(typename FamilyType::MI_NOOP));
|
||||
|
||||
commandStreamReceiver.setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
flushTask(commandStreamReceiver);
|
||||
EXPECT_EQ(1, commandStreamReceiver.flushCount);
|
||||
}
|
||||
|
||||
@@ -678,6 +678,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalRes
|
||||
auto mockedMemoryManager = new MockedMemoryManager(*executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(mockedMemoryManager);
|
||||
auto mockCsr = std::make_unique<MockCsrHw2<FamilyType>>(*executionEnvironment, 0);
|
||||
mockCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread || pDevice->isDebuggerActive()) {
|
||||
mockCsr->createPreemptionAllocation();
|
||||
@@ -685,7 +686,6 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalRes
|
||||
|
||||
mockCsr->initializeTagAllocation();
|
||||
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
|
||||
mockCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
|
||||
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
@@ -269,13 +269,13 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch
|
||||
|
||||
bool stateBaseAddressDirty;
|
||||
bool vfeStateDirty;
|
||||
MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
|
||||
false, false, false);
|
||||
mockCsr->setupContext(osContext);
|
||||
mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 10u, 0u, 1u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, vfeStateDirty);
|
||||
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
mockCsr->requiredScratchSize = 0x200000;
|
||||
MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
|
||||
false, false, false);
|
||||
mockCsr->setupContext(osContext);
|
||||
|
||||
mockCsr->programVFEState(commandStream, flags, 10);
|
||||
ASSERT_EQ(1u, mockCsr->getFlatBatchBufferHelper().getPatchInfoCollection().size());
|
||||
@@ -291,13 +291,13 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch
|
||||
|
||||
bool stateBaseAddressDirty;
|
||||
bool vfeStateDirty;
|
||||
MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
|
||||
false, false, false);
|
||||
mockCsr->setupContext(osContext);
|
||||
mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 10u, 0u, 1u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, vfeStateDirty);
|
||||
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
mockCsr->requiredScratchSize = 0x200000;
|
||||
MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
|
||||
false, false, false);
|
||||
mockCsr->setupContext(osContext);
|
||||
|
||||
mockCsr->programVFEState(commandStream, flags, 10);
|
||||
EXPECT_EQ(0u, mockCsr->getFlatBatchBufferHelper().getPatchInfoCollection().size());
|
||||
|
||||
@@ -302,6 +302,7 @@ HWTEST_F(CommandStreamReceiverHwTest, WhenScratchSpaceIsNotRequiredThenScratchAl
|
||||
|
||||
HWTEST_F(CommandStreamReceiverHwTest, WhenScratchSpaceIsRequiredThenCorrectAddressIsReturned) {
|
||||
auto commandStreamReceiver = std::make_unique<MockCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
commandStreamReceiver->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
auto scratchController = commandStreamReceiver->getScratchSpaceController();
|
||||
|
||||
bool cfeStateDirty = false;
|
||||
|
||||
@@ -381,6 +381,7 @@ HWTEST_F(CommandStreamReceiverTest, givenCommandStreamReceiverWhenFenceAllocatio
|
||||
RAIIHwHelperFactory<MockHwHelperWithFenceAllocation<FamilyType>> hwHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily};
|
||||
|
||||
MockCsrHw<FamilyType> csr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
csr.setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
EXPECT_EQ(nullptr, csr.globalFenceAllocation);
|
||||
|
||||
EXPECT_TRUE(csr.createGlobalFenceAllocation());
|
||||
@@ -393,6 +394,7 @@ HWTEST_F(CommandStreamReceiverTest, givenCommandStreamReceiverWhenGettingFenceAl
|
||||
RAIIHwHelperFactory<MockHwHelperWithFenceAllocation<FamilyType>> hwHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily};
|
||||
|
||||
CommandStreamReceiverHw<FamilyType> csr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
csr.setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
EXPECT_EQ(nullptr, csr.getGlobalFenceAllocation());
|
||||
|
||||
EXPECT_TRUE(csr.createGlobalFenceAllocation());
|
||||
|
||||
@@ -902,7 +902,7 @@ TEST(MemoryManagerTest, givenDebugContextSaveAreaTypeWhenGetAllocationDataIsCall
|
||||
TEST(MemoryManagerTest, givenPropertiesWithOsContextWhenGetAllocationDataIsCalledThenOsContextIsSet) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA};
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA, mockDeviceBitfield};
|
||||
|
||||
MockOsContext osContext(0u, 1,
|
||||
HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0],
|
||||
@@ -917,7 +917,7 @@ TEST(MemoryManagerTest, givenPropertiesWithOsContextWhenGetAllocationDataIsCalle
|
||||
TEST(MemoryManagerTest, givenPropertiesWithGpuAddressWhenGetAllocationDataIsCalledThenGpuAddressIsSet) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager mockMemoryManager;
|
||||
AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA};
|
||||
AllocationProperties properties{mockRootDeviceIndex, 1, GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA, mockDeviceBitfield};
|
||||
|
||||
properties.gpuAddress = 0x4000;
|
||||
|
||||
|
||||
@@ -183,10 +183,6 @@ std::unique_ptr<AubExecutionEnvironment> getEnvironment(bool createTagAllocation
|
||||
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
auto commandStreamReceiver = std::make_unique<CsrType>("", standalone, *executionEnvironment, rootDeviceIndex);
|
||||
if (createTagAllocation) {
|
||||
commandStreamReceiver->initializeTagAllocation();
|
||||
}
|
||||
commandStreamReceiver->createGlobalFenceAllocation();
|
||||
|
||||
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(),
|
||||
getChosenEngineType(*defaultHwInfo), 1,
|
||||
@@ -194,6 +190,11 @@ std::unique_ptr<AubExecutionEnvironment> getEnvironment(bool createTagAllocation
|
||||
false, false, false);
|
||||
commandStreamReceiver->setupContext(*osContext);
|
||||
|
||||
if (createTagAllocation) {
|
||||
commandStreamReceiver->initializeTagAllocation();
|
||||
}
|
||||
commandStreamReceiver->createGlobalFenceAllocation();
|
||||
|
||||
std::unique_ptr<AubExecutionEnvironment> aubExecutionEnvironment(new AubExecutionEnvironment);
|
||||
if (allocateCommandBuffer) {
|
||||
aubExecutionEnvironment->commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, MemoryConstants::pageSize});
|
||||
|
||||
@@ -85,7 +85,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenCopyMemoryToAllocationThen
|
||||
|
||||
std::vector<uint8_t> dataToCopy(MemoryConstants::pageSize, 1u);
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, dataToCopy.size(), GraphicsAllocation::AllocationType::BUFFER});
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, dataToCopy.size(), GraphicsAllocation::AllocationType::BUFFER, device->getDeviceBitfield()});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
auto ret = memoryManager->copyMemoryToAllocation(allocation, dataToCopy.data(), dataToCopy.size());
|
||||
|
||||
@@ -3674,7 +3674,7 @@ TEST(DrmMemoryManagerFreeGraphicsMemoryCallSequenceTest, givenDrmMemoryManagerAn
|
||||
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create();
|
||||
GMockDrmMemoryManager gmockDrmMemoryManager(executionEnvironment);
|
||||
|
||||
AllocationProperties properties{0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER};
|
||||
AllocationProperties properties{mockRootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield};
|
||||
auto allocation = gmockDrmMemoryManager.allocateGraphicsMemoryWithProperties(properties);
|
||||
ASSERT_NE(allocation, nullptr);
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ void CommandStreamReceiver::addAubComment(const char *comment) {}
|
||||
|
||||
GraphicsAllocation *CommandStreamReceiver::allocateDebugSurface(size_t size) {
|
||||
UNRECOVERABLE_IF(debugSurface != nullptr);
|
||||
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, getOsContext().getDeviceBitfield()});
|
||||
return debugSurface;
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ void *CommandStreamReceiver::asyncDebugBreakConfirmation(void *arg) {
|
||||
}
|
||||
|
||||
bool CommandStreamReceiver::initializeTagAllocation() {
|
||||
auto tagAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::TAG_BUFFER});
|
||||
auto tagAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::TAG_BUFFER, systemMemoryBitfield});
|
||||
if (!tagAllocation) {
|
||||
return false;
|
||||
}
|
||||
@@ -445,13 +445,13 @@ bool CommandStreamReceiver::createGlobalFenceAllocation() {
|
||||
}
|
||||
|
||||
DEBUG_BREAK_IF(this->globalFenceAllocation != nullptr);
|
||||
this->globalFenceAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::GLOBAL_FENCE});
|
||||
this->globalFenceAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::GLOBAL_FENCE, osContext->getDeviceBitfield()});
|
||||
return this->globalFenceAllocation != nullptr;
|
||||
}
|
||||
|
||||
bool CommandStreamReceiver::createPreemptionAllocation() {
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
||||
AllocationProperties properties{rootDeviceIndex, hwInfo->capabilityTable.requiredPreemptionSurfaceSize, GraphicsAllocation::AllocationType::PREEMPTION};
|
||||
AllocationProperties properties{rootDeviceIndex, hwInfo->capabilityTable.requiredPreemptionSurfaceSize, GraphicsAllocation::AllocationType::PREEMPTION, osContext->getDeviceBitfield()};
|
||||
properties.flags.uncacheable = hwInfo->workaroundTable.waCSRUncachable;
|
||||
properties.alignment = 256 * MemoryConstants::kiloByte;
|
||||
this->preemptionAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||
@@ -478,7 +478,7 @@ bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surfa
|
||||
allocation.reset(memoryManager->allocateGraphicsMemoryWithProperties(properties, surface.getMemoryPointer()));
|
||||
if (allocation == nullptr && surface.peekIsPtrCopyAllowed()) {
|
||||
// Try with no host pointer allocation and copy
|
||||
AllocationProperties copyProperties{rootDeviceIndex, surface.getSurfaceSize(), GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY};
|
||||
AllocationProperties copyProperties{rootDeviceIndex, surface.getSurfaceSize(), GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, internalAllocationStorage->getDeviceBitfield()};
|
||||
copyProperties.alignment = MemoryConstants::pageSize;
|
||||
allocation.reset(memoryManager->allocateGraphicsMemoryWithProperties(copyProperties));
|
||||
if (allocation) {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/memory_manager/internal_allocation_storage.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
@@ -25,9 +26,9 @@ ExperimentalCommandBuffer::ExperimentalCommandBuffer(CommandStreamReceiver *csr,
|
||||
defaultPrint(true),
|
||||
timerResolution(profilingTimerResolution) {
|
||||
auto rootDeviceIndex = csr->getRootDeviceIndex();
|
||||
timestamps = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
timestamps = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, csr->getOsContext().getDeviceBitfield()});
|
||||
memset(timestamps->getUnderlyingBuffer(), 0, timestamps->getUnderlyingBufferSize());
|
||||
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, csr->getOsContext().getDeviceBitfield()});
|
||||
memset(experimentalAllocation->getUnderlyingBuffer(), 0, experimentalAllocation->getUnderlyingBufferSize());
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ void ScratchSpaceControllerBase::setRequiredScratchSpace(void *sshBaseAddress,
|
||||
}
|
||||
|
||||
void ScratchSpaceControllerBase::createScratchSpaceAllocation() {
|
||||
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, scratchSizeBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE});
|
||||
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, scratchSizeBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE, this->csrAllocationStorage.getDeviceBitfield()});
|
||||
UNRECOVERABLE_IF(scratchAllocation == nullptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
constexpr bool is32bit = (sizeof(void *) == 4);
|
||||
constexpr bool is64bit = (sizeof(void *) == 8);
|
||||
|
||||
constexpr NEO::DeviceBitfield systemMemoryBitfield(0b0);
|
||||
|
||||
constexpr uint64_t maxNBitValue(uint64_t n) {
|
||||
return ((1ULL << n) - 1);
|
||||
}
|
||||
|
||||
@@ -38,10 +38,6 @@ struct AllocationProperties {
|
||||
uint64_t gpuAddress = 0;
|
||||
OsContext *osContext = nullptr;
|
||||
|
||||
AllocationProperties(uint32_t rootDeviceIndex, size_t size,
|
||||
GraphicsAllocation::AllocationType allocationType)
|
||||
: AllocationProperties(rootDeviceIndex, size, allocationType, 0b1) {}
|
||||
|
||||
AllocationProperties(uint32_t rootDeviceIndex, size_t size,
|
||||
GraphicsAllocation::AllocationType allocationType, DeviceBitfield subDevicesBitfieldParam)
|
||||
: AllocationProperties(rootDeviceIndex, true, size, allocationType, false, subDevicesBitfieldParam) {}
|
||||
|
||||
@@ -132,7 +132,7 @@ GraphicsAllocation *MemoryManager::createGraphicsAllocationWithPadding(GraphicsA
|
||||
}
|
||||
|
||||
GraphicsAllocation *MemoryManager::createPaddedAllocation(GraphicsAllocation *inputGraphicsAllocation, size_t sizeWithPadding) {
|
||||
return allocateGraphicsMemoryWithProperties({inputGraphicsAllocation->getRootDeviceIndex(), sizeWithPadding, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
return allocateGraphicsMemoryWithProperties({inputGraphicsAllocation->getRootDeviceIndex(), sizeWithPadding, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, systemMemoryBitfield});
|
||||
}
|
||||
|
||||
void MemoryManager::freeSystemMemory(void *ptr) {
|
||||
|
||||
@@ -48,7 +48,7 @@ struct DirectSubmissionDispatchBufferFixture : public DirectSubmissionFixture {
|
||||
DirectSubmissionFixture::SetUp();
|
||||
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
||||
const AllocationProperties commandBufferProperties{pDevice->getRootDeviceIndex(), 0x1000,
|
||||
GraphicsAllocation::AllocationType::COMMAND_BUFFER};
|
||||
GraphicsAllocation::AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()};
|
||||
commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandBufferProperties);
|
||||
|
||||
batchBuffer.endCmdPtr = &bbStart[0];
|
||||
|
||||
@@ -130,7 +130,7 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesThenExpectRin
|
||||
const auto allocationSize = MemoryConstants::pageSize;
|
||||
const AllocationProperties commandStreamAllocationProperties{device->getRootDeviceIndex(),
|
||||
allocationSize,
|
||||
GraphicsAllocation::AllocationType::RING_BUFFER};
|
||||
GraphicsAllocation::AllocationType::RING_BUFFER, device->getDeviceBitfield()};
|
||||
GraphicsAllocation *ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
|
||||
ASSERT_NE(nullptr, ringBuffer);
|
||||
|
||||
@@ -154,7 +154,7 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesFenceCreation
|
||||
MemoryManager *memoryManager = device->getExecutionEnvironment()->memoryManager.get();
|
||||
const auto allocationSize = MemoryConstants::pageSize;
|
||||
const AllocationProperties commandStreamAllocationProperties{device->getRootDeviceIndex(), allocationSize,
|
||||
GraphicsAllocation::AllocationType::RING_BUFFER};
|
||||
GraphicsAllocation::AllocationType::RING_BUFFER, device->getDeviceBitfield()};
|
||||
GraphicsAllocation *ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
|
||||
ASSERT_NE(nullptr, ringBuffer);
|
||||
|
||||
@@ -181,7 +181,7 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenAllocateOsResourcesResidencyFail
|
||||
const auto allocationSize = MemoryConstants::pageSize;
|
||||
const AllocationProperties commandStreamAllocationProperties{device->getRootDeviceIndex(),
|
||||
allocationSize,
|
||||
GraphicsAllocation::AllocationType::RING_BUFFER};
|
||||
GraphicsAllocation::AllocationType::RING_BUFFER, device->getDeviceBitfield()};
|
||||
GraphicsAllocation *ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
|
||||
ASSERT_NE(nullptr, ringBuffer);
|
||||
|
||||
@@ -410,7 +410,7 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmResidencyEnabledWhenAllocatingResour
|
||||
const auto allocationSize = MemoryConstants::pageSize;
|
||||
const AllocationProperties commandStreamAllocationProperties{device->getRootDeviceIndex(),
|
||||
allocationSize,
|
||||
GraphicsAllocation::AllocationType::RING_BUFFER};
|
||||
GraphicsAllocation::AllocationType::RING_BUFFER, device->getDeviceBitfield()};
|
||||
GraphicsAllocation *ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
|
||||
ASSERT_NE(nullptr, ringBuffer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user