mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Fix allocating small buffers from pool
Wait for engine completion before freeing from pool Related-To: NEO-7332 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
d9d706d747
commit
0cea7fe6d1
@ -115,6 +115,25 @@ TEST_F(aggregatedSmallBuffersEnabledTest, givenAggregatedSmallBuffersEnabledAndS
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
}
|
||||
|
||||
TEST_F(aggregatedSmallBuffersEnabledTest, givenAggregatedSmallBuffersEnabledWhenClReleaseMemObjectCalledThenWaitForEnginesCompletionCalled) {
|
||||
ASSERT_TRUE(poolAllocator->isAggregatedSmallBuffersEnabled());
|
||||
ASSERT_NE(poolAllocator->mainStorage, nullptr);
|
||||
std::unique_ptr<Buffer> buffer(Buffer::create(context.get(), flags, size, hostPtr, retVal));
|
||||
|
||||
ASSERT_NE(buffer, nullptr);
|
||||
ASSERT_EQ(retVal, CL_SUCCESS);
|
||||
|
||||
ASSERT_NE(poolAllocator->mainStorage, nullptr);
|
||||
auto mockBuffer = static_cast<MockBuffer *>(buffer.get());
|
||||
ASSERT_TRUE(mockBuffer->isSubBuffer());
|
||||
ASSERT_EQ(poolAllocator->mainStorage, mockBuffer->associatedMemObject);
|
||||
|
||||
ASSERT_EQ(mockMemoryManager->waitForEnginesCompletionCalled, 0u);
|
||||
retVal = clReleaseMemObject(buffer.release());
|
||||
ASSERT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_EQ(mockMemoryManager->waitForEnginesCompletionCalled, 1u);
|
||||
}
|
||||
|
||||
TEST_F(aggregatedSmallBuffersEnabledTest, givenCopyHostPointerWhenCreatingBufferButCopyFailedThenDoNotUsePool) {
|
||||
class MockCommandQueueFailFirstEnqueueWrite : public MockCommandQueue {
|
||||
public:
|
||||
|
Reference in New Issue
Block a user