Remove device helper

Change-Id: Ie66c029359a62b81c8658d804dcf8565647100f1
This commit is contained in:
Mateusz Jablonski
2018-07-25 17:12:44 +02:00
committed by sys_ocldev
parent 282f335269
commit 98061903aa
37 changed files with 145 additions and 169 deletions

View File

@@ -26,6 +26,7 @@
using OCLRT::AUBCommandStreamReceiver; using OCLRT::AUBCommandStreamReceiver;
using OCLRT::AUBCommandStreamReceiverHw; using OCLRT::AUBCommandStreamReceiverHw;
using OCLRT::AUBFamilyMapper; using OCLRT::AUBFamilyMapper;
using OCLRT::DeviceFixture;
using OCLRT::EngineType; using OCLRT::EngineType;
using OCLRT::folderAUB; using OCLRT::folderAUB;

View File

@@ -23,7 +23,7 @@
#include "aub_batch_buffer_tests_gen10.h" #include "aub_batch_buffer_tests_gen10.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
typedef Test<DeviceFixture> Gen10AubBatchBufferTests; using Gen10AubBatchBufferTests = Test<OCLRT::DeviceFixture>;
static constexpr auto gpuBatchBufferAddr = 0x800400001000; // 48-bit GPU address static constexpr auto gpuBatchBufferAddr = 0x800400001000; // 48-bit GPU address

View File

@@ -23,7 +23,7 @@
#include "aub_batch_buffer_tests.h" #include "aub_batch_buffer_tests.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
typedef Test<DeviceFixture> AubBatchBufferTests; using AubBatchBufferTests = Test<OCLRT::DeviceFixture>;
static constexpr auto gpuBatchBufferAddr = 0x800400001000ull; // 48-bit GPU address static constexpr auto gpuBatchBufferAddr = 0x800400001000ull; // 48-bit GPU address

View File

@@ -1035,7 +1035,7 @@ HWTEST_F(CommandQueueHwTest, givenReadOnlyHostPointerWhenAllocationForHostSurfac
::testing::NiceMock<GMockMemoryManager> *gmockMemoryManager = new ::testing::NiceMock<GMockMemoryManager>; ::testing::NiceMock<GMockMemoryManager> *gmockMemoryManager = new ::testing::NiceMock<GMockMemoryManager>;
ASSERT_NE(nullptr, gmockMemoryManager); ASSERT_NE(nullptr, gmockMemoryManager);
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
ASSERT_NE(nullptr, device.get()); ASSERT_NE(nullptr, device.get());
device->injectMemoryManager(gmockMemoryManager); device->injectMemoryManager(gmockMemoryManager);
MockContext *mockContext = new MockContext(device.get()); MockContext *mockContext = new MockContext(device.get());
@@ -1068,7 +1068,7 @@ HWTEST_F(CommandQueueHwTest, givenReadOnlyHostPointerWhenAllocationForHostSurfac
::testing::NiceMock<GMockMemoryManager> *gmockMemoryManager = new ::testing::NiceMock<GMockMemoryManager>; ::testing::NiceMock<GMockMemoryManager> *gmockMemoryManager = new ::testing::NiceMock<GMockMemoryManager>;
ASSERT_NE(nullptr, gmockMemoryManager); ASSERT_NE(nullptr, gmockMemoryManager);
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
ASSERT_NE(nullptr, device.get()); ASSERT_NE(nullptr, device.get());
device->injectMemoryManager(gmockMemoryManager); device->injectMemoryManager(gmockMemoryManager);
MockContext *mockContext = new MockContext(device.get()); MockContext *mockContext = new MockContext(device.get());

View File

@@ -227,7 +227,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, cpuCopyCriteriaMet) {
auto smallBufferPtr = alignedMalloc(1 * MB, MemoryConstants::cacheLineSize); auto smallBufferPtr = alignedMalloc(1 * MB, MemoryConstants::cacheLineSize);
auto largeBufferPtr = alignedMalloc(100 * MB, MemoryConstants::cacheLineSize); auto largeBufferPtr = alignedMalloc(100 * MB, MemoryConstants::cacheLineSize);
auto mockDevice = std::unique_ptr<MockDevice>(DeviceHelper<>::create()); auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockContext = std::unique_ptr<MockContext>(new MockContext(mockDevice.get())); auto mockContext = std::unique_ptr<MockContext>(new MockContext(mockDevice.get()));
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_USE_HOST_PTR, size, alignedBufferPtr, retVal)); std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_USE_HOST_PTR, size, alignedBufferPtr, retVal));
@@ -276,7 +276,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, cpuCopyCriteriaNotMet) {
auto unalignedHostPtr = ptrOffset(alignedHostPtr, 1); auto unalignedHostPtr = ptrOffset(alignedHostPtr, 1);
auto largeBufferPtr = alignedMalloc(100 * MB, MemoryConstants::cacheLineSize); auto largeBufferPtr = alignedMalloc(100 * MB, MemoryConstants::cacheLineSize);
auto mockDevice = std::unique_ptr<MockDevice>(DeviceHelper<>::create()); auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockContext = std::unique_ptr<MockContext>(new MockContext(mockDevice.get())); auto mockContext = std::unique_ptr<MockContext>(new MockContext(mockDevice.get()));
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_USE_HOST_PTR, size, alignedBufferPtr, retVal)); std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_USE_HOST_PTR, size, alignedBufferPtr, retVal));

View File

@@ -31,7 +31,7 @@ using namespace OCLRT;
TEST(ContextMultiDevice, singleDevice) { TEST(ContextMultiDevice, singleDevice) {
cl_device_id devices[] = { cl_device_id devices[] = {
DeviceHelper<>::create()}; MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)};
auto numDevices = ARRAY_COUNT(devices); auto numDevices = ARRAY_COUNT(devices);
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
@@ -60,14 +60,14 @@ TEST(ContextMultiDevice, singleDevice) {
TEST(ContextMultiDevice, eightDevices) { TEST(ContextMultiDevice, eightDevices) {
cl_device_id devices[] = { cl_device_id devices[] = {
DeviceHelper<>::create(), MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr),
DeviceHelper<>::create(), MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr),
DeviceHelper<>::create(), MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr),
DeviceHelper<>::create(), MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr),
DeviceHelper<>::create(), MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr),
DeviceHelper<>::create(), MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr),
DeviceHelper<>::create(), MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr),
DeviceHelper<>::create()}; MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)};
auto numDevices = ARRAY_COUNT(devices); auto numDevices = ARRAY_COUNT(devices);
ASSERT_EQ(8u, numDevices); ASSERT_EQ(8u, numDevices);

View File

@@ -36,7 +36,7 @@ using namespace OCLRT;
typedef Test<MemoryManagementFixture> ContextFailureInjection; typedef Test<MemoryManagementFixture> ContextFailureInjection;
TEST_F(ContextFailureInjection, failedAllocationInjection) { TEST_F(ContextFailureInjection, failedAllocationInjection) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create()); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
cl_device_id deviceID = device.get(); cl_device_id deviceID = device.get();
InjectedFunction method = [deviceID](size_t failureIndex) { InjectedFunction method = [deviceID](size_t failureIndex) {
@@ -59,7 +59,7 @@ TEST_F(ContextFailureInjection, failedAllocationInjection) {
} }
TEST(InvalidPropertyContextTest, GivenInvalidPropertiesWhenContextIsCreatedThenErrorIsReturned) { TEST(InvalidPropertyContextTest, GivenInvalidPropertiesWhenContextIsCreatedThenErrorIsReturned) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create()); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
cl_device_id deviceID = device.get(); cl_device_id deviceID = device.get();
auto pPlatform = OCLRT::platform(); auto pPlatform = OCLRT::platform();
cl_platform_id pid[1]; cl_platform_id pid[1];

View File

@@ -76,7 +76,7 @@ TEST_F(DeviceGetCapsF, GivenDeviceCapsWhenQueryingForSLMWindowStartAddressThenPo
} }
TEST(Device_GetCaps, validate) { TEST(Device_GetCaps, validate) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
const auto &sysInfo = *platformDevices[0]->pSysInfo; const auto &sysInfo = *platformDevices[0]->pSysInfo;
@@ -199,7 +199,7 @@ TEST(Device_GetCaps, validate) {
} }
TEST(Device_GetCaps, validateImage3DDimensions) { TEST(Device_GetCaps, validateImage3DDimensions) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
if (device->getHardwareInfo().pPlatform->eRenderCoreFamily > IGFX_GEN8_CORE) { if (device->getHardwareInfo().pPlatform->eRenderCoreFamily > IGFX_GEN8_CORE) {
@@ -217,7 +217,7 @@ TEST(Device_GetCaps, givenDontForcePreemptionModeDebugVariableWhenCreateDeviceTh
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
{ {
DebugManager.flags.ForcePreemptionMode.set(-1); DebugManager.flags.ForcePreemptionMode.set(-1);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
EXPECT_TRUE(device->getHardwareInfo().capabilityTable.defaultPreemptionMode == EXPECT_TRUE(device->getHardwareInfo().capabilityTable.defaultPreemptionMode ==
device->getPreemptionMode()); device->getPreemptionMode());
} }
@@ -232,7 +232,7 @@ TEST(Device_GetCaps, givenForcePreemptionModeDebugVariableWhenCreateDeviceThenSe
forceMode = PreemptionMode::ThreadGroup; forceMode = PreemptionMode::ThreadGroup;
} }
DebugManager.flags.ForcePreemptionMode.set((int32_t)forceMode); DebugManager.flags.ForcePreemptionMode.set((int32_t)forceMode);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
EXPECT_TRUE(forceMode == device->getPreemptionMode()); EXPECT_TRUE(forceMode == device->getPreemptionMode());
} }
@@ -250,7 +250,7 @@ TEST(Device_GetCaps, givenDeviceWithMidThreadPreemptionWhenDeviceIsCreatedThenSi
EXPECT_FALSE(mockBuiltins->getSipKernelCalled); EXPECT_FALSE(mockBuiltins->getSipKernelCalled);
DebugManager.flags.ForcePreemptionMode.set((int32_t)PreemptionMode::MidThread); DebugManager.flags.ForcePreemptionMode.set((int32_t)PreemptionMode::MidThread);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
EXPECT_TRUE(mockBuiltins->getSipKernelCalled); EXPECT_TRUE(mockBuiltins->getSipKernelCalled);
mockBuiltins->restoreGlobalBuiltins(); mockBuiltins->restoreGlobalBuiltins();
//make sure to release builtins prior to device as they use device //make sure to release builtins prior to device as they use device
@@ -262,7 +262,7 @@ TEST(Device_GetCaps, givenForceOclVersion21WhenCapsAreCreatedThenDeviceReportsOp
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
{ {
DebugManager.flags.ForceOCLVersion.set(21); DebugManager.flags.ForceOCLVersion.set(21);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_STREQ("OpenCL 2.1 NEO ", caps.clVersion); EXPECT_STREQ("OpenCL 2.1 NEO ", caps.clVersion);
EXPECT_STREQ("OpenCL C 2.0 ", caps.clCVersion); EXPECT_STREQ("OpenCL C 2.0 ", caps.clCVersion);
@@ -274,7 +274,7 @@ TEST(Device_GetCaps, givenForceOclVersion20WhenCapsAreCreatedThenDeviceReportsOp
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
{ {
DebugManager.flags.ForceOCLVersion.set(20); DebugManager.flags.ForceOCLVersion.set(20);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_STREQ("OpenCL 2.0 NEO ", caps.clVersion); EXPECT_STREQ("OpenCL 2.0 NEO ", caps.clVersion);
EXPECT_STREQ("OpenCL C 2.0 ", caps.clCVersion); EXPECT_STREQ("OpenCL C 2.0 ", caps.clCVersion);
@@ -286,7 +286,7 @@ TEST(Device_GetCaps, givenForceOclVersion12WhenCapsAreCreatedThenDeviceReportsOp
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
{ {
DebugManager.flags.ForceOCLVersion.set(12); DebugManager.flags.ForceOCLVersion.set(12);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_STREQ("OpenCL 1.2 NEO ", caps.clVersion); EXPECT_STREQ("OpenCL 1.2 NEO ", caps.clVersion);
EXPECT_STREQ("OpenCL C 1.2 ", caps.clCVersion); EXPECT_STREQ("OpenCL C 1.2 ", caps.clCVersion);
@@ -298,7 +298,7 @@ TEST(Device_GetCaps, givenForceInvalidOclVersionWhenCapsAreCreatedThenDeviceWill
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
{ {
DebugManager.flags.ForceOCLVersion.set(1); DebugManager.flags.ForceOCLVersion.set(1);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_STREQ("OpenCL 1.2 NEO ", caps.clVersion); EXPECT_STREQ("OpenCL 1.2 NEO ", caps.clVersion);
EXPECT_STREQ("OpenCL C 1.2 ", caps.clCVersion); EXPECT_STREQ("OpenCL C 1.2 ", caps.clCVersion);
@@ -310,7 +310,7 @@ TEST(Device_GetCaps, givenForce32bitAddressingWhenCapsAreCreatedThenDeviceReport
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
{ {
DebugManager.flags.Force32bitAddressing.set(true); DebugManager.flags.Force32bitAddressing.set(true);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
if (is64bit) { if (is64bit) {
EXPECT_TRUE(caps.force32BitAddressess); EXPECT_TRUE(caps.force32BitAddressess);
@@ -326,7 +326,7 @@ TEST(Device_GetCaps, givenForce32bitAddressingWhenCapsAreCreatedThenDeviceReport
} }
TEST(Device_GetCaps, alignGlobalMemSizeDownToPageSize) { TEST(Device_GetCaps, alignGlobalMemSizeDownToPageSize) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
auto expectedSize = alignDown(caps.globalMemSize, MemoryConstants::pageSize); auto expectedSize = alignDown(caps.globalMemSize, MemoryConstants::pageSize);
@@ -335,7 +335,7 @@ TEST(Device_GetCaps, alignGlobalMemSizeDownToPageSize) {
} }
TEST(Device_GetCaps, checkGlobalMemSize) { TEST(Device_GetCaps, checkGlobalMemSize) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
auto pMemManager = device->getMemoryManager(); auto pMemManager = device->getMemoryManager();
unsigned int enabledCLVer = device->getEnabledClVersion(); unsigned int enabledCLVer = device->getEnabledClVersion();
@@ -354,7 +354,7 @@ TEST(Device_GetCaps, checkGlobalMemSize) {
} }
TEST(Device_GetCaps, givenGlobalMemSizeWhenCalculatingMaxAllocSizeThenAdjustToHWCap) { TEST(Device_GetCaps, givenGlobalMemSizeWhenCalculatingMaxAllocSizeThenAdjustToHWCap) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
HardwareCapabilities hwCaps = {0}; HardwareCapabilities hwCaps = {0};
@@ -368,7 +368,7 @@ TEST(Device_GetCaps, givenGlobalMemSizeWhenCalculatingMaxAllocSizeThenAdjustToHW
} }
TEST(Device_GetCaps, extensionsStringEndsWithSpace) { TEST(Device_GetCaps, extensionsStringEndsWithSpace) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
auto len = strlen(caps.deviceExtensions); auto len = strlen(caps.deviceExtensions);
ASSERT_LT(0U, len); ASSERT_LT(0U, len);
@@ -376,14 +376,14 @@ TEST(Device_GetCaps, extensionsStringEndsWithSpace) {
} }
TEST(Device_GetCaps, DISABLED_givenDeviceWhenCapsAreCreateThenClGLSharingIsReported) { TEST(Device_GetCaps, DISABLED_givenDeviceWhenCapsAreCreateThenClGLSharingIsReported) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_gl_sharing "))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_gl_sharing ")));
} }
TEST(Device_GetCaps, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReportsClKhrSubgroupsExtension) { TEST(Device_GetCaps, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReportsClKhrSubgroupsExtension) {
DebugManager.flags.ForceOCLVersion.set(21); DebugManager.flags.ForceOCLVersion.set(21);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_subgroups"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_subgroups")));
@@ -393,7 +393,7 @@ TEST(Device_GetCaps, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReportsClKh
TEST(Device_GetCaps, givenOpenCLVersion20WhenCapsAreCreatedThenDeviceDoesntReportClKhrSubgroupsExtension) { TEST(Device_GetCaps, givenOpenCLVersion20WhenCapsAreCreatedThenDeviceDoesntReportClKhrSubgroupsExtension) {
DebugManager.flags.ForceOCLVersion.set(20); DebugManager.flags.ForceOCLVersion.set(20);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_subgroups")))); EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_subgroups"))));
@@ -403,7 +403,7 @@ TEST(Device_GetCaps, givenOpenCLVersion20WhenCapsAreCreatedThenDeviceDoesntRepor
TEST(Device_GetCaps, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReportsClKhrIlProgramExtension) { TEST(Device_GetCaps, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReportsClKhrIlProgramExtension) {
DebugManager.flags.ForceOCLVersion.set(21); DebugManager.flags.ForceOCLVersion.set(21);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_il_program"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_il_program")));
@@ -413,7 +413,7 @@ TEST(Device_GetCaps, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReportsClKh
TEST(Device_GetCaps, givenOpenCLVersion20WhenCapsAreCreatedThenDeviceDoesntReportClKhrIlProgramExtension) { TEST(Device_GetCaps, givenOpenCLVersion20WhenCapsAreCreatedThenDeviceDoesntReportClKhrIlProgramExtension) {
DebugManager.flags.ForceOCLVersion.set(20); DebugManager.flags.ForceOCLVersion.set(20);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_il_program")))); EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_il_program"))));
@@ -423,7 +423,7 @@ TEST(Device_GetCaps, givenOpenCLVersion20WhenCapsAreCreatedThenDeviceDoesntRepor
TEST(Device_GetCaps, givenEnableNV12setToTrueWhenCapsAreCreatedThenDeviceReportsNV12Extension) { TEST(Device_GetCaps, givenEnableNV12setToTrueWhenCapsAreCreatedThenDeviceReportsNV12Extension) {
DebugManager.flags.EnableNV12.set(true); DebugManager.flags.EnableNV12.set(true);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_planar_yuv"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_planar_yuv")));
@@ -434,7 +434,7 @@ TEST(Device_GetCaps, givenEnableNV12setToTrueWhenCapsAreCreatedThenDeviceReports
TEST(Device_GetCaps, givenEnablePackedYuvsetToTrueWhenCapsAreCreatedThenDeviceReportsPackedYuvExtension) { TEST(Device_GetCaps, givenEnablePackedYuvsetToTrueWhenCapsAreCreatedThenDeviceReportsPackedYuvExtension) {
DebugManager.flags.EnablePackedYuv.set(true); DebugManager.flags.EnablePackedYuv.set(true);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_packed_yuv"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_packed_yuv")));
@@ -445,7 +445,7 @@ TEST(Device_GetCaps, givenEnablePackedYuvsetToTrueWhenCapsAreCreatedThenDeviceRe
TEST(Device_GetCaps, givenEnableVmeSetToTrueWhenCapsAreCreatedThenDeviceReportsVmeExtensionAndBuiltins) { TEST(Device_GetCaps, givenEnableVmeSetToTrueWhenCapsAreCreatedThenDeviceReportsVmeExtensionAndBuiltins) {
DebugManager.flags.EnableIntelVme.set(true); DebugManager.flags.EnableIntelVme.set(true);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_motion_estimation"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_motion_estimation")));
@@ -458,7 +458,7 @@ TEST(Device_GetCaps, givenEnableVmeSetToTrueWhenCapsAreCreatedThenDeviceReportsV
TEST(Device_GetCaps, givenEnableVmeSetToFalseWhenCapsAreCreatedThenDeviceDoesNotReportsVmeExtensionAndBuiltins) { TEST(Device_GetCaps, givenEnableVmeSetToFalseWhenCapsAreCreatedThenDeviceDoesNotReportsVmeExtensionAndBuiltins) {
DebugManager.flags.EnableIntelVme.set(false); DebugManager.flags.EnableIntelVme.set(false);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_motion_estimation")))); EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_motion_estimation"))));
@@ -471,7 +471,7 @@ TEST(Device_GetCaps, givenEnableVmeSetToFalseWhenCapsAreCreatedThenDeviceDoesNot
TEST(Device_GetCaps, givenEnableAdvancedVmeSetToTrueWhenCapsAreCreatedThenDeviceReportsAdvancedVmeExtensionAndBuiltins) { TEST(Device_GetCaps, givenEnableAdvancedVmeSetToTrueWhenCapsAreCreatedThenDeviceReportsAdvancedVmeExtensionAndBuiltins) {
DebugManager.flags.EnableIntelAdvancedVme.set(true); DebugManager.flags.EnableIntelAdvancedVme.set(true);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_advanced_motion_estimation"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_advanced_motion_estimation")));
@@ -484,7 +484,7 @@ TEST(Device_GetCaps, givenEnableAdvancedVmeSetToTrueWhenCapsAreCreatedThenDevice
TEST(Device_GetCaps, givenEnableAdvancedVmeSetToFalseWhenCapsAreCreatedThenDeviceDoesNotReportsAdvancedVmeExtensionAndBuiltins) { TEST(Device_GetCaps, givenEnableAdvancedVmeSetToFalseWhenCapsAreCreatedThenDeviceDoesNotReportsAdvancedVmeExtensionAndBuiltins) {
DebugManager.flags.EnableIntelAdvancedVme.set(false); DebugManager.flags.EnableIntelAdvancedVme.set(false);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_advanced_motion_estimation")))); EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_advanced_motion_estimation"))));
@@ -503,7 +503,7 @@ TEST(Device_GetCaps, byDefaultVmeIsTurnedOn) {
TEST(Device_GetCaps, givenOpenCL21DeviceCapsWhenAskedForCPUcopyFlagThenTrueIsReturned) { TEST(Device_GetCaps, givenOpenCL21DeviceCapsWhenAskedForCPUcopyFlagThenTrueIsReturned) {
DebugManagerStateRestore stateRestorer; DebugManagerStateRestore stateRestorer;
DebugManager.flags.ForceOCLVersion.set(21); DebugManager.flags.ForceOCLVersion.set(21);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_TRUE(caps.cpuCopyAllowed); EXPECT_TRUE(caps.cpuCopyAllowed);
} }
@@ -511,7 +511,7 @@ TEST(Device_GetCaps, givenOpenCL21DeviceCapsWhenAskedForCPUcopyFlagThenTrueIsRet
TEST(Device_GetCaps, givenOpenCL20DeviceCapsWhenAskedForCPUcopyFlagThenTrueIsReturned) { TEST(Device_GetCaps, givenOpenCL20DeviceCapsWhenAskedForCPUcopyFlagThenTrueIsReturned) {
DebugManagerStateRestore stateRestorer; DebugManagerStateRestore stateRestorer;
DebugManager.flags.ForceOCLVersion.set(20); DebugManager.flags.ForceOCLVersion.set(20);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_TRUE(caps.cpuCopyAllowed); EXPECT_TRUE(caps.cpuCopyAllowed);
} }
@@ -519,27 +519,27 @@ TEST(Device_GetCaps, givenOpenCL20DeviceCapsWhenAskedForCPUcopyFlagThenTrueIsRet
TEST(Device_GetCaps, givenOpenCL12DeviceCapsWhenAskedForCPUcopyFlagThenTrueIsReturned) { TEST(Device_GetCaps, givenOpenCL12DeviceCapsWhenAskedForCPUcopyFlagThenTrueIsReturned) {
DebugManagerStateRestore stateRestorer; DebugManagerStateRestore stateRestorer;
DebugManager.flags.ForceOCLVersion.set(12); DebugManager.flags.ForceOCLVersion.set(12);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_TRUE(caps.cpuCopyAllowed); EXPECT_TRUE(caps.cpuCopyAllowed);
} }
TEST(Device_GetCaps, deviceReportsPriorityHintsExtension) { TEST(Device_GetCaps, deviceReportsPriorityHintsExtension) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_priority_hints"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_priority_hints")));
} }
TEST(Device_GetCaps, deviceReportsCreateCommandQueueExtension) { TEST(Device_GetCaps, deviceReportsCreateCommandQueueExtension) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_create_command_queue"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_create_command_queue")));
} }
TEST(Device_GetCaps, deviceReportsThrottleHintsExtension) { TEST(Device_GetCaps, deviceReportsThrottleHintsExtension) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_throttle_hints"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_throttle_hints")));
@@ -549,7 +549,7 @@ TEST(Device_GetCaps, givenAtleastOCL2DeviceThenExposesMipmapImageExtensions) {
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.ForceOCLVersion.set(20); DebugManager.flags.ForceOCLVersion.set(20);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_mipmap_image"))); EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_mipmap_image")));
@@ -560,7 +560,7 @@ TEST(Device_GetCaps, givenOCL12DeviceThenDoesNotExposeMipmapImageExtensions) {
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.ForceOCLVersion.set(12); DebugManager.flags.ForceOCLVersion.set(12);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_mipmap_image")))); EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_mipmap_image"))));
@@ -570,7 +570,7 @@ TEST(Device_GetCaps, givenOCL12DeviceThenDoesNotExposeMipmapImageExtensions) {
TEST(Device_GetCaps, givenDeviceThatDoesntHaveFp64ThenExtensionIsNotReported) { TEST(Device_GetCaps, givenDeviceThatDoesntHaveFp64ThenExtensionIsNotReported) {
HardwareInfo nonFp64Device = *platformDevices[0]; HardwareInfo nonFp64Device = *platformDevices[0];
nonFp64Device.capabilityTable.ftrSupportsFP64 = false; nonFp64Device.capabilityTable.ftrSupportsFP64 = false;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&nonFp64Device)); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&nonFp64Device));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
std::string extensionString = caps.deviceExtensions; std::string extensionString = caps.deviceExtensions;
@@ -584,7 +584,7 @@ TEST(DeviceGetCaps, givenDeviceThatDoesntHaveFp64WhenDbgFlagEnablesFp64ThenRepor
HardwareInfo nonFp64Device = *platformDevices[0]; HardwareInfo nonFp64Device = *platformDevices[0];
nonFp64Device.capabilityTable.ftrSupportsFP64 = false; nonFp64Device.capabilityTable.ftrSupportsFP64 = false;
nonFp64Device.capabilityTable.ftrSupports64BitMath = false; nonFp64Device.capabilityTable.ftrSupports64BitMath = false;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&nonFp64Device)); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&nonFp64Device));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
std::string extensionString = caps.deviceExtensions; std::string extensionString = caps.deviceExtensions;
@@ -601,7 +601,7 @@ TEST(DeviceGetCaps, givenDeviceThatDoesHaveFp64WhenDbgFlagDisablesFp64ThenDontRe
HardwareInfo fp64Device = *platformDevices[0]; HardwareInfo fp64Device = *platformDevices[0];
fp64Device.capabilityTable.ftrSupportsFP64 = true; fp64Device.capabilityTable.ftrSupportsFP64 = true;
fp64Device.capabilityTable.ftrSupports64BitMath = true; fp64Device.capabilityTable.ftrSupports64BitMath = true;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&fp64Device)); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&fp64Device));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
std::string extensionString = caps.deviceExtensions; std::string extensionString = caps.deviceExtensions;
@@ -616,7 +616,7 @@ TEST(Device_GetCaps, givenOclVersionLessThan21WhenCapsAreCreatedThenDeviceReport
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
{ {
DebugManager.flags.ForceOCLVersion.set(12); DebugManager.flags.ForceOCLVersion.set(12);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_STREQ("", caps.ilVersion); EXPECT_STREQ("", caps.ilVersion);
DebugManager.flags.ForceOCLVersion.set(0); DebugManager.flags.ForceOCLVersion.set(0);
@@ -627,7 +627,7 @@ TEST(Device_GetCaps, givenOclVersion21WhenCapsAreCreatedThenDeviceReportsSpirvAs
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
{ {
DebugManager.flags.ForceOCLVersion.set(21); DebugManager.flags.ForceOCLVersion.set(21);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
EXPECT_STREQ("SPIR-V_1.0 ", caps.ilVersion); EXPECT_STREQ("SPIR-V_1.0 ", caps.ilVersion);
DebugManager.flags.ForceOCLVersion.set(0); DebugManager.flags.ForceOCLVersion.set(0);
@@ -644,7 +644,7 @@ TEST(Device_GetCaps, givenDisabledFtrPooledEuWhenCalculatingMaxEuPerSSThenIgnore
mySysInfo.EuCountPerPoolMin = 99999; mySysInfo.EuCountPerPoolMin = 99999;
mySkuTable.ftrPooledEuEnabled = 0; mySkuTable.ftrPooledEuEnabled = 0;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&myHwInfo)); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
auto expectedMaxWGS = (mySysInfo.EUCount / mySysInfo.SubSliceCount) * auto expectedMaxWGS = (mySysInfo.EUCount / mySysInfo.SubSliceCount) *
(mySysInfo.ThreadCount / mySysInfo.EUCount) * 8; (mySysInfo.ThreadCount / mySysInfo.EUCount) * 8;
@@ -663,7 +663,7 @@ TEST(Device_GetCaps, givenEnabledFtrPooledEuWhenCalculatingMaxEuPerSSThenDontIgn
mySysInfo.EuCountPerPoolMin = 99999; mySysInfo.EuCountPerPoolMin = 99999;
mySkuTable.ftrPooledEuEnabled = 1; mySkuTable.ftrPooledEuEnabled = 1;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&myHwInfo)); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
auto expectedMaxWGS = mySysInfo.EuCountPerPoolMin * (mySysInfo.ThreadCount / mySysInfo.EUCount) * 8; auto expectedMaxWGS = mySysInfo.EuCountPerPoolMin * (mySysInfo.ThreadCount / mySysInfo.EUCount) * 8;
expectedMaxWGS = std::min(Math::prevPowerOfTwo(expectedMaxWGS), 256u); expectedMaxWGS = std::min(Math::prevPowerOfTwo(expectedMaxWGS), 256u);
@@ -683,7 +683,7 @@ TEST(Device_GetCaps, givenDebugFlagToUseMaxSimdSizeForWkgCalculationWhenDeviceCa
mySysInfo.EUCount = 24; mySysInfo.EUCount = 24;
mySysInfo.SubSliceCount = 3; mySysInfo.SubSliceCount = 3;
mySysInfo.ThreadCount = 24 * 7; mySysInfo.ThreadCount = 24 * 7;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&myHwInfo)); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
EXPECT_EQ(1024u, device->getDeviceInfo().maxWorkGroupSize); EXPECT_EQ(1024u, device->getDeviceInfo().maxWorkGroupSize);
EXPECT_EQ(device->getDeviceInfo().maxWorkGroupSize / 32, device->getDeviceInfo().maxNumOfSubGroups); EXPECT_EQ(device->getDeviceInfo().maxWorkGroupSize / 32, device->getDeviceInfo().maxNumOfSubGroups);
@@ -744,7 +744,7 @@ TEST(Device_GetCaps, givenSystemWithNoDriverInfoWhenGettingNameAndVersionThenRet
TEST(Device_GetCaps, GivenFlagEnabled64kbPagesWhenSetThenReturnCorrectValue) { TEST(Device_GetCaps, GivenFlagEnabled64kbPagesWhenSetThenReturnCorrectValue) {
DebugManagerStateRestore dbgRestore; DebugManagerStateRestore dbgRestore;
bool orgOsEnabled64kbPages = OSInterface::osEnabled64kbPages; bool orgOsEnabled64kbPages = OSInterface::osEnabled64kbPages;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
HardwareInfo &hwInfo = const_cast<HardwareInfo &>(device->getHardwareInfo()); HardwareInfo &hwInfo = const_cast<HardwareInfo &>(device->getHardwareInfo());
bool orgftr64KBpages = hwInfo.capabilityTable.ftr64KBpages; bool orgftr64KBpages = hwInfo.capabilityTable.ftr64KBpages;

View File

@@ -68,7 +68,7 @@ TEST_F(DeviceTest, getTagAddress) {
} }
TEST_F(DeviceTest, WhenGetOSTimeThenNotNull) { TEST_F(DeviceTest, WhenGetOSTimeThenNotNull) {
auto pDevice = std::unique_ptr<Device>(DeviceHelper<>::create()); auto pDevice = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
OSTime *osTime = pDevice->getOSTime(); OSTime *osTime = pDevice->getOSTime();
ASSERT_NE(nullptr, osTime); ASSERT_NE(nullptr, osTime);
@@ -76,7 +76,7 @@ TEST_F(DeviceTest, WhenGetOSTimeThenNotNull) {
TEST_F(DeviceTest, GivenDebugVariableForcing32BitAllocationsWhenDeviceIsCreatedThenMemoryManagerHasForce32BitFlagSet) { TEST_F(DeviceTest, GivenDebugVariableForcing32BitAllocationsWhenDeviceIsCreatedThenMemoryManagerHasForce32BitFlagSet) {
DebugManager.flags.Force32bitAddressing.set(true); DebugManager.flags.Force32bitAddressing.set(true);
auto pDevice = std::unique_ptr<Device>(DeviceHelper<>::create()); auto pDevice = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
if (is64bit) { if (is64bit) {
EXPECT_TRUE(pDevice->getDeviceInfo().force32BitAddressess); EXPECT_TRUE(pDevice->getDeviceInfo().force32BitAddressess);
EXPECT_TRUE(pDevice->getMemoryManager()->peekForce32BitAllocations()); EXPECT_TRUE(pDevice->getMemoryManager()->peekForce32BitAllocations());
@@ -108,7 +108,7 @@ TEST_F(DeviceTest, getEngineTypeDefault) {
auto pTestDevice = std::unique_ptr<Device>(createWithUsDeviceId(0)); auto pTestDevice = std::unique_ptr<Device>(createWithUsDeviceId(0));
EngineType actualEngineType = pDevice->getEngineType(); EngineType actualEngineType = pDevice->getEngineType();
EngineType defaultEngineType = hwInfoHelper.capabilityTable.defaultEngineType; EngineType defaultEngineType = pDevice->getHardwareInfo().capabilityTable.defaultEngineType;
EXPECT_EQ(defaultEngineType, actualEngineType); EXPECT_EQ(defaultEngineType, actualEngineType);
} }
@@ -120,7 +120,7 @@ TEST_F(DeviceTest, givenDebugVariableOverrideEngineTypeWhenDeviceIsCreatedThenUs
auto pTestDevice = std::unique_ptr<Device>(createWithUsDeviceId(0)); auto pTestDevice = std::unique_ptr<Device>(createWithUsDeviceId(0));
EngineType actualEngineType = pTestDevice->getEngineType(); EngineType actualEngineType = pTestDevice->getEngineType();
EngineType defaultEngineType = hwInfoHelper.capabilityTable.defaultEngineType; EngineType defaultEngineType = pDevice->getHardwareInfo().capabilityTable.defaultEngineType;
EXPECT_NE(defaultEngineType, actualEngineType); EXPECT_NE(defaultEngineType, actualEngineType);
EXPECT_EQ(expectedEngine, actualEngineType); EXPECT_EQ(expectedEngine, actualEngineType);

View File

@@ -60,7 +60,7 @@ TEST(MockOSTime, DeviceHostDeltaCheck) {
cl_ulong allowedDiff = 0; cl_ulong allowedDiff = 0;
float allowedErr = 0.005f; float allowedErr = 0.005f;
auto mDev = std::unique_ptr<MockDevice>(DeviceHelper<>::create()); auto mDev = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
mDev->getDeviceAndHostTimer( mDev->getDeviceAndHostTimer(
&deviceTimestamp[0], &deviceTimestamp[0],

View File

@@ -34,7 +34,7 @@ typedef ::testing::Test MockOSTimeWinTest;
HWTEST_F(MockOSTimeWinTest, DynamicResolution) { HWTEST_F(MockOSTimeWinTest, DynamicResolution) {
auto wddmMock = std::unique_ptr<WddmMock>(new WddmMock()); auto wddmMock = std::unique_ptr<WddmMock>(new WddmMock());
auto mDev = std::unique_ptr<MockDevice>(DeviceHelper<>::create()); auto mDev = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
bool error = wddmMock->init<FamilyType>(); bool error = wddmMock->init<FamilyType>();
EXPECT_EQ(1u, wddmMock->createContextResult.called); EXPECT_EQ(1u, wddmMock->createContextResult.called);

View File

@@ -36,7 +36,7 @@ struct GetDeviceInfoSize : public ::testing::TestWithParam<std::pair<uint32_t /*
}; };
TEST_P(GetDeviceInfoSize, sizeIsValid) { TEST_P(GetDeviceInfoSize, sizeIsValid) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create()); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
size_t sizeReturned = 0; size_t sizeReturned = 0;
auto retVal = device->getDeviceInfo( auto retVal = device->getDeviceInfo(
@@ -152,7 +152,7 @@ INSTANTIATE_TEST_CASE_P(
testing::ValuesIn(deviceInfoParams2)); testing::ValuesIn(deviceInfoParams2));
TEST(DeviceInfoTests, givenDefaultDeviceWhenQueriedForDeviceVersionThenProperSizeIsReturned) { TEST(DeviceInfoTests, givenDefaultDeviceWhenQueriedForDeviceVersionThenProperSizeIsReturned) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create()); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
size_t sizeReturned = 0; size_t sizeReturned = 0;
auto retVal = device->getDeviceInfo( auto retVal = device->getDeviceInfo(
CL_DEVICE_VERSION, CL_DEVICE_VERSION,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -28,7 +28,7 @@
using namespace OCLRT; using namespace OCLRT;
TEST(GetDeviceInfo, InvalidFlags_returnsError) { TEST(GetDeviceInfo, InvalidFlags_returnsError) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create()); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto retVal = device->getDeviceInfo( auto retVal = device->getDeviceInfo(
0, 0,
@@ -39,7 +39,7 @@ TEST(GetDeviceInfo, InvalidFlags_returnsError) {
} }
TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsErrorWhenPlanarYuvExtensionDisabled) { TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsErrorWhenPlanarYuvExtensionDisabled) {
auto device = std::unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
device->getDeviceInfoToModify()->nv12Extension = false; device->getDeviceInfoToModify()->nv12Extension = false;
uint32_t value; uint32_t value;
@@ -62,7 +62,7 @@ TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsErrorWhenPlanarYuvExtens
} }
TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsCorrectValuesWhenPlanarYuvExtensionEnabled) { TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsCorrectValuesWhenPlanarYuvExtensionEnabled) {
auto device = std::unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
device->getDeviceInfoToModify()->nv12Extension = true; device->getDeviceInfoToModify()->nv12Extension = true;
size_t value = 0; size_t value = 0;
@@ -87,7 +87,7 @@ TEST(GetDeviceInfo, devicePlanarYuvMaxWidthHeightReturnsCorrectValuesWhenPlanarY
} }
TEST(GetDeviceInfo, numSimultaneousInterops) { TEST(GetDeviceInfo, numSimultaneousInterops) {
auto device = std::unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
device->simultaneousInterops = {0}; device->simultaneousInterops = {0};
cl_uint value = 0; cl_uint value = 0;
@@ -106,7 +106,7 @@ TEST(GetDeviceInfo, numSimultaneousInterops) {
} }
TEST(GetDeviceInfo, simultaneousInterops) { TEST(GetDeviceInfo, simultaneousInterops) {
auto device = std::unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
device->simultaneousInterops = {0}; device->simultaneousInterops = {0};
cl_uint value[4] = {}; cl_uint value[4] = {};
@@ -123,7 +123,7 @@ TEST(GetDeviceInfo, simultaneousInterops) {
} }
TEST(GetDeviceInfo, prefferedInteropUserSync) { TEST(GetDeviceInfo, prefferedInteropUserSync) {
auto device = std::unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
cl_bool value = 0; cl_bool value = 0;
size_t size = 0; size_t size = 0;
@@ -143,7 +143,7 @@ struct GetDeviceInfo : public ::testing::TestWithParam<uint32_t /*cl_device_info
}; };
TEST_P(GetDeviceInfo, valid_returnsSuccess) { TEST_P(GetDeviceInfo, valid_returnsSuccess) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create()); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
size_t sizeReturned = 0; size_t sizeReturned = 0;
auto retVal = device->getDeviceInfo( auto retVal = device->getDeviceInfo(

View File

@@ -57,7 +57,7 @@ TEST(EventCallbackTest, NestedCallbacksAreCalledForUserEvent) {
TEST(EventCallbackTest, NestedCallbacksAreCalledForEvent) { TEST(EventCallbackTest, NestedCallbacksAreCalledForEvent) {
constructPlatform(); constructPlatform();
std::unique_ptr<Device> device(DeviceHelper<>::create()); std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockContext context; MockContext context;
MockCommandQueue queue(&context, device.get(), nullptr); MockCommandQueue queue(&context, device.get(), nullptr);
MockEvent<Event> event(&queue, CL_COMMAND_MARKER, 0, 0); MockEvent<Event> event(&queue, CL_COMMAND_MARKER, 0, 0);

View File

@@ -192,7 +192,7 @@ TEST(Event, waitForEventsFlushesAllQueues) {
uint32_t flushCounter = 0; uint32_t flushCounter = 0;
}; };
std::unique_ptr<Device> device(DeviceHelper<>::create()); std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockContext context; MockContext context;
std::unique_ptr<MockCommandQueueWithFlushCheck> cmdQ1(new MockCommandQueueWithFlushCheck(context, device.get())); std::unique_ptr<MockCommandQueueWithFlushCheck> cmdQ1(new MockCommandQueueWithFlushCheck(context, device.get()));
@@ -223,7 +223,7 @@ TEST(Event, waitForEventsWithNotReadyEventDoesNotFlushQueue) {
uint32_t flushCounter = 0; uint32_t flushCounter = 0;
}; };
std::unique_ptr<Device> device(DeviceHelper<>::create()); std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockContext context; MockContext context;
std::unique_ptr<MockCommandQueueWithFlushCheck> cmdQ1(new MockCommandQueueWithFlushCheck(context, device.get())); std::unique_ptr<MockCommandQueueWithFlushCheck> cmdQ1(new MockCommandQueueWithFlushCheck(context, device.get()));

View File

@@ -20,24 +20,16 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "device_fixture.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/helpers/options.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "unit_tests/mocks/mock_ostime.h" #include "unit_tests/fixtures/device_fixture.h"
using OCLRT::Device;
using OCLRT::HardwareInfo;
using OCLRT::MockOSTime;
using OCLRT::OSTime;
using OCLRT::platformDevices;
namespace OCLRT {
void DeviceFixture::SetUp() { void DeviceFixture::SetUp() {
SetUpImpl(nullptr); SetUpImpl(nullptr);
} }
void DeviceFixture::SetUpImpl(const OCLRT::HardwareInfo *hardwareInfo) { void DeviceFixture::SetUpImpl(const OCLRT::HardwareInfo *hardwareInfo) {
pDevice = DeviceHelper<>::create(hardwareInfo); pDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(hardwareInfo);
ASSERT_NE(nullptr, pDevice); ASSERT_NE(nullptr, pDevice);
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pDevice->getCommandStreamReceiver();
@@ -49,10 +41,11 @@ void DeviceFixture::TearDown() {
delete pDevice; delete pDevice;
} }
OCLRT::MockDevice *DeviceFixture::createWithUsDeviceId(unsigned short usDeviceId) { MockDevice *DeviceFixture::createWithUsDeviceId(unsigned short usDeviceId) {
hwInfoHelper = *platformDevices[0]; hwInfoHelper = *platformDevices[0];
platformHelper = *platformDevices[0]->pPlatform; platformHelper = *platformDevices[0]->pPlatform;
platformHelper.usDeviceID = usDeviceId; platformHelper.usDeviceID = usDeviceId;
hwInfoHelper.pPlatform = &platformHelper; hwInfoHelper.pPlatform = &platformHelper;
return DeviceHelper<>::create(&hwInfoHelper); return MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfoHelper);
} }
} // namespace OCLRT

View File

@@ -22,38 +22,20 @@
#pragma once #pragma once
#include "unit_tests/mocks/mock_device.h" #include "unit_tests/mocks/mock_device.h"
#include <cassert>
namespace OCLRT { namespace OCLRT {
struct HardwareInfo; struct HardwareInfo;
extern const HardwareInfo **platformDevices;
} // namespace OCLRT
struct DeviceDefaults {
};
template <typename DeviceTraits = DeviceDefaults>
struct DeviceHelper {
static OCLRT::MockDevice *create(const OCLRT::HardwareInfo *hardwareInfo = nullptr) {
OCLRT::MockDevice *device = OCLRT::MockDevice::createWithNewExecutionEnvironment<OCLRT::MockDevice>(hardwareInfo);
assert(device != nullptr);
return device;
}
};
struct DeviceFixture { struct DeviceFixture {
DeviceFixture()
: pDevice(nullptr),
pTagMemory(nullptr) {
}
void SetUp(); void SetUp();
void SetUpImpl(const OCLRT::HardwareInfo *hardwareInfo); void SetUpImpl(const OCLRT::HardwareInfo *hardwareInfo);
void TearDown(); void TearDown();
OCLRT::MockDevice *createWithUsDeviceId(unsigned short usDeviceId);
OCLRT::MockDevice *pDevice; MockDevice *createWithUsDeviceId(unsigned short usDeviceId);
volatile uint32_t *pTagMemory;
OCLRT::HardwareInfo hwInfoHelper; MockDevice *pDevice = nullptr;
PLATFORM platformHelper; volatile uint32_t *pTagMemory = nullptr;
HardwareInfo hwInfoHelper = {};
PLATFORM platformHelper = {};
}; };
} // namespace OCLRT

View File

@@ -24,17 +24,17 @@
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/mocks/mock_context.h" #include "unit_tests/mocks/mock_context.h"
class EnqueueHandlerTest : public DeviceFixture, class EnqueueHandlerTest : public OCLRT::DeviceFixture,
public testing::Test { public testing::Test {
public: public:
void SetUp() override { void SetUp() override {
context = new OCLRT::MockContext;
DeviceFixture::SetUp(); DeviceFixture::SetUp();
context = new OCLRT::MockContext(pDevice);
} }
void TearDown() override { void TearDown() override {
DeviceFixture::TearDown();
context->decRefInternal(); context->decRefInternal();
DeviceFixture::TearDown();
} }
OCLRT::MockContext *context; OCLRT::MockContext *context;
}; };

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -108,7 +108,7 @@ class ExecutionModelSchedulerTest : public DeviceFixture,
struct ParentKernelCommandQueueFixture : public CommandQueueHwFixture, struct ParentKernelCommandQueueFixture : public CommandQueueHwFixture,
testing::Test { testing::Test {
void SetUp() override { void SetUp() override {
device = DeviceHelper<>::create(); device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
CommandQueueHwFixture::SetUp(device, 0); CommandQueueHwFixture::SetUp(device, 0);
} }
void TearDown() override { void TearDown() override {

View File

@@ -48,7 +48,7 @@ class ExecutionModelKernelFixture : public ProgramFromBinaryTest,
temp.assign(pPlatform->getDevice(0)->getDeviceInfo().clVersion); temp.assign(pPlatform->getDevice(0)->getDeviceInfo().clVersion);
if (temp.find("OpenCL 1.2") != std::string::npos) { if (temp.find("OpenCL 1.2") != std::string::npos) {
pDevice = DeviceHelper<>::create(); pDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
return; return;
} }

View File

@@ -39,7 +39,7 @@ namespace iOpenCL {
struct SKernelBinaryHeaderCommon; struct SKernelBinaryHeaderCommon;
} }
class KernelImageArgTest : public Test<DeviceFixture> { class KernelImageArgTest : public Test<OCLRT::DeviceFixture> {
public: public:
KernelImageArgTest() { KernelImageArgTest() {
} }

View File

@@ -33,7 +33,7 @@
using namespace OCLRT; using namespace OCLRT;
TEST(CommandTest, mapUnmapSubmitWithoutTerminateFlagFlushesCsr) { TEST(CommandTest, mapUnmapSubmitWithoutTerminateFlagFlushesCsr) {
std::unique_ptr<Device> device(DeviceHelper<>::create()); std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockCommandQueue> cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr)); std::unique_ptr<MockCommandQueue> cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr));
MockCommandStreamReceiver csr; MockCommandStreamReceiver csr;
csr.setMemoryManager(device->getMemoryManager()); csr.setMemoryManager(device->getMemoryManager());
@@ -51,7 +51,7 @@ TEST(CommandTest, mapUnmapSubmitWithoutTerminateFlagFlushesCsr) {
} }
TEST(CommandTest, mapUnmapSubmitWithTerminateFlagAbortsFlush) { TEST(CommandTest, mapUnmapSubmitWithTerminateFlagAbortsFlush) {
std::unique_ptr<Device> device(DeviceHelper<>::create()); std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockCommandQueue> cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr)); std::unique_ptr<MockCommandQueue> cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr));
MockCommandStreamReceiver csr; MockCommandStreamReceiver csr;
csr.setMemoryManager(device->getMemoryManager()); csr.setMemoryManager(device->getMemoryManager());
@@ -72,7 +72,7 @@ TEST(CommandTest, mapUnmapSubmitWithTerminateFlagAbortsFlush) {
} }
TEST(CommandTest, markerSubmitWithoutTerminateFlagFlushesCsr) { TEST(CommandTest, markerSubmitWithoutTerminateFlagFlushesCsr) {
std::unique_ptr<Device> device(DeviceHelper<>::create()); std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockCommandQueue> cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr)); std::unique_ptr<MockCommandQueue> cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr));
MockCommandStreamReceiver csr; MockCommandStreamReceiver csr;
csr.setMemoryManager(device->getMemoryManager()); csr.setMemoryManager(device->getMemoryManager());
@@ -87,7 +87,7 @@ TEST(CommandTest, markerSubmitWithoutTerminateFlagFlushesCsr) {
} }
TEST(CommandTest, markerSubmitWithTerminateFlagAbortsFlush) { TEST(CommandTest, markerSubmitWithTerminateFlagAbortsFlush) {
std::unique_ptr<Device> device(DeviceHelper<>::create()); std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockCommandQueue> cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr)); std::unique_ptr<MockCommandQueue> cmdQ(new MockCommandQueue(nullptr, device.get(), nullptr));
MockCommandStreamReceiver csr; MockCommandStreamReceiver csr;
MockBuffer buffer; MockBuffer buffer;

View File

@@ -2084,7 +2084,7 @@ TEST(KernelInfoTest, getArgNumByName) {
} }
TEST(KernelTest, getInstructionHeapSizeForExecutionModelReturnsZeroForNormalKernel) { TEST(KernelTest, getInstructionHeapSizeForExecutionModelReturnsZeroForNormalKernel) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
MockKernelWithInternals kernel(*device); MockKernelWithInternals kernel(*device);
EXPECT_EQ(0u, kernel.mockKernel->getInstructionHeapSizeForExecutionModel()); EXPECT_EQ(0u, kernel.mockKernel->getInstructionHeapSizeForExecutionModel());
@@ -2107,7 +2107,7 @@ TEST(KernelTest, setKernelArgUsesBuiltinDispatchInfoBuilderIfAvailable) {
mutable std::vector<std::tuple<uint32_t, size_t, const void *>> receivedArgs; mutable std::vector<std::tuple<uint32_t, size_t, const void *>> receivedArgs;
}; };
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
MockKernelWithInternals kernel(*device); MockKernelWithInternals kernel(*device);
kernel.kernelInfo.resizeKernelArgInfoAndRegisterParameter(1); kernel.kernelInfo.resizeKernelArgInfoAndRegisterParameter(1);
kernel.mockKernel->initialize(); kernel.mockKernel->initialize();
@@ -2172,7 +2172,7 @@ TEST(KernelTest, givenKernelWhenDebugFlagToUseMaxSimdForCalculationsIsUsedThenMa
mySysInfo.EUCount = 24; mySysInfo.EUCount = 24;
mySysInfo.SubSliceCount = 3; mySysInfo.SubSliceCount = 3;
mySysInfo.ThreadCount = 24 * 7; mySysInfo.ThreadCount = 24 * 7;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&myHwInfo)); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
MockKernelWithInternals kernel(*device); MockKernelWithInternals kernel(*device);
kernel.executionEnvironment.LargestCompiledSIMDSize = 32; kernel.executionEnvironment.LargestCompiledSIMDSize = 32;

View File

@@ -120,7 +120,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithReadOnlyFlagsThenB
memset(memory, 0xAA, MemoryConstants::pageSize); memset(memory, 0xAA, MemoryConstants::pageSize);
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
::testing::NiceMock<GMockMemoryManagerFailFirstAllocation> *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>; ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation> *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>;
device->injectMemoryManager(memoryManager); device->injectMemoryManager(memoryManager);
@@ -150,7 +150,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithReadOnlyFlagsAndSe
memset(memory, 0xAA, MemoryConstants::pageSize); memset(memory, 0xAA, MemoryConstants::pageSize);
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
::testing::NiceMock<GMockMemoryManagerFailFirstAllocation> *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>; ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation> *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>;
device->injectMemoryManager(memoryManager); device->injectMemoryManager(memoryManager);
@@ -176,7 +176,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithKernelWriteFlagThe
memset(memory, 0xAA, MemoryConstants::pageSize); memset(memory, 0xAA, MemoryConstants::pageSize);
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
::testing::NiceMock<GMockMemoryManagerFailFirstAllocation> *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>; ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation> *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>;
device->injectMemoryManager(memoryManager); device->injectMemoryManager(memoryManager);
@@ -196,7 +196,7 @@ TEST(Buffer, givenReadOnlyHostPtrMemoryWhenBufferIsCreatedWithKernelWriteFlagThe
} }
TEST(Buffer, givenNullPtrWhenBufferIsCreatedWithKernelReadOnlyFlagsThenBufferAllocationFailsAndReturnsNullptr) { TEST(Buffer, givenNullPtrWhenBufferIsCreatedWithKernelReadOnlyFlagsThenBufferAllocationFailsAndReturnsNullptr) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
::testing::NiceMock<GMockMemoryManagerFailFirstAllocation> *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>; ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation> *memoryManager = new ::testing::NiceMock<GMockMemoryManagerFailFirstAllocation>;
device->injectMemoryManager(memoryManager); device->injectMemoryManager(memoryManager);

View File

@@ -235,7 +235,7 @@ TEST_F(Image2dFromBufferTest, givenUnalignedImageWidthAndNoSpaceInBufferForAlign
} }
TEST_F(Image2dFromBufferTest, ExtensionString) { TEST_F(Image2dFromBufferTest, ExtensionString) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
std::string extensions = caps.deviceExtensions; std::string extensions = caps.deviceExtensions;
size_t found = extensions.find("cl_khr_image2d_from_buffer"); size_t found = extensions.find("cl_khr_image2d_from_buffer");

View File

@@ -153,7 +153,7 @@ TEST_P(ImageRedescribeTest, givenImageWithMaxSizesWhenItIsRedescribedThenNewImag
cl_image_format imageFormat; cl_image_format imageFormat;
cl_image_desc imageDesc; cl_image_desc imageDesc;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
auto memoryManager = (OsAgnosticMemoryManager *)context.getMemoryManager(); auto memoryManager = (OsAgnosticMemoryManager *)context.getMemoryManager();

View File

@@ -134,7 +134,7 @@ TEST_F(ImageUnmapTest, givenImageWhenEnqueueMapImageIsCalledTwiceThenAllocatedMe
cl_int retVal; cl_int retVal;
size_t origin[] = {0, 0, 0}; size_t origin[] = {0, 0, 0};
size_t region[] = {0, 0, 0}; size_t region[] = {0, 0, 0};
std::unique_ptr<MockDevice> device(DeviceHelper<>::create()); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<CommandQueue> commandQueue(CommandQueue::create(&context, device.get(), nullptr, retVal)); std::unique_ptr<CommandQueue> commandQueue(CommandQueue::create(&context, device.get(), nullptr, retVal));
commandQueue->enqueueMapImage(image.get(), CL_FALSE, 0, origin, region, nullptr, nullptr, 0, nullptr, nullptr, retVal); commandQueue->enqueueMapImage(image.get(), CL_FALSE, 0, origin, region, nullptr, nullptr, 0, nullptr, nullptr, retVal);
EXPECT_NE(nullptr, image->getAllocatedMapPtr()); EXPECT_NE(nullptr, image->getAllocatedMapPtr());

View File

@@ -390,7 +390,7 @@ TEST_F(Nv12ImageTest, createNV12UVPlaneImageWithOffsetOfUVPlane) {
HWTEST_F(Nv12ImageTest, checkIfPlanesAreWritten) { HWTEST_F(Nv12ImageTest, checkIfPlanesAreWritten) {
KernelBinaryHelper kbHelper(KernelBinaryHelper::BUILT_INS); KernelBinaryHelper kbHelper(KernelBinaryHelper::BUILT_INS);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create()); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
char hostPtr[16 * 16 * 16]; char hostPtr[16 * 16 * 16];

View File

@@ -675,7 +675,7 @@ class MockPrintfHandler : public PrintfHandler {
}; };
TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCreatedThenPrintfSurfaceIsPatchedWithBaseAddressOffset) { TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCreatedThenPrintfSurfaceIsPatchedWithBaseAddressOffset) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
MockKernelWithInternals kernel(*device); MockKernelWithInternals kernel(*device);
MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel); MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel);
SPatchAllocateStatelessPrintfSurface printfSurface; SPatchAllocateStatelessPrintfSurface printfSurface;
@@ -711,7 +711,7 @@ TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCre
} }
HWTEST_F(MemoryAllocatorTest, givenStatefulKernelWithPrintfWhenPrintfSurfaceIsCreatedThenPrintfSurfaceIsPatchedWithCpuAddress) { HWTEST_F(MemoryAllocatorTest, givenStatefulKernelWithPrintfWhenPrintfSurfaceIsCreatedThenPrintfSurfaceIsPatchedWithCpuAddress) {
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
MockKernelWithInternals kernel(*device); MockKernelWithInternals kernel(*device);
MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel); MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel);
SPatchAllocateStatelessPrintfSurface printfSurface; SPatchAllocateStatelessPrintfSurface printfSurface;
@@ -753,7 +753,7 @@ TEST_F(MemoryAllocatorTest, given32BitDeviceWhenPrintfSurfaceIsCreatedThen32BitA
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
if (is64bit) { if (is64bit) {
DebugManager.flags.Force32bitAddressing.set(true); DebugManager.flags.Force32bitAddressing.set(true);
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(platformDevices[0])); auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
MockKernelWithInternals kernel(*device); MockKernelWithInternals kernel(*device);
MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel); MockMultiDispatchInfo multiDispatchInfo(kernel.mockKernel);
SPatchAllocateStatelessPrintfSurface printfSurface; SPatchAllocateStatelessPrintfSurface printfSurface;

View File

@@ -71,7 +71,7 @@ MockContext::~MockContext() {
} }
MockContext::MockContext() { MockContext::MockContext() {
device = DeviceHelper<>::create(); device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
devices.push_back(device); devices.push_back(device);
memoryManager = device->getMemoryManager(); memoryManager = device->getMemoryManager();
svmAllocsManager = new SVMAllocsManager(memoryManager); svmAllocsManager = new SVMAllocsManager(memoryManager);

View File

@@ -531,7 +531,7 @@ struct DrmCsrVfeTests : ::testing::Test {
}; };
HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForDefaultContextWhenLowPriorityIsFlushedThenReprogram) { HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForDefaultContextWhenLowPriorityIsFlushedThenReprogram) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>; auto mockCsr = new MyCsr<FamilyType>;
device->resetCommandStreamReceiver(mockCsr); device->resetCommandStreamReceiver(mockCsr);
@@ -559,7 +559,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForDefaultContextWhe
} }
HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContextWhenDefaultPriorityIsFlushedThenReprogram) { HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContextWhenDefaultPriorityIsFlushedThenReprogram) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>; auto mockCsr = new MyCsr<FamilyType>;
device->resetCommandStreamReceiver(mockCsr); device->resetCommandStreamReceiver(mockCsr);
@@ -587,7 +587,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContex
} }
HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContextWhenLowPriorityIsFlushedThenDontReprogram) { HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContextWhenLowPriorityIsFlushedThenDontReprogram) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>; auto mockCsr = new MyCsr<FamilyType>;
device->resetCommandStreamReceiver(mockCsr); device->resetCommandStreamReceiver(mockCsr);
@@ -615,7 +615,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContex
} }
HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedLowWithScratchRequirementThenMakeDefaultDirty) { HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedLowWithScratchRequirementThenMakeDefaultDirty) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>; auto mockCsr = new MyCsr<FamilyType>;
device->resetCommandStreamReceiver(mockCsr); device->resetCommandStreamReceiver(mockCsr);
@@ -636,7 +636,7 @@ HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedLowWit
} }
HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedDefaultWithScratchRequirementThenMakeLowDirty) { HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedDefaultWithScratchRequirementThenMakeLowDirty) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>; auto mockCsr = new MyCsr<FamilyType>;
device->resetCommandStreamReceiver(mockCsr); device->resetCommandStreamReceiver(mockCsr);
@@ -989,7 +989,7 @@ TEST_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSetToBatchingT
tCsr->makeResident(*dummyAllocation); tCsr->makeResident(*dummyAllocation);
std::unique_ptr<Device> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
tCsr->getMemoryManager()->device = device.get(); tCsr->getMemoryManager()->device = device.get();
@@ -1044,7 +1044,7 @@ TEST_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhenItIsSubmitte
auto commandBuffer = mm->allocateGraphicsMemory(1024); auto commandBuffer = mm->allocateGraphicsMemory(1024);
auto dummyAllocation = mm->allocateGraphicsMemory(1024); auto dummyAllocation = mm->allocateGraphicsMemory(1024);
IndirectHeap cs(commandBuffer); IndirectHeap cs(commandBuffer);
std::unique_ptr<Device> device(DeviceHelper<>::create(nullptr)); std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
tCsr->getMemoryManager()->device = device.get(); tCsr->getMemoryManager()->device = device.get();
tCsr->setTagAllocation(tagAllocation); tCsr->setTagAllocation(tagAllocation);

View File

@@ -429,7 +429,7 @@ class MyOSTime : public OSTime {
}; };
int MyOSTime::instanceNum = 0; int MyOSTime::instanceNum = 0;
TEST(EventProfilingTest, givenEventWhenCompleteIsZeroThenCalcProfilingDataSetsEndTimestampInCompleteTimestampAndDoesntCallOsTimeMethods) { TEST(EventProfilingTest, givenEventWhenCompleteIsZeroThenCalcProfilingDataSetsEndTimestampInCompleteTimestampAndDoesntCallOsTimeMethods) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create()); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MyOSTime::instanceNum = 0; MyOSTime::instanceNum = 0;
device->setOSTime(new MyOSTime()); device->setOSTime(new MyOSTime());
EXPECT_EQ(1, MyOSTime::instanceNum); EXPECT_EQ(1, MyOSTime::instanceNum);

View File

@@ -33,7 +33,7 @@
using namespace OCLRT; using namespace OCLRT;
TEST(PrintfHandlerTest, givenNotPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResultIsNullptr) { TEST(PrintfHandlerTest, givenNotPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResultIsNullptr) {
MockDevice *device = DeviceHelper<>::create(); MockDevice *device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
MockContext context; MockContext context;
SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface(); SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface();
pPrintfSurface->DataParamOffset = 0; pPrintfSurface->DataParamOffset = 0;
@@ -59,7 +59,7 @@ TEST(PrintfHandlerTest, givenNotPreparedPrintfHandlerWhenGetSurfaceIsCalledThenR
} }
TEST(PrintfHandlerTest, givenPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResultIsNullptr) { TEST(PrintfHandlerTest, givenPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResultIsNullptr) {
MockDevice *device = DeviceHelper<>::create(); MockDevice *device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
MockContext context; MockContext context;
SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface(); SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface();
pPrintfSurface->DataParamOffset = 0; pPrintfSurface->DataParamOffset = 0;
@@ -88,7 +88,7 @@ TEST(PrintfHandlerTest, givenPreparedPrintfHandlerWhenGetSurfaceIsCalledThenResu
} }
TEST(PrintfHandlerTest, givenParentKernelWihoutPrintfAndBlockKernelWithPrintfWhenPrintfHandlerCreateCalledThenResaultIsAnObject) { TEST(PrintfHandlerTest, givenParentKernelWihoutPrintfAndBlockKernelWithPrintfWhenPrintfHandlerCreateCalledThenResaultIsAnObject) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create()); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockParentKernel> parentKernelWithoutPrintf(MockParentKernel::create(*device.get(), false, false, false, false)); std::unique_ptr<MockParentKernel> parentKernelWithoutPrintf(MockParentKernel::create(*device.get(), false, false, false, false));
@@ -101,7 +101,7 @@ TEST(PrintfHandlerTest, givenParentKernelWihoutPrintfAndBlockKernelWithPrintfWhe
TEST(PrintfHandlerTest, givenParentKernelAndBlockKernelWithoutPrintfWhenPrintfHandlerCreateCalledThenResaultIsNullptr) { TEST(PrintfHandlerTest, givenParentKernelAndBlockKernelWithoutPrintfWhenPrintfHandlerCreateCalledThenResaultIsNullptr) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create()); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockParentKernel> blockKernelWithoutPrintf(MockParentKernel::create(*device.get(), false, false, false, false, false)); std::unique_ptr<MockParentKernel> blockKernelWithoutPrintf(MockParentKernel::create(*device.get(), false, false, false, false, false));
@@ -113,7 +113,7 @@ TEST(PrintfHandlerTest, givenParentKernelAndBlockKernelWithoutPrintfWhenPrintfHa
} }
TEST(PrintfHandlerTest, givenParentKernelWithPrintfAndBlockKernelWithoutPrintfWhenPrintfHandlerCreateCalledThenResaultIsAnObject) { TEST(PrintfHandlerTest, givenParentKernelWithPrintfAndBlockKernelWithoutPrintfWhenPrintfHandlerCreateCalledThenResaultIsAnObject) {
std::unique_ptr<MockDevice> device(DeviceHelper<>::create()); std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockParentKernel> parentKernelWithPrintfBlockKernelWithoutPrintf(MockParentKernel::create(*device.get(), false, false, false, true, false)); std::unique_ptr<MockParentKernel> parentKernelWithPrintfBlockKernelWithoutPrintf(MockParentKernel::create(*device.get(), false, false, false, true, false));

View File

@@ -31,7 +31,7 @@ extern std::vector<const char *> SourceFileNames;
extern std::vector<const char *> BinaryForSourceFileNames; extern std::vector<const char *> BinaryForSourceFileNames;
extern std::vector<const char *> KernelNames; extern std::vector<const char *> KernelNames;
class ProgramTests : public DeviceFixture, class ProgramTests : public OCLRT::DeviceFixture,
public ::testing::Test, public ::testing::Test,
public OCLRT::ContextFixture { public OCLRT::ContextFixture {

View File

@@ -79,7 +79,7 @@ class MockSchedulerKernel : public SchedulerKernel {
TEST(SchedulerKernelTest, getLws) { TEST(SchedulerKernelTest, getLws) {
MockProgram program; MockProgram program;
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
KernelInfo info; KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device); MockSchedulerKernel kernel(&program, info, *device);
@@ -89,7 +89,7 @@ TEST(SchedulerKernelTest, getLws) {
TEST(SchedulerKernelTest, getGws) { TEST(SchedulerKernelTest, getGws) {
MockProgram program; MockProgram program;
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
KernelInfo info; KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device); MockSchedulerKernel kernel(&program, info, *device);
@@ -105,7 +105,7 @@ TEST(SchedulerKernelTest, getGws) {
TEST(SchedulerKernelTest, setGws) { TEST(SchedulerKernelTest, setGws) {
MockProgram program; MockProgram program;
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
KernelInfo info; KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device); MockSchedulerKernel kernel(&program, info, *device);
@@ -118,7 +118,7 @@ TEST(SchedulerKernelTest, setGws) {
TEST(SchedulerKernelTest, getCurbeSize) { TEST(SchedulerKernelTest, getCurbeSize) {
MockProgram program; MockProgram program;
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
KernelInfo info; KernelInfo info;
uint32_t crossTrheadDataSize = 32; uint32_t crossTrheadDataSize = 32;
uint32_t dshSize = 48; uint32_t dshSize = 48;
@@ -139,7 +139,7 @@ TEST(SchedulerKernelTest, getCurbeSize) {
} }
TEST(SchedulerKernelTest, setArgsForSchedulerKernel) { TEST(SchedulerKernelTest, setArgsForSchedulerKernel) {
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program; MockProgram program;
program.setDevice(device.get()); program.setDevice(device.get());
@@ -166,7 +166,7 @@ TEST(SchedulerKernelTest, setArgsForSchedulerKernel) {
} }
TEST(SchedulerKernelTest, setArgsForSchedulerKernelWithNullDebugQueue) { TEST(SchedulerKernelTest, setArgsForSchedulerKernelWithNullDebugQueue) {
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program; MockProgram program;
program.setDevice(device.get()); program.setDevice(device.get());
@@ -196,7 +196,7 @@ TEST(SchedulerKernelTest, createKernelReflectionForForcedSchedulerDispatch) {
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.ForceDispatchScheduler.set(true); DebugManager.flags.ForceDispatchScheduler.set(true);
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program; MockProgram program;
program.setDevice(device.get()); program.setDevice(device.get());
@@ -211,7 +211,7 @@ TEST(SchedulerKernelTest, createKernelReflectionSecondTimeForForcedSchedulerDisp
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.ForceDispatchScheduler.set(true); DebugManager.flags.ForceDispatchScheduler.set(true);
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program; MockProgram program;
program.setDevice(device.get()); program.setDevice(device.get());
@@ -230,7 +230,7 @@ TEST(SchedulerKernelTest, createKernelReflectionForSchedulerDoesNothing) {
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.ForceDispatchScheduler.set(false); DebugManager.flags.ForceDispatchScheduler.set(false);
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program; MockProgram program;
program.setDevice(device.get()); program.setDevice(device.get());
@@ -243,7 +243,7 @@ TEST(SchedulerKernelTest, createKernelReflectionForSchedulerDoesNothing) {
TEST(SchedulerKernelTest, getCurbeSizeWithNullKernelInfo) { TEST(SchedulerKernelTest, getCurbeSizeWithNullKernelInfo) {
MockProgram program; MockProgram program;
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
KernelInfo info; KernelInfo info;
info.patchInfo.dataParameterStream = nullptr; info.patchInfo.dataParameterStream = nullptr;
@@ -260,7 +260,7 @@ TEST(SchedulerKernelTest, givenForcedSchedulerGwsByDebugVariableWhenSchedulerKer
DebugManager.flags.SchedulerGWS.set(48); DebugManager.flags.SchedulerGWS.set(48);
MockProgram program; MockProgram program;
auto device = unique_ptr<MockDevice>(DeviceHelper<>::create()); auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
KernelInfo info; KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device); MockSchedulerKernel kernel(&program, info, *device);

View File

@@ -28,7 +28,7 @@
class SchedulerSourceTest : public testing::Test { class SchedulerSourceTest : public testing::Test {
public: public:
void SetUp() override { void SetUp() override {
pDevice = DeviceHelper<>::create(); pDevice = OCLRT::MockDevice::createWithNewExecutionEnvironment<OCLRT::MockDevice>(nullptr);
} }
void TearDown() override { void TearDown() override {
delete pDevice; delete pDevice;

View File

@@ -462,7 +462,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenDeviceIsCreated
DebuggerLibrary::setDebuggerActive(false); DebuggerLibrary::setDebuggerActive(false);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor); DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
unique_ptr<MockDevice> device(DeviceHelper<>::create()); unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
EXPECT_EQ(nullptr, device->getSourceLevelDebugger()); EXPECT_EQ(nullptr, device->getSourceLevelDebugger());
EXPECT_FALSE(interceptor.initCalled); EXPECT_FALSE(interceptor.initCalled);