Files
compute-runtime/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.cpp
Mateusz Jablonski b182917d9d refactor: correct naming of allocation types
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2023-12-11 16:23:37 +01:00

34 lines
1.5 KiB
C++

/*
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/test/common/mocks/mock_allocation_properties.h"
namespace NEO {
GraphicsAllocation *AUBFixture::createHostPtrAllocationFromSvmPtr(void *svmPtr, size_t size) {
GraphicsAllocation *allocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), false, size}, svmPtr);
csr->makeResidentHostPtrAllocation(allocation);
csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), TEMPORARY_ALLOCATION);
allocation->setAllocationType(AllocationType::buffer);
allocation->setMemObjectsAllocationWithWritableFlags(true);
return allocation;
}
GraphicsAllocation *AUBFixture::createResidentAllocationAndStoreItInCsr(const void *address, size_t size) {
GraphicsAllocation *allocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), false, size}, address);
csr->makeResidentHostPtrAllocation(allocation);
csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), TEMPORARY_ALLOCATION);
return allocation;
}
} // namespace NEO