mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
[1/n] Unified Shared Memory
- Add Internal Allocation type to differentiate SVM allocs from UM allocs. - Add API to make internal allocations resident. - Add API to allocate UM. Related-To: NEO-3148 Change-Id: I9787891c5a0ffccac45c43bc5fde4ea50f37d703 Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
145f5b20e9
commit
4188f6dce8
@@ -19,6 +19,7 @@
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/helpers/hw_parse.h"
|
||||
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
||||
#include "unit_tests/mocks/mock_command_queue.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
#include "unit_tests/mocks/mock_kernel.h"
|
||||
@@ -1051,6 +1052,30 @@ struct FailCsr : public CommandStreamReceiverHw<GfxFamily> {
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreMadeResidentThenOnlyNonSvmAllocationsAreAdded) {
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties;
|
||||
unifiedMemoryProperties.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY;
|
||||
auto allocationSize = 4096u;
|
||||
auto svmManager = this->context->getSVMAllocsManager();
|
||||
EXPECT_NE(0u, svmManager->getNumAllocs());
|
||||
auto unifiedMemoryPtr = svmManager->createUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties);
|
||||
EXPECT_NE(nullptr, unifiedMemoryPtr);
|
||||
EXPECT_EQ(2u, svmManager->getNumAllocs());
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto &residentAllocations = commandStreamReceiver.getResidencyAllocations();
|
||||
EXPECT_EQ(0u, residentAllocations.size());
|
||||
|
||||
svmManager->makeInternalAllocationsResident(commandStreamReceiver);
|
||||
|
||||
//only unified memory allocation is made resident
|
||||
EXPECT_EQ(1u, residentAllocations.size());
|
||||
EXPECT_EQ(residentAllocations[0]->getGpuAddress(), castToUint64(unifiedMemoryPtr));
|
||||
|
||||
svmManager->freeSVMAlloc(unifiedMemoryPtr);
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueSvmTest, GivenDstHostPtrWhenHostPtrAllocationCreationFailsThenReturnOutOfResource) {
|
||||
char dstHostPtr[260];
|
||||
void *pDstSVM = dstHostPtr;
|
||||
|
||||
Reference in New Issue
Block a user