[25/n] Internal 4GB allocator.
- Do not obtain pattern allocation from reusable pool. - This is due to the fact that it may contain allocations from internal heap, which cannot be used for arguments declared as kernel argument. Change-Id: I6c73445c409edc4ce25f8d8eba966f512dfd6cc9
This commit is contained in:
parent
9700c9bc42
commit
e4c25f11de
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -45,14 +45,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillBuffer(
|
|||
cl_event *event) {
|
||||
auto memoryManager = getDevice().getMemoryManager();
|
||||
DEBUG_BREAK_IF(nullptr == memoryManager);
|
||||
TakeOwnershipWrapper<Device> deviceOwnership(getDevice());
|
||||
auto patternAllocation = memoryManager->obtainReusableAllocation(patternSize).release();
|
||||
deviceOwnership.unlock();
|
||||
|
||||
if (!patternAllocation) {
|
||||
patternAllocation = memoryManager->allocateGraphicsMemory(alignUp(patternSize, MemoryConstants::cacheLineSize), MemoryConstants::preferredAlignment);
|
||||
}
|
||||
|
||||
auto patternAllocation = memoryManager->allocateGraphicsMemory(alignUp(patternSize, MemoryConstants::cacheLineSize), MemoryConstants::preferredAlignment);
|
||||
patternAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_FILL_PATTERN);
|
||||
|
||||
if (patternSize == 1) {
|
||||
|
@ -93,7 +87,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillBuffer(
|
|||
eventWaitList,
|
||||
event);
|
||||
|
||||
memoryManager->storeAllocation(std::unique_ptr<GraphicsAllocation>(patternAllocation), REUSABLE_ALLOCATION, taskCount);
|
||||
memoryManager->storeAllocation(std::unique_ptr<GraphicsAllocation>(patternAllocation), TEMPORARY_ALLOCATION, taskCount);
|
||||
|
||||
builder.releaseOwnership();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -409,10 +409,10 @@ HWTEST_F(EnqueueFillBufferCmdTests, argumentTwoShouldMatchPatternPtr) {
|
|||
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeCopied) {
|
||||
MemoryManager *mmgr = pCmdQ->getDevice().getMemoryManager();
|
||||
ASSERT_TRUE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_TRUE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
enqueueFillBuffer<FamilyType>();
|
||||
ASSERT_FALSE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
GraphicsAllocation *allocation = mmgr->allocationsForReuse.peekHead();
|
||||
ASSERT_FALSE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
GraphicsAllocation *allocation = mmgr->graphicsAllocations.peekHead();
|
||||
|
||||
while (allocation != nullptr) {
|
||||
if ((allocation->getUnderlyingBufferSize() >= sizeof(float)) &&
|
||||
|
@ -430,10 +430,10 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeCopied) {
|
|||
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeAligned) {
|
||||
MemoryManager *mmgr = pCmdQ->getDevice().getMemoryManager();
|
||||
ASSERT_TRUE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_TRUE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
enqueueFillBuffer<FamilyType>();
|
||||
ASSERT_FALSE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
GraphicsAllocation *allocation = mmgr->allocationsForReuse.peekHead();
|
||||
ASSERT_FALSE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
GraphicsAllocation *allocation = mmgr->graphicsAllocations.peekHead();
|
||||
|
||||
while (allocation != nullptr) {
|
||||
if ((allocation->getUnderlyingBufferSize() >= sizeof(float)) &&
|
||||
|
@ -453,6 +453,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeAligned) {
|
|||
HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeOneByteShouldGetPreparedForMiddleKernel) {
|
||||
MemoryManager *mmgr = pCmdQ->getDevice().getMemoryManager();
|
||||
ASSERT_TRUE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_TRUE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
|
||||
auto dstBuffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
|
||||
const uint8_t pattern[1] = {0x55};
|
||||
|
@ -473,9 +474,10 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeOneByteShouldGetPreparedForMidd
|
|||
nullptr);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
ASSERT_FALSE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_TRUE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_FALSE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
|
||||
GraphicsAllocation *allocation = mmgr->allocationsForReuse.peekHead();
|
||||
GraphicsAllocation *allocation = mmgr->graphicsAllocations.peekHead();
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
EXPECT_EQ(0, memcmp(allocation->getUnderlyingBuffer(), output, size));
|
||||
|
@ -484,6 +486,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeOneByteShouldGetPreparedForMidd
|
|||
HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeTwoBytesShouldGetPreparedForMiddleKernel) {
|
||||
MemoryManager *mmgr = pCmdQ->getDevice().getMemoryManager();
|
||||
ASSERT_TRUE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_TRUE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
|
||||
auto dstBuffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
|
||||
const uint8_t pattern[2] = {0x55, 0xAA};
|
||||
|
@ -504,9 +507,10 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeTwoBytesShouldGetPreparedForMid
|
|||
nullptr);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
ASSERT_FALSE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_TRUE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_FALSE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
|
||||
GraphicsAllocation *allocation = mmgr->allocationsForReuse.peekHead();
|
||||
GraphicsAllocation *allocation = mmgr->graphicsAllocations.peekHead();
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
EXPECT_EQ(0, memcmp(allocation->getUnderlyingBuffer(), output, size));
|
||||
|
@ -514,7 +518,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeTwoBytesShouldGetPreparedForMid
|
|||
|
||||
HWTEST_F(EnqueueFillBufferCmdTests, givenEnqueueFillBufferWhenPatternAllocationIsObtainedThenItsTypeShouldBeSetToFillPattern) {
|
||||
MemoryManager *mmgr = pCmdQ->getDevice().getMemoryManager();
|
||||
ASSERT_TRUE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_TRUE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
|
||||
auto dstBuffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
|
||||
const uint8_t pattern[1] = {0x55};
|
||||
|
@ -534,9 +538,9 @@ HWTEST_F(EnqueueFillBufferCmdTests, givenEnqueueFillBufferWhenPatternAllocationI
|
|||
nullptr);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
ASSERT_FALSE(mmgr->allocationsForReuse.peekIsEmpty());
|
||||
ASSERT_FALSE(mmgr->graphicsAllocations.peekIsEmpty());
|
||||
|
||||
GraphicsAllocation *patternAllocation = mmgr->allocationsForReuse.peekHead();
|
||||
GraphicsAllocation *patternAllocation = mmgr->graphicsAllocations.peekHead();
|
||||
ASSERT_NE(nullptr, patternAllocation);
|
||||
|
||||
EXPECT_EQ(GraphicsAllocation::ALLOCATION_TYPE_FILL_PATTERN, patternAllocation->getAllocationType());
|
||||
|
|
Loading…
Reference in New Issue