Add enableLocalMemory param to DrmMemoryManager ctor

- add linux dll tests for createMemoryManager()

Change-Id: I6e111e7a480d895a8520507af6b6a699f9dca160
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2019-03-11 23:06:30 +01:00
parent 891f5c6177
commit 573d2e0eec
10 changed files with 204 additions and 62 deletions

View File

@@ -5,12 +5,16 @@
*
*/
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/basic_math.h"
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/os_interface/linux/allocator_helper.h"
#include "runtime/os_interface/linux/os_interface.h"
#include "test.h"
#include "unit_tests/custom_event_listener.h"
#include "unit_tests/helpers/debug_manager_state_restore.h"
#include "unit_tests/os_interface/linux/device_command_stream_fixture.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
@@ -332,6 +336,29 @@ TEST(AllocatorHelper, givenExpectedSizeToMapWhenGetSizetoMapCalledThenExpectedVa
EXPECT_EQ((alignUp(4 * GB - 8096, 4096)), OCLRT::getSizeToMap());
}
TEST(DrmMemoryManagerCreate, givenLocalMemoryEnabledWhenMemoryManagerIsCreatedThenLocalMemoryEnabledIsTrue) {
DrmMockSuccess mock;
ExecutionEnvironment executionEnvironment;
executionEnvironment.osInterface = std::make_unique<OSInterface>();
executionEnvironment.osInterface->get()->setDrm(&mock);
auto drmMemoryManager = MemoryManager::createMemoryManager(false, true, executionEnvironment);
EXPECT_TRUE(drmMemoryManager->isLocalMemorySupported());
executionEnvironment.memoryManager = std::move(drmMemoryManager);
}
TEST(DrmMemoryManagerCreate, givenLocalMemoryDisabledWhenMemoryManagerIsCreatedThenLocalMemoryEnabledIsFalse) {
DrmMockSuccess mock;
ExecutionEnvironment executionEnvironment;
executionEnvironment.osInterface = std::make_unique<OSInterface>();
executionEnvironment.osInterface->get()->setDrm(&mock);
auto drmMemoryManager = MemoryManager::createMemoryManager(false, false, executionEnvironment);
EXPECT_FALSE(drmMemoryManager->isLocalMemorySupported());
executionEnvironment.memoryManager = std::move(drmMemoryManager);
}
int main(int argc, char **argv) {
bool useDefaultListener = false;