mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 10:26:29 +08:00
Move memory properties helper tests from opencl to shared project
Related-To: NEO-7092 Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
88ed486f6b
commit
3a58579bbe
@@ -10,6 +10,7 @@ set(IGDRCL_SRCS_tests_helpers
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/base_object_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/base_object_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_helper_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/cl_helper_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_parse.h
|
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_parse.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cl_memory_properties_helpers_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_info_builder_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_info_builder_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_info_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_info_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/get_info_status_mapper_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/get_info_status_mapper_tests.cpp
|
||||||
@@ -17,7 +18,6 @@ set(IGDRCL_SRCS_tests_helpers
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware_commands_helper_tests.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware_commands_helper_tests.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/heap_assigner_ocl_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/heap_assigner_ocl_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers_tests.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mipmap_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/mipmap_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/queue_helpers_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/queue_helpers_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/sampler_helpers_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/sampler_helpers_tests.cpp
|
||||||
|
|||||||
@@ -557,43 +557,3 @@ TEST_F(MemoryPropertiesHelperTests, givenSubDeviceIdWhenParsingExtraMemoryProper
|
|||||||
EXPECT_EQ(0b10u, memoryProperties.pDevice->getDeviceBitfield().to_ulong());
|
EXPECT_EQ(0b10u, memoryProperties.pDevice->getDeviceBitfield().to_ulong());
|
||||||
EXPECT_EQ(&context.pSubDevice1->getDevice(), memoryProperties.pDevice);
|
EXPECT_EQ(&context.pSubDevice1->getDevice(), memoryProperties.pDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MemoryPropertiesHelperTests, whenQueryingUseSystemMemoryForCrossRootDeviceAccessThenReturnTrueForMultiRootDeviceContexts) {
|
|
||||||
for (auto multiRootDevice : {false, true}) {
|
|
||||||
EXPECT_EQ(multiRootDevice, MemoryPropertiesHelper::useSystemMemoryForCrossRootDeviceAccess(multiRootDevice));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MemoryPropertiesHelperTests, givenAllocateBuffersInLocalMemoryForMultiRootDeviceContextsWhenQueryingUseSystemMemoryForCrossRootDeviceAccessThenReturnFalseForMultiRootDeviceContexts) {
|
|
||||||
DebugManagerStateRestore restore;
|
|
||||||
|
|
||||||
for (auto localMemory : {false, true}) {
|
|
||||||
DebugManager.flags.AllocateBuffersInLocalMemoryForMultiRootDeviceContexts.set(localMemory);
|
|
||||||
EXPECT_FALSE(MemoryPropertiesHelper::useSystemMemoryForCrossRootDeviceAccess(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto localMemory : {false, true}) {
|
|
||||||
DebugManager.flags.AllocateBuffersInLocalMemoryForMultiRootDeviceContexts.set(localMemory);
|
|
||||||
EXPECT_NE(localMemory, MemoryPropertiesHelper::useSystemMemoryForCrossRootDeviceAccess(true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MemoryPropertiesHelperTests, whenQueryingUseMultiStorageForCrossRootDeviceAccessThenReturnFalseForMultiRootDeviceContexts) {
|
|
||||||
for (auto multiRootDevice : {false, true}) {
|
|
||||||
EXPECT_FALSE(MemoryPropertiesHelper::useMultiStorageForCrossRootDeviceAccess(multiRootDevice));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MemoryPropertiesHelperTests, givenAllocateBuffersInLocalMemoryForMultiRootDeviceContextsWhenQueryingUseMultiStorageForCrossRootDeviceAccessThenReturnTrueForMultiRootDeviceContexts) {
|
|
||||||
DebugManagerStateRestore restore;
|
|
||||||
|
|
||||||
for (auto localMemory : {false, true}) {
|
|
||||||
DebugManager.flags.AllocateBuffersInLocalMemoryForMultiRootDeviceContexts.set(localMemory);
|
|
||||||
EXPECT_FALSE(MemoryPropertiesHelper::useMultiStorageForCrossRootDeviceAccess(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto localMemory : {false, true}) {
|
|
||||||
DebugManager.flags.AllocateBuffersInLocalMemoryForMultiRootDeviceContexts.set(localMemory);
|
|
||||||
EXPECT_EQ(localMemory, MemoryPropertiesHelper::useMultiStorageForCrossRootDeviceAccess(true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -37,6 +37,7 @@ target_sources(neo_shared_tests PRIVATE
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel_helpers_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/kernel_helpers_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/matcher_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/matcher_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_management_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/memory_management_tests.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ptr_math_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/ptr_math_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ray_tracing_helper_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/ray_tracing_helper_tests.cpp
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/source/helpers/memory_properties_helpers.h"
|
||||||
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
using namespace NEO;
|
||||||
|
|
||||||
|
TEST(MemoryPropertiesHelperTests, whenQueryingUseSystemMemoryForCrossRootDeviceAccessThenReturnTrueForMultiRootDeviceContexts) {
|
||||||
|
for (auto multiRootDevice : {false, true}) {
|
||||||
|
EXPECT_EQ(multiRootDevice, MemoryPropertiesHelper::useSystemMemoryForCrossRootDeviceAccess(multiRootDevice));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(MemoryPropertiesHelperTests, givenAllocateBuffersInLocalMemoryForMultiRootDeviceContextsWhenQueryingUseSystemMemoryForCrossRootDeviceAccessThenReturnFalseForMultiRootDeviceContexts) {
|
||||||
|
DebugManagerStateRestore restore;
|
||||||
|
|
||||||
|
for (auto localMemory : {false, true}) {
|
||||||
|
DebugManager.flags.AllocateBuffersInLocalMemoryForMultiRootDeviceContexts.set(localMemory);
|
||||||
|
EXPECT_FALSE(MemoryPropertiesHelper::useSystemMemoryForCrossRootDeviceAccess(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto localMemory : {false, true}) {
|
||||||
|
DebugManager.flags.AllocateBuffersInLocalMemoryForMultiRootDeviceContexts.set(localMemory);
|
||||||
|
EXPECT_NE(localMemory, MemoryPropertiesHelper::useSystemMemoryForCrossRootDeviceAccess(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(MemoryPropertiesHelperTests, whenQueryingUseMultiStorageForCrossRootDeviceAccessThenReturnFalseForMultiRootDeviceContexts) {
|
||||||
|
for (auto multiRootDevice : {false, true}) {
|
||||||
|
EXPECT_FALSE(MemoryPropertiesHelper::useMultiStorageForCrossRootDeviceAccess(multiRootDevice));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(MemoryPropertiesHelperTests, givenAllocateBuffersInLocalMemoryForMultiRootDeviceContextsWhenQueryingUseMultiStorageForCrossRootDeviceAccessThenReturnTrueForMultiRootDeviceContexts) {
|
||||||
|
DebugManagerStateRestore restore;
|
||||||
|
|
||||||
|
for (auto localMemory : {false, true}) {
|
||||||
|
DebugManager.flags.AllocateBuffersInLocalMemoryForMultiRootDeviceContexts.set(localMemory);
|
||||||
|
EXPECT_FALSE(MemoryPropertiesHelper::useMultiStorageForCrossRootDeviceAccess(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto localMemory : {false, true}) {
|
||||||
|
DebugManager.flags.AllocateBuffersInLocalMemoryForMultiRootDeviceContexts.set(localMemory);
|
||||||
|
EXPECT_EQ(localMemory, MemoryPropertiesHelper::useMultiStorageForCrossRootDeviceAccess(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user