mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
[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:

committed by
sys_ocldev

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"),
|
||||
@ -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());
|
||||
|
Reference in New Issue
Block a user