mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
[16/n] Internal 4GB allocator.
- Make sure that kernel allocation is deleted asynchronously. Change-Id: Ia98ae9fdbd56c7de82f92d62e0395ef181ebceef
This commit is contained in:
committed by
sys_ocldev
parent
dede44f0dd
commit
bd0362990b
@@ -413,7 +413,7 @@ void Program::freeBlockResources() {
|
||||
void Program::cleanCurrentKernelInfo() {
|
||||
for (auto &kernelInfo : kernelInfoArray) {
|
||||
if (kernelInfo->kernelAllocation) {
|
||||
this->pDevice->getMemoryManager()->freeGraphicsMemory(kernelInfo->kernelAllocation);
|
||||
this->pDevice->getMemoryManager()->checkGpuUsageAndDestroyGraphicsAllocations(kernelInfo->kernelAllocation);
|
||||
}
|
||||
delete kernelInfo;
|
||||
}
|
||||
|
||||
@@ -627,6 +627,19 @@ TEST_P(ProgramFromBinaryTest, givenProgramWhenCleanKernelInfoIsCalledThenKernelA
|
||||
EXPECT_EQ(0u, pProgram->getNumKernels());
|
||||
}
|
||||
|
||||
TEST_P(ProgramFromBinaryTest, givenProgramWhenCleanCurrentKernelInfoIsCalledButGpuIsNotYetDoneThenKernelAllocationIsPutOnDefferedFreeList) {
|
||||
cl_device_id device = pDevice;
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
EXPECT_TRUE(memoryManager->graphicsAllocations.peekIsEmpty());
|
||||
pProgram->build(1, &device, nullptr, nullptr, nullptr, true);
|
||||
auto kernelAllocation = pProgram->getKernelInfo(size_t(0))->getGraphicsAllocation();
|
||||
kernelAllocation->taskCount = 100;
|
||||
*pDevice->getTagAddress() = 0;
|
||||
pProgram->cleanCurrentKernelInfo();
|
||||
EXPECT_FALSE(memoryManager->graphicsAllocations.peekIsEmpty());
|
||||
EXPECT_EQ(memoryManager->graphicsAllocations.peekHead(), kernelAllocation);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Program::Build (source)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user