Remove ensureMemoryOnDevice function

Remove:
- ensureMemoryOnDevice
- lastUsedRootDeviceIndex
- requiredRootDeviceIndex
- getMigrateableMultiGraphicsAllocation

Related-To: NEO-4589
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2021-03-26 15:54:43 +00:00
committed by Compute-Runtime-Automation
parent 0bc04f3c31
commit 7bfe26a08d
23 changed files with 18 additions and 795 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,12 +29,6 @@ cl_int CommandQueueHw<GfxFamily>::enqueueCopyBuffer(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
srcBuffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
dstBuffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
auto eBuiltInOpsType = EBuiltInOps::CopyBufferToBuffer;
if (forceStateless(std::max(srcBuffer->getSize(), dstBuffer->getSize()))) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -32,13 +32,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueCopyBufferRect(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
srcBuffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
dstBuffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
auto eBuiltInOps = EBuiltInOps::CopyBufferRect;
if (forceStateless(std::max(srcBuffer->getSize(), dstBuffer->getSize()))) {
eBuiltInOps = EBuiltInOps::CopyBufferRectStateless;
}

View File

@@ -30,13 +30,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueCopyBufferToImage(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
srcBuffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
dstImage->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
auto eBuiltInOpsType = EBuiltInOps::CopyBufferToImage3d;
if (forceStateless(srcBuffer->getSize())) {
eBuiltInOpsType = EBuiltInOps::CopyBufferToImage3dStateless;
}

View File

@@ -31,12 +31,6 @@ cl_int CommandQueueHw<GfxFamily>::enqueueCopyImage(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
srcImage->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
dstImage->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::CopyImageToImage3d,
this->getClDevice());
BuiltInOwnershipWrapper builtInLock(builder);

View File

@@ -30,13 +30,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueCopyImageToBuffer(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
srcImage->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
dstBuffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
auto eBuiltInOpsType = EBuiltInOps::CopyImage3dToBuffer;
if (forceStateless(dstBuffer->getSize())) {
eBuiltInOpsType = EBuiltInOps::CopyImage3dToBufferStateless;
}

View File

@@ -33,10 +33,6 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillBuffer(
auto memoryManager = getDevice().getMemoryManager();
DEBUG_BREAK_IF(nullptr == memoryManager);
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
buffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
auto commandStreamReceieverOwnership = getGpgpuCommandStreamReceiver().obtainUniqueOwnership();
auto storageWithAllocations = getGpgpuCommandStreamReceiver().getInternalAllocationStorage();
auto allocationType = GraphicsAllocation::AllocationType::FILL_PATTERN;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,11 +29,6 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillImage(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
image->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::FillImage3d,
this->getClDevice());
BuiltInOwnershipWrapper builtInLock(builder);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -26,13 +26,6 @@ cl_int CommandQueueHw<GfxFamily>::enqueueMigrateMemObjects(cl_uint numMemObjects
NullSurface s;
Surface *surfaces[] = {&s};
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
for (unsigned int object = 0; object < numMemObjects; object++) {
auto memObject = castToObject<MemObj>(memObjects[object]);
memObject->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
}
enqueueHandler<CL_COMMAND_MIGRATE_MEM_OBJECTS>(surfaces,
false,
MultiDispatchInfo(),

View File

@@ -44,9 +44,6 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
}
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
buffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
bool isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, cmdType) : true;
bool isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, cmdType, blockingRead, size, ptr,
numEventsInWaitList, eventWaitList);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -34,13 +34,9 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBufferRect(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
buffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
const cl_command_type cmdType = CL_COMMAND_READ_BUFFER_RECT;
auto isMemTransferNeeded = true;
if (buffer->isMemObjZeroCopy()) {
size_t bufferOffset;
size_t hostOffset;

View File

@@ -40,14 +40,10 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadImage(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
srcImage->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
cl_command_type cmdType = CL_COMMAND_READ_IMAGE;
auto blitAllowed = blitEnqueueAllowed(cmdType) && blitEnqueueImageAllowed(origin, region);
auto &csr = getCommandStreamReceiver(blitAllowed);
if (nullptr == mapAllocation) {
notifyEnqueueReadImage(srcImage, static_cast<bool>(blockingRead), EngineHelpers::isBcs(csr.getOsContext().getEngineType()));
}

View File

@@ -34,8 +34,6 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
buffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
const cl_command_type cmdType = CL_COMMAND_WRITE_BUFFER;
auto isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, cmdType) : true;
bool isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, cmdType, blockingWrite, size, const_cast<void *>(ptr),

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -33,13 +33,9 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBufferRect(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
buffer->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
const cl_command_type cmdType = CL_COMMAND_WRITE_BUFFER_RECT;
auto isMemTransferNeeded = true;
if (buffer->isMemObjZeroCopy()) {
size_t bufferOffset;
size_t hostOffset;

View File

@@ -34,13 +34,9 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteImage(
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
dstImage->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
auto cmdType = CL_COMMAND_WRITE_IMAGE;
auto isMemTransferNeeded = true;
if (dstImage->isMemObjZeroCopy()) {
size_t hostOffset;
Image::calculateHostPtrOffset(&hostOffset, origin, region, inputRowPitch, inputSlicePitch, dstImage->getImageDesc().image_type, dstImage->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes);