Skip to content

Commit cb5ab70

Browse files
kgibalaCompute-Runtime-Automation
authored andcommitted
Destroy all GraphicsAllocation in ~MemObj
Related-To: NEO-4672 Change-Id: I4fa09ae7753ed258f489b9e9f328d0a455e7d9b6 Signed-off-by: Krzysztof Gibala <[email protected]>
1 parent d46ac4b commit cb5ab70

File tree

12 files changed

+97
-69
lines changed

12 files changed

+97
-69
lines changed

opencl/source/command_queue/command_queue.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ cl_int CommandQueue::enqueueWriteMemObjForUnmap(MemObj *memObj, void *mappedPtr,
341341
}
342342

343343
if (!unmapInfo.readOnly) {
344-
memObj->getMapAllocation()->setAubWritable(true, GraphicsAllocation::defaultBank);
345-
memObj->getMapAllocation()->setTbxWritable(true, GraphicsAllocation::defaultBank);
344+
memObj->getMapAllocation(getDevice().getRootDeviceIndex())->setAubWritable(true, GraphicsAllocation::defaultBank);
345+
memObj->getMapAllocation(getDevice().getRootDeviceIndex())->setTbxWritable(true, GraphicsAllocation::defaultBank);
346346

347347
if (memObj->peekClMemObjType() == CL_MEM_OBJECT_BUFFER) {
348348
auto buffer = castToObject<Buffer>(memObj);
349349

350-
retVal = enqueueWriteBuffer(buffer, CL_FALSE, unmapInfo.offset[0], unmapInfo.size[0], mappedPtr, memObj->getMapAllocation(),
350+
retVal = enqueueWriteBuffer(buffer, CL_FALSE, unmapInfo.offset[0], unmapInfo.size[0], mappedPtr, memObj->getMapAllocation(getDevice().getRootDeviceIndex()),
351351
eventsRequest.numEventsInWaitList, eventsRequest.eventWaitList, eventsRequest.outEvent);
352352
} else {
353353
auto image = castToObjectOrAbort<Image>(memObj);
@@ -356,7 +356,7 @@ cl_int CommandQueue::enqueueWriteMemObjForUnmap(MemObj *memObj, void *mappedPtr,
356356
UNRECOVERABLE_IF(mipIdx >= 4);
357357
writeOrigin[mipIdx] = unmapInfo.mipLevel;
358358
retVal = enqueueWriteImage(image, CL_FALSE, writeOrigin, &unmapInfo.size[0],
359-
image->getHostPtrRowPitch(), image->getHostPtrSlicePitch(), mappedPtr, memObj->getMapAllocation(),
359+
image->getHostPtrRowPitch(), image->getHostPtrSlicePitch(), mappedPtr, memObj->getMapAllocation(getDevice().getRootDeviceIndex()),
360360
eventsRequest.numEventsInWaitList, eventsRequest.eventWaitList, eventsRequest.outEvent);
361361
}
362362
} else {
@@ -390,7 +390,7 @@ void *CommandQueue::enqueueReadMemObjForMap(TransferProperties &transferProperti
390390
if (transferProperties.memObj->peekClMemObjType() == CL_MEM_OBJECT_BUFFER) {
391391
auto buffer = castToObject<Buffer>(transferProperties.memObj);
392392
errcodeRet = enqueueReadBuffer(buffer, transferProperties.blocking, transferProperties.offset[0], transferProperties.size[0],
393-
returnPtr, transferProperties.memObj->getMapAllocation(), eventsRequest.numEventsInWaitList,
393+
returnPtr, transferProperties.memObj->getMapAllocation(getDevice().getRootDeviceIndex()), eventsRequest.numEventsInWaitList,
394394
eventsRequest.eventWaitList, eventsRequest.outEvent);
395395
} else {
396396
auto image = castToObjectOrAbort<Image>(transferProperties.memObj);
@@ -400,7 +400,7 @@ void *CommandQueue::enqueueReadMemObjForMap(TransferProperties &transferProperti
400400
readOrigin[mipIdx] = transferProperties.mipLevel;
401401
errcodeRet = enqueueReadImage(image, transferProperties.blocking, readOrigin, &transferProperties.size[0],
402402
image->getHostPtrRowPitch(), image->getHostPtrSlicePitch(),
403-
returnPtr, transferProperties.memObj->getMapAllocation(), eventsRequest.numEventsInWaitList,
403+
returnPtr, transferProperties.memObj->getMapAllocation(getDevice().getRootDeviceIndex()), eventsRequest.numEventsInWaitList,
404404
eventsRequest.eventWaitList, eventsRequest.outEvent);
405405
}
406406

opencl/source/mem_obj/buffer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ cl_mem Buffer::validateInputAndCreateBuffer(cl_context context,
9999
size_t size,
100100
void *hostPtr,
101101
cl_int &retVal) {
102-
103102
Context *pContext = nullptr;
104103
retVal = validateObjects(WithCastToInternal(context, &pContext));
105104
if (retVal != CL_SUCCESS) {
@@ -335,7 +334,9 @@ Buffer *Buffer::create(Context *context,
335334

336335
Buffer::provideCompressionHint(allocationType, context, pBuffer);
337336

338-
pBuffer->mapAllocation = mapAllocation;
337+
if (mapAllocation) {
338+
pBuffer->mapAllocations.addAllocation(mapAllocation);
339+
}
339340
pBuffer->setHostPtrMinSize(size);
340341

341342
if (copyMemoryFromHostPtr) {
@@ -627,7 +628,6 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device,
627628
bool zeroCopy,
628629
bool isHostPtrSVM,
629630
bool isImageRedescribed) {
630-
631631
const auto &hwInfo = device->getHardwareInfo();
632632

633633
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;

opencl/source/mem_obj/image.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,9 @@ Image *Image::create(Context *context,
418418
}
419419
}
420420

421-
image->mapAllocation = mapAllocation;
421+
if (mapAllocation) {
422+
image->mapAllocations.addAllocation(mapAllocation);
423+
}
422424

423425
if (errcodeRet != CL_SUCCESS) {
424426
image->release();

opencl/source/mem_obj/mem_obj.cpp

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ MemObj::MemObj(Context *context,
4242
: context(context), memObjectType(memObjectType), memoryProperties(memoryProperties), flags(flags), flagsIntel(flagsIntel), size(size),
4343
memoryStorage(memoryStorage), hostPtr(hostPtr),
4444
isZeroCopy(zeroCopy), isHostPtrSVM(isHostPtrSVM), isObjectRedescribed(isObjectRedescribed),
45-
multiGraphicsAllocation(std::move(multiGraphicsAllocation)) {
46-
45+
multiGraphicsAllocation(std::move(multiGraphicsAllocation)),
46+
mapAllocations(static_cast<uint32_t>(this->multiGraphicsAllocation.getGraphicsAllocations().size() - 1)) {
4747
if (context) {
4848
context->incRefInternal();
4949
memoryManager = context->getMemoryManager();
@@ -58,6 +58,7 @@ MemObj::~MemObj() {
5858
}
5959

6060
bool needWait = false;
61+
6162
if (allocatedMapPtr != nullptr) {
6263
needWait = true;
6364
}
@@ -72,35 +73,37 @@ MemObj::~MemObj() {
7273
if (peekSharingHandler()) {
7374
peekSharingHandler()->releaseReusedGraphicsAllocation();
7475
}
75-
auto graphicsAllocation = multiGraphicsAllocation.getDefaultGraphicsAllocation();
76-
if (graphicsAllocation && !associatedMemObject && !isHostPtrSVM && graphicsAllocation->peekReuseCount() == 0) {
77-
memoryManager->removeAllocationFromHostPtrManager(graphicsAllocation);
78-
bool doAsyncDestructions = DebugManager.flags.EnableAsyncDestroyAllocations.get();
79-
if (!doAsyncDestructions) {
80-
needWait = true;
76+
77+
for (auto graphicsAllocation : multiGraphicsAllocation.getGraphicsAllocations()) {
78+
auto rootDeviceIndex = graphicsAllocation ? graphicsAllocation->getRootDeviceIndex() : 0;
79+
if (graphicsAllocation && !associatedMemObject && !isHostPtrSVM && graphicsAllocation->peekReuseCount() == 0) {
80+
memoryManager->removeAllocationFromHostPtrManager(graphicsAllocation);
81+
bool doAsyncDestructions = DebugManager.flags.EnableAsyncDestroyAllocations.get();
82+
if (!doAsyncDestructions) {
83+
needWait = true;
84+
}
85+
if (needWait && graphicsAllocation->isUsed()) {
86+
memoryManager->waitForEnginesCompletion(*graphicsAllocation);
87+
}
88+
destroyGraphicsAllocation(graphicsAllocation, doAsyncDestructions);
89+
graphicsAllocation = nullptr;
90+
}
91+
if (!associatedMemObject) {
92+
releaseMapAllocation(rootDeviceIndex);
93+
}
94+
if (mcsAllocation) {
95+
destroyGraphicsAllocation(mcsAllocation, false);
8196
}
82-
if (needWait && graphicsAllocation->isUsed()) {
83-
memoryManager->waitForEnginesCompletion(*graphicsAllocation);
97+
if (graphicsAllocation && associatedMemObject) {
98+
if (associatedMemObject->getGraphicsAllocation(graphicsAllocation->getRootDeviceIndex()) != graphicsAllocation) {
99+
destroyGraphicsAllocation(graphicsAllocation, false);
100+
}
101+
associatedMemObject->decRefInternal();
84102
}
85-
destroyGraphicsAllocation(graphicsAllocation, doAsyncDestructions);
86-
graphicsAllocation = nullptr;
87103
}
88-
89104
if (!associatedMemObject) {
90-
releaseMapAllocation();
91105
releaseAllocatedMapPtr();
92106
}
93-
if (mcsAllocation) {
94-
destroyGraphicsAllocation(mcsAllocation, false);
95-
}
96-
97-
if (associatedMemObject) {
98-
UNRECOVERABLE_IF(!graphicsAllocation);
99-
if (associatedMemObject->getGraphicsAllocation(graphicsAllocation->getRootDeviceIndex()) != graphicsAllocation) {
100-
destroyGraphicsAllocation(graphicsAllocation, false);
101-
}
102-
associatedMemObject->decRefInternal();
103-
}
104107
}
105108
if (!destructorCallbacks.empty()) {
106109
for (auto iter = destructorCallbacks.rbegin(); iter != destructorCallbacks.rend(); iter++) {
@@ -315,9 +318,9 @@ void MemObj::releaseAllocatedMapPtr() {
315318
allocatedMapPtr = nullptr;
316319
}
317320

318-
void MemObj::releaseMapAllocation() {
319-
if (mapAllocation && !isHostPtrSVM) {
320-
destroyGraphicsAllocation(mapAllocation, false);
321+
void MemObj::releaseMapAllocation(uint32_t rootDeviceIndex) {
322+
if (mapAllocations.getGraphicsAllocation(rootDeviceIndex) && !isHostPtrSVM) {
323+
destroyGraphicsAllocation(mapAllocations.getGraphicsAllocation(rootDeviceIndex), false);
321324
}
322325
}
323326

@@ -347,8 +350,8 @@ void *MemObj::getBasePtrForMap(uint32_t rootDeviceIndex) {
347350
return getHostPtr();
348351
} else {
349352
TakeOwnershipWrapper<MemObj> memObjOwnership(*this);
350-
if (getMapAllocation()) {
351-
return getMapAllocation()->getUnderlyingBuffer();
353+
if (getMapAllocation(rootDeviceIndex)) {
354+
return getMapAllocation(rootDeviceIndex)->getUnderlyingBuffer();
352355
} else {
353356
auto memory = memoryManager->allocateSystemMemory(getSize(), MemoryConstants::pageSize);
354357
setAllocatedMapPtr(memory);

opencl/source/mem_obj/mem_obj.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class MemObj : public BaseObject<_cl_mem> {
7575

7676
void setHostPtrMinSize(size_t size);
7777
void releaseAllocatedMapPtr();
78-
void releaseMapAllocation();
78+
void releaseMapAllocation(uint32_t rootDeviceIndex);
7979

8080
bool isMemObjZeroCopy() const;
8181
bool isMemObjWithHostPtrSVM() const;
@@ -117,13 +117,13 @@ class MemObj : public BaseObject<_cl_mem> {
117117
return memoryManager;
118118
}
119119
void setMapAllocation(GraphicsAllocation *allocation) {
120-
mapAllocation = allocation;
120+
mapAllocations.addAllocation(allocation);
121121
}
122-
GraphicsAllocation *getMapAllocation() const {
122+
GraphicsAllocation *getMapAllocation(uint32_t rootDeviceIndex) const {
123123
if (associatedMemObject) {
124-
return associatedMemObject->getMapAllocation();
124+
return associatedMemObject->getMapAllocation(rootDeviceIndex);
125125
}
126-
return mapAllocation;
126+
return mapAllocations.getGraphicsAllocation(rootDeviceIndex);
127127
}
128128

129129
const cl_mem_flags &getFlags() const { return flags; }
@@ -156,7 +156,7 @@ class MemObj : public BaseObject<_cl_mem> {
156156
MemoryManager *memoryManager = nullptr;
157157
MultiGraphicsAllocation multiGraphicsAllocation;
158158
GraphicsAllocation *mcsAllocation = nullptr;
159-
GraphicsAllocation *mapAllocation = nullptr;
159+
MultiGraphicsAllocation mapAllocations;
160160
std::shared_ptr<SharingHandler> sharingHandler;
161161
std::vector<uint64_t> propertiesVector;
162162

opencl/test/unit_test/command_queue/enqueue_map_image_tests.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ TEST_F(EnqueueMapImageTest, GivenTiledImageWhenMappingImageThenPointerIsReused)
6161
const size_t origin[3] = {0, 0, 0};
6262
const size_t region[3] = {1, 1, 1};
6363

64-
auto mapAllocation = image->getMapAllocation();
64+
auto mapAllocation = image->getMapAllocation(pClDevice->getRootDeviceIndex());
6565
EXPECT_NE(nullptr, mapAllocation);
6666

6767
auto ptr1 = pCmdQ->enqueueMapImage(
@@ -70,7 +70,7 @@ TEST_F(EnqueueMapImageTest, GivenTiledImageWhenMappingImageThenPointerIsReused)
7070
nullptr, nullptr, retVal);
7171
EXPECT_EQ(CL_SUCCESS, retVal);
7272
EXPECT_NE(nullptr, image->getHostPtr());
73-
mapAllocation = image->getMapAllocation();
73+
mapAllocation = image->getMapAllocation(pClDevice->getRootDeviceIndex());
7474
EXPECT_NE(nullptr, mapAllocation);
7575

7676
auto ptr2 = pCmdQ->enqueueMapImage(
@@ -216,7 +216,7 @@ HWTEST_F(EnqueueMapImageTest, givenTiledImageWhenMapImageIsCalledThenStorageIsSe
216216

217217
mockImage.createFunction = image->createFunction;
218218

219-
auto mapAllocation = mockImage.getMapAllocation();
219+
auto mapAllocation = mockImage.getMapAllocation(pClDevice->getRootDeviceIndex());
220220
EXPECT_EQ(nullptr, mapAllocation);
221221
EXPECT_EQ(nullptr, mockImage.getHostPtr());
222222

@@ -232,7 +232,7 @@ HWTEST_F(EnqueueMapImageTest, givenTiledImageWhenMapImageIsCalledThenStorageIsSe
232232

233233
auto mapPtr = mockImage.getAllocatedMapPtr();
234234
EXPECT_EQ(apiMapPtr, mapPtr);
235-
mapAllocation = mockImage.getMapAllocation();
235+
mapAllocation = mockImage.getMapAllocation(pClDevice->getRootDeviceIndex());
236236
EXPECT_NE(nullptr, mapAllocation);
237237
EXPECT_EQ(apiMapPtr, mapAllocation->getUnderlyingBuffer());
238238

@@ -241,7 +241,7 @@ HWTEST_F(EnqueueMapImageTest, givenTiledImageWhenMapImageIsCalledThenStorageIsSe
241241
auto actualMapAllocationTaskCount = mapAllocation->getTaskCount(osContextId);
242242
EXPECT_EQ(expectedTaskCount, actualMapAllocationTaskCount);
243243

244-
pDevice->getMemoryManager()->freeGraphicsMemory(mockImage.getMapAllocation());
244+
pDevice->getMemoryManager()->freeGraphicsMemory(mockImage.getMapAllocation(pClDevice->getRootDeviceIndex()));
245245
mockImage.releaseAllocatedMapPtr();
246246
}
247247

opencl/test/unit_test/command_queue/enqueue_unmap_memobject_tests.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,16 @@ HWTEST_F(EnqueueUnmapMemObjTest, givenMemObjWhenUnmappingThenSetAubWritableBefor
250250
using MockCommandQueue::MockCommandQueue;
251251
cl_int enqueueWriteBuffer(Buffer *buffer, cl_bool blockingWrite, size_t offset, size_t cb, const void *ptr, GraphicsAllocation *mapAllocation,
252252
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) override {
253-
EXPECT_TRUE(buffer->getMapAllocation()->isAubWritable(GraphicsAllocation::defaultBank));
254-
EXPECT_TRUE(buffer->getMapAllocation()->isTbxWritable(GraphicsAllocation::defaultBank));
253+
EXPECT_TRUE(buffer->getMapAllocation(device->getRootDeviceIndex())->isAubWritable(GraphicsAllocation::defaultBank));
254+
EXPECT_TRUE(buffer->getMapAllocation(device->getRootDeviceIndex())->isTbxWritable(GraphicsAllocation::defaultBank));
255255
return CL_SUCCESS;
256256
}
257257

258258
cl_int enqueueWriteImage(Image *dstImage, cl_bool blockingWrite, const size_t *origin, const size_t *region,
259259
size_t inputRowPitch, size_t inputSlicePitch, const void *ptr, GraphicsAllocation *mapAllocation,
260260
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) override {
261-
EXPECT_TRUE(dstImage->getMapAllocation()->isAubWritable(GraphicsAllocation::defaultBank));
262-
EXPECT_TRUE(dstImage->getMapAllocation()->isTbxWritable(GraphicsAllocation::defaultBank));
261+
EXPECT_TRUE(dstImage->getMapAllocation(device->getRootDeviceIndex())->isAubWritable(GraphicsAllocation::defaultBank));
262+
EXPECT_TRUE(dstImage->getMapAllocation(device->getRootDeviceIndex())->isTbxWritable(GraphicsAllocation::defaultBank));
263263
return CL_SUCCESS;
264264
}
265265
};
@@ -269,8 +269,8 @@ HWTEST_F(EnqueueUnmapMemObjTest, givenMemObjWhenUnmappingThenSetAubWritableBefor
269269
{
270270
auto mapPtr = myMockCmdQ.enqueueMapBuffer(buffer.get(), CL_TRUE, CL_MAP_WRITE, 0, 8, 0, nullptr, nullptr, retVal);
271271

272-
buffer->getMapAllocation()->setAubWritable(false, GraphicsAllocation::defaultBank);
273-
buffer->getMapAllocation()->setTbxWritable(false, GraphicsAllocation::defaultBank);
272+
buffer->getMapAllocation(pClDevice->getRootDeviceIndex())->setAubWritable(false, GraphicsAllocation::defaultBank);
273+
buffer->getMapAllocation(pClDevice->getRootDeviceIndex())->setTbxWritable(false, GraphicsAllocation::defaultBank);
274274

275275
myMockCmdQ.enqueueUnmapMemObject(buffer.get(), mapPtr, 0, nullptr, nullptr);
276276
}
@@ -281,8 +281,8 @@ HWTEST_F(EnqueueUnmapMemObjTest, givenMemObjWhenUnmappingThenSetAubWritableBefor
281281
auto mapPtr = myMockCmdQ.enqueueMapImage(image.get(), CL_TRUE, CL_MAP_WRITE, origin, region, nullptr, nullptr, 0,
282282
nullptr, nullptr, retVal);
283283

284-
image->getMapAllocation()->setAubWritable(false, GraphicsAllocation::defaultBank);
285-
image->getMapAllocation()->setTbxWritable(false, GraphicsAllocation::defaultBank);
284+
image->getMapAllocation(pClDevice->getRootDeviceIndex())->setAubWritable(false, GraphicsAllocation::defaultBank);
285+
image->getMapAllocation(pClDevice->getRootDeviceIndex())->setTbxWritable(false, GraphicsAllocation::defaultBank);
286286

287287
myMockCmdQ.enqueueUnmapMemObject(image.get(), mapPtr, 0, nullptr, nullptr);
288288
}

opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenMapAllocationWhenEnqueueingReadOrWriteBu
426426

427427
auto bufferForBlt = clUniquePtr(Buffer::create(bcsMockContext.get(), CL_MEM_USE_HOST_PTR, 1, hostPtr, retVal));
428428
bufferForBlt->forceDisallowCPUCopy = true;
429-
auto mapAllocation = bufferForBlt->getMapAllocation();
429+
auto mapAllocation = bufferForBlt->getMapAllocation(device->getRootDeviceIndex());
430430
EXPECT_NE(nullptr, mapAllocation);
431431

432432
mockCmdQ->kernelParams.transferAllocation = nullptr;

opencl/test/unit_test/mem_obj/buffer_tests.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ TEST(Buffer, givenHostPtrPassedToBufferCreateWhenMemUseHostPtrFlagisSetAndBuffer
280280
std::unique_ptr<Buffer> buffer(Buffer::create(&ctx, flags, MemoryConstants::pageSize, offsetedPtr, retVal));
281281
ASSERT_NE(nullptr, buffer.get());
282282

283-
auto mapAllocation = buffer->getMapAllocation();
283+
auto mapAllocation = buffer->getMapAllocation(device.get()->getRootDeviceIndex());
284284
EXPECT_NE(nullptr, mapAllocation);
285285
EXPECT_EQ(offsetedPtr, mapAllocation->getUnderlyingBuffer());
286286
EXPECT_EQ(GraphicsAllocation::AllocationType::MAP_ALLOCATION, mapAllocation->getAllocationType());
@@ -606,6 +606,7 @@ TEST_F(RenderCompressedBuffersSvmTests, givenSvmAllocationWhenCreatingBufferThen
606606
buffer.reset(Buffer::create(context.get(), CL_MEM_USE_HOST_PTR, sizeof(uint32_t), svmPtr, retVal));
607607
EXPECT_EQ(expectedAllocationType, buffer->getGraphicsAllocation(device->getRootDeviceIndex())->getAllocationType());
608608

609+
buffer.reset(nullptr);
609610
context->getSVMAllocsManager()->freeSVMAlloc(svmPtr);
610611
}
611612

@@ -654,7 +655,7 @@ TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenBufferCreateWhenMemoryTr
654655
static_cast<MockMemoryManager *>(context->memoryManager)->forceRenderCompressed = true;
655656
std::unique_ptr<Buffer> buffer(Buffer::create(context.get(), flags, bufferSize, hostPtr, retVal));
656657
EXPECT_NE(nullptr, mockCmdQ->writeMapAllocation);
657-
EXPECT_EQ(buffer->getMapAllocation(), mockCmdQ->writeMapAllocation);
658+
EXPECT_EQ(buffer->getMapAllocation(device.get()->getRootDeviceIndex()), mockCmdQ->writeMapAllocation);
658659
}
659660

660661
TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenNonRenderCompressedBufferWhenCopyFromHostPtrIsRequiredThenDontCallWriteBuffer) {
@@ -1019,8 +1020,8 @@ TEST_P(ValidHostPtr, SvmHostPtr) {
10191020
EXPECT_EQ(svmData->gpuAllocations.getGraphicsAllocation(pDevice->getRootDeviceIndex()), bufferSvm->getGraphicsAllocation(pDevice->getRootDeviceIndex()));
10201021
EXPECT_EQ(CL_SUCCESS, retVal);
10211022

1022-
context->getSVMAllocsManager()->freeSVMAlloc(ptr);
10231023
delete bufferSvm;
1024+
context->getSVMAllocsManager()->freeSVMAlloc(ptr);
10241025
}
10251026
}
10261027

opencl/test/unit_test/mem_obj/image_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ TEST(TestCreateImageUseHostPtr, givenZeroCopyImageValuesWhenUsingHostPtrThenZero
648648
EXPECT_EQ(CL_SUCCESS, retVal);
649649
EXPECT_TRUE(image->isMemObjZeroCopy());
650650
EXPECT_EQ(hostPtr, allocation->getUnderlyingBuffer());
651-
EXPECT_NE(nullptr, image->getMapAllocation());
651+
EXPECT_NE(nullptr, image->getMapAllocation(context.getDevice(0)->getRootDeviceIndex()));
652652

653653
alignedFree(hostPtr);
654654
}

0 commit comments

Comments
 (0)