Add instance of gmm helper to execution environment
Change-Id: I1b044611fbad91fbb681ba233938f41502f29056
This commit is contained in:
parent
f26535a93d
commit
94dbdb602d
|
@ -1,4 +1,4 @@
|
|||
#!groovy
|
||||
neoDependenciesRev='775910-972'
|
||||
strategy='EQUAL'
|
||||
allowedCD=297
|
||||
allowedCD=298
|
||||
|
|
|
@ -41,27 +41,15 @@ CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo) {
|
|||
if (csr) {
|
||||
switch (csr) {
|
||||
case CSR_AUB:
|
||||
GmmHelper::initContext(pHwInfo->pPlatform,
|
||||
pHwInfo->pSkuTable,
|
||||
pHwInfo->pWaTable,
|
||||
pHwInfo->pSysInfo);
|
||||
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile", true);
|
||||
break;
|
||||
case CSR_TBX:
|
||||
GmmHelper::initContext(pHwInfo->pPlatform,
|
||||
pHwInfo->pSkuTable,
|
||||
pHwInfo->pWaTable,
|
||||
pHwInfo->pSysInfo);
|
||||
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, false);
|
||||
break;
|
||||
case CSR_HW_WITH_AUB:
|
||||
commandStreamReceiver = funcCreate(*pHwInfo, true);
|
||||
break;
|
||||
case CSR_TBX_WITH_AUB:
|
||||
GmmHelper::initContext(pHwInfo->pPlatform,
|
||||
pHwInfo->pSkuTable,
|
||||
pHwInfo->pWaTable,
|
||||
pHwInfo->pSysInfo);
|
||||
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, true);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -134,6 +134,7 @@ Device::~Device() {
|
|||
}
|
||||
|
||||
bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
|
||||
outDevice.executionEnvironment->initGmm(pHwInfo);
|
||||
CommandStreamReceiver *commandStreamReceiver = createCommandStream(pHwInfo);
|
||||
if (!commandStreamReceiver) {
|
||||
return false;
|
||||
|
|
|
@ -53,9 +53,10 @@ class Device : public BaseObject<_cl_device_id> {
|
|||
static const cl_ulong objectMagic = 0x8055832341AC8D08LL;
|
||||
|
||||
template <typename T>
|
||||
static T *create(const HardwareInfo *pHwInfo) {
|
||||
static T *create(const HardwareInfo *pHwInfo, ExecutionEnvironment *execEnv) {
|
||||
pHwInfo = getDeviceInitHwInfo(pHwInfo);
|
||||
T *device = new T(*pHwInfo);
|
||||
device->connectToExecutionEnvironment(execEnv);
|
||||
if (false == createDeviceImpl(pHwInfo, *device)) {
|
||||
delete device;
|
||||
return nullptr;
|
||||
|
|
|
@ -21,8 +21,15 @@
|
|||
*/
|
||||
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
|
||||
OCLRT::ExecutionEnvironment::~ExecutionEnvironment() {
|
||||
namespace OCLRT {
|
||||
ExecutionEnvironment::ExecutionEnvironment() = default;
|
||||
ExecutionEnvironment::~ExecutionEnvironment() {
|
||||
DeviceFactory::releaseDevices();
|
||||
}
|
||||
void ExecutionEnvironment::initGmm(const HardwareInfo *hwInfo) {
|
||||
gmmHelper.reset(new GmmHelper(hwInfo));
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -23,8 +23,15 @@
|
|||
#include "runtime/utilities/reference_tracked_object.h"
|
||||
|
||||
namespace OCLRT {
|
||||
class GmmHelper;
|
||||
struct HardwareInfo;
|
||||
class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment> {
|
||||
public:
|
||||
ExecutionEnvironment();
|
||||
~ExecutionEnvironment() override;
|
||||
void initGmm(const HardwareInfo *hwInfo);
|
||||
|
||||
protected:
|
||||
std::unique_ptr<GmmHelper> gmmHelper;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -30,9 +30,10 @@
|
|||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/sku_info/operations/sku_info_transfer.h"
|
||||
#include "runtime/os_interface/os_library.h"
|
||||
|
||||
namespace OCLRT {
|
||||
bool GmmHelper::initContext(const PLATFORM *pPlatform,
|
||||
void GmmHelper::initContext(const PLATFORM *pPlatform,
|
||||
const FeatureTable *pSkuTable,
|
||||
const WorkaroundTable *pWaTable,
|
||||
const GT_SYSTEM_INFO *pGtSysInfo) {
|
||||
|
@ -41,14 +42,12 @@ bool GmmHelper::initContext(const PLATFORM *pPlatform,
|
|||
_WA_TABLE gmmWaTable = {};
|
||||
SkuInfoTransfer::transferFtrTableForGmm(&gmmFtrTable, pSkuTable);
|
||||
SkuInfoTransfer::transferWaTableForGmm(&gmmWaTable, pWaTable);
|
||||
if (!isLoaded) {
|
||||
loadLib();
|
||||
}
|
||||
loadLib();
|
||||
bool success = GMM_SUCCESS == initGlobalContextFunc(*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA);
|
||||
UNRECOVERABLE_IF(!success);
|
||||
GmmHelper::gmmClientContext = GmmHelper::createClientContextFunc(GMM_CLIENT::GMM_OCL_VISTA);
|
||||
}
|
||||
return GmmHelper::gmmClientContext != nullptr;
|
||||
UNRECOVERABLE_IF(!GmmHelper::gmmClientContext);
|
||||
}
|
||||
|
||||
void GmmHelper::destroyContext() {
|
||||
|
@ -56,6 +55,10 @@ void GmmHelper::destroyContext() {
|
|||
deleteClientContextFunc(GmmHelper::gmmClientContext);
|
||||
GmmHelper::gmmClientContext = nullptr;
|
||||
destroyGlobalContextFunc();
|
||||
if (gmmLib) {
|
||||
delete gmmLib;
|
||||
gmmLib = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +70,6 @@ uint32_t GmmHelper::getMOCS(uint32_t type) {
|
|||
return cacheEnabledIndex;
|
||||
}
|
||||
}
|
||||
|
||||
MEMORY_OBJECT_CONTROL_STATE mocs = GmmHelper::gmmClientContext->CachePolicyGetMemoryObject(nullptr, static_cast<GMM_RESOURCE_USAGE_TYPE>(type));
|
||||
|
||||
return static_cast<uint32_t>(mocs.DwordValue);
|
||||
|
@ -159,10 +161,17 @@ GMM_YUV_PLANE GmmHelper::convertPlane(OCLPlane oclPlane) {
|
|||
|
||||
return GMM_NO_PLANE;
|
||||
}
|
||||
|
||||
GmmHelper::GmmHelper(const HardwareInfo *pHwInfo) {
|
||||
GmmHelper::hwInfo = pHwInfo;
|
||||
initContext(pHwInfo->pPlatform, pHwInfo->pSkuTable, pHwInfo->pWaTable, pHwInfo->pSysInfo);
|
||||
}
|
||||
GmmHelper::~GmmHelper() {
|
||||
if (isLoaded) {
|
||||
destroyContext();
|
||||
}
|
||||
}
|
||||
bool GmmHelper::useSimplifiedMocsTable = false;
|
||||
GMM_CLIENT_CONTEXT *GmmHelper::gmmClientContext = nullptr;
|
||||
const HardwareInfo *GmmHelper::hwInfo = nullptr;
|
||||
bool GmmHelper::isLoaded = false;
|
||||
|
||||
OsLibrary *GmmHelper::gmmLib = nullptr;
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -35,18 +35,17 @@ struct WorkaroundTable;
|
|||
struct ImageInfo;
|
||||
class GraphicsAllocation;
|
||||
class Gmm;
|
||||
class OsLibrary;
|
||||
|
||||
class GmmHelper {
|
||||
public:
|
||||
GmmHelper() = delete;
|
||||
GmmHelper(const HardwareInfo *hwInfo);
|
||||
~GmmHelper();
|
||||
static constexpr uint32_t cacheDisabledIndex = 0;
|
||||
static constexpr uint32_t cacheEnabledIndex = 4;
|
||||
static constexpr uint32_t maxPossiblePitch = 2147483648;
|
||||
|
||||
static void loadLib();
|
||||
static bool initContext(const PLATFORM *pPlatform, const FeatureTable *pSkuTable, const WorkaroundTable *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo);
|
||||
static void destroyContext();
|
||||
|
||||
static uint64_t canonize(uint64_t address);
|
||||
static uint64_t decanonize(uint64_t address);
|
||||
|
||||
|
@ -67,6 +66,13 @@ class GmmHelper {
|
|||
static bool useSimplifiedMocsTable;
|
||||
static GMM_CLIENT_CONTEXT *gmmClientContext;
|
||||
static const HardwareInfo *hwInfo;
|
||||
static bool isLoaded;
|
||||
static OsLibrary *gmmLib;
|
||||
|
||||
protected:
|
||||
void loadLib();
|
||||
void initContext(const PLATFORM *pPlatform, const FeatureTable *pSkuTable, const WorkaroundTable *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo);
|
||||
void destroyContext();
|
||||
|
||||
bool isLoaded = false;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
|
||||
namespace OCLRT {
|
||||
GmmMemoryBase::GmmMemoryBase() {
|
||||
clientContext = GmmHelper::gmmClientContext;
|
||||
}
|
||||
bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
|
@ -33,7 +36,7 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
|||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_SIZE_T SizeOverride,
|
||||
GMM_GFX_SIZE_T SlmGfxSpaceReserve) {
|
||||
return GmmHelper::gmmClientContext->ConfigureDeviceAddressSpace(
|
||||
return clientContext->ConfigureDeviceAddressSpace(
|
||||
{hAdapter},
|
||||
{hDevice},
|
||||
{pfnEscape},
|
||||
|
@ -46,7 +49,7 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
|||
}
|
||||
|
||||
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
||||
return static_cast<uintptr_t>(GmmHelper::gmmClientContext->GetInternalGpuVaRangeLimit());
|
||||
return static_cast<uintptr_t>(clientContext->GetInternalGpuVaRangeLimit());
|
||||
}
|
||||
|
||||
}; // namespace OCLRT
|
||||
|
|
|
@ -42,6 +42,7 @@ class GmmMemoryBase {
|
|||
MOCKABLE_VIRTUAL uintptr_t getInternalGpuVaRangeLimit();
|
||||
|
||||
protected:
|
||||
GmmMemoryBase() = default;
|
||||
GmmMemoryBase();
|
||||
GMM_CLIENT_CONTEXT *clientContext;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
namespace OCLRT {
|
||||
class GmmPageTableMngr {
|
||||
public:
|
||||
MOCKABLE_VIRTUAL ~GmmPageTableMngr() = default;
|
||||
MOCKABLE_VIRTUAL ~GmmPageTableMngr();
|
||||
|
||||
static GmmPageTableMngr *create(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
||||
|
||||
|
@ -45,13 +45,10 @@ class GmmPageTableMngr {
|
|||
}
|
||||
|
||||
protected:
|
||||
static void customDeleter(GMM_PAGETABLE_MGR *gmmPageTableManager);
|
||||
using UniquePtrType = std::unique_ptr<GMM_PAGETABLE_MGR, std::function<void(GMM_PAGETABLE_MGR *)>>;
|
||||
|
||||
GmmPageTableMngr() = default;
|
||||
|
||||
GmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
||||
|
||||
UniquePtrType pageTableManager;
|
||||
GMM_CLIENT_CONTEXT *clientContext = nullptr;
|
||||
GMM_PAGETABLE_MGR *pageTableManager = nullptr;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -24,13 +24,15 @@
|
|||
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||
|
||||
namespace OCLRT {
|
||||
void GmmPageTableMngr::customDeleter(GMM_PAGETABLE_MGR *gmmPageTableManager) {
|
||||
GmmHelper::gmmClientContext->DestroyPageTblMgrObject(gmmPageTableManager);
|
||||
GmmPageTableMngr::~GmmPageTableMngr() {
|
||||
if (clientContext) {
|
||||
clientContext->DestroyPageTblMgrObject(pageTableManager);
|
||||
}
|
||||
}
|
||||
|
||||
GmmPageTableMngr::GmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||
auto pageTableMngrPtr = GmmHelper::gmmClientContext->CreatePageTblMgrObject(deviceCb, translationTableCb, translationTableFlags);
|
||||
this->pageTableManager = UniquePtrType(pageTableMngrPtr, GmmPageTableMngr::customDeleter);
|
||||
this->clientContext = GmmHelper::gmmClientContext;
|
||||
pageTableManager = clientContext->CreatePageTblMgrObject(deviceCb, translationTableCb, translationTableFlags);
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -75,8 +75,7 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
|
|||
DeviceFactory::numDevices = devNum;
|
||||
DeviceFactory::hwInfos = ptr;
|
||||
|
||||
return GmmHelper::initContext(hwInfos->pPlatform, hwInfos->pSkuTable,
|
||||
hwInfos->pWaTable, hwInfos->pSysInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeviceFactory::releaseDevices() {
|
||||
|
|
|
@ -39,9 +39,8 @@ decltype(GmmHelper::destroyGlobalContextFunc) GmmHelper::destroyGlobalContextFun
|
|||
decltype(GmmHelper::createClientContextFunc) GmmHelper::createClientContextFunc = nullptr;
|
||||
decltype(GmmHelper::deleteClientContextFunc) GmmHelper::deleteClientContextFunc = nullptr;
|
||||
|
||||
std::unique_ptr<OsLibrary> gmmLib;
|
||||
void GmmHelper::loadLib() {
|
||||
gmmLib.reset(OsLibrary::load(Os::gmmDllName));
|
||||
gmmLib = OsLibrary::load(Os::gmmDllName);
|
||||
|
||||
UNRECOVERABLE_IF(!gmmLib);
|
||||
if (gmmLib->isLoaded()) {
|
||||
|
|
|
@ -85,8 +85,6 @@ Wddm::Wddm() : initialized(false),
|
|||
|
||||
Wddm::~Wddm() {
|
||||
resetPageTableManager(nullptr);
|
||||
if (initialized)
|
||||
destroyGmmContext();
|
||||
destroyContext(context);
|
||||
destroyPagingQueue();
|
||||
destroyDevice();
|
||||
|
|
|
@ -211,8 +211,6 @@ class Wddm {
|
|||
void getDeviceState();
|
||||
void handleCompletion();
|
||||
unsigned int readEnablePreemptionRegKey();
|
||||
bool initGmmContext();
|
||||
void destroyGmmContext();
|
||||
void resetMonitoredFenceParams(D3DKMT_HANDLE &handle, uint64_t *cpuAddress, D3DGPU_VIRTUAL_ADDRESS &gpuAddress);
|
||||
virtual const bool hwQueuesSupported() const { return false; }
|
||||
|
||||
|
|
|
@ -52,9 +52,6 @@ bool Wddm::init() {
|
|||
if (!createPagingQueue()) {
|
||||
return false;
|
||||
}
|
||||
if (!initGmmContext()) {
|
||||
return false;
|
||||
}
|
||||
if (!configureDeviceAddressSpace<GfxFamily>()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -40,15 +40,4 @@ Wddm::VirtualFreeFcn getVirtualFree() {
|
|||
Wddm::VirtualAllocFcn getVirtualAlloc() {
|
||||
return VirtualAlloc;
|
||||
}
|
||||
|
||||
bool Wddm::initGmmContext() {
|
||||
return GmmHelper::initContext(gfxPlatform.get(),
|
||||
featureTable.get(),
|
||||
waTable.get(),
|
||||
gtSystemInfo.get());
|
||||
}
|
||||
|
||||
void Wddm::destroyGmmContext() {
|
||||
GmmHelper::destroyContext();
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -148,7 +148,7 @@ bool Platform::initialize() {
|
|||
|
||||
this->devices.resize(numDevicesReturned);
|
||||
for (size_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) {
|
||||
auto pDevice = Device::create<OCLRT::Device>(&hwInfo[deviceOrdinal]);
|
||||
auto pDevice = Device::create<OCLRT::Device>(&hwInfo[deviceOrdinal], executionEnvironment);
|
||||
DEBUG_BREAK_IF(!pDevice);
|
||||
if (pDevice) {
|
||||
this->devices[deviceOrdinal] = pDevice;
|
||||
|
@ -168,7 +168,6 @@ bool Platform::initialize() {
|
|||
}
|
||||
|
||||
compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(pDevice->getDeviceInfo().deviceExtensions);
|
||||
pDevice->connectToExecutionEnvironment(this->executionEnvironment);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ void api_fixture_using_aligned_memory_manager::SetUp() {
|
|||
retVal = CL_SUCCESS;
|
||||
retSize = 0;
|
||||
|
||||
device = Device::create<MockAlignedMallocManagerDevice>(*platformDevices);
|
||||
device = MockDevice::createWithNewExecutionEnvironment<MockAlignedMallocManagerDevice>(*platformDevices);
|
||||
Device *devPtr = reinterpret_cast<Device *>(device);
|
||||
cl_device_id clDevice = devPtr;
|
||||
|
||||
|
|
|
@ -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
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -80,7 +80,7 @@ TEST_F(clGetDeviceAndHostTimerTest, OsCallPass) {
|
|||
cl_ulong host_timestamp = 0;
|
||||
cl_ulong zero_timestamp = 0;
|
||||
|
||||
auto mDev = Device::create<MockDevice>(nullptr);
|
||||
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
|
||||
mDev->setOSTime(new MockOSTime());
|
||||
|
||||
retVal = clGetDeviceAndHostTimer(
|
||||
|
@ -100,7 +100,7 @@ TEST_F(clGetDeviceAndHostTimerTest, OsCallFail) {
|
|||
cl_ulong host_timestamp = 0;
|
||||
cl_ulong zero_timestamp = 0;
|
||||
|
||||
auto mDev = Device::create<MockDevice>(nullptr);
|
||||
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
|
||||
mDev->setOSTime(new FailOSTime());
|
||||
|
||||
retVal = clGetDeviceAndHostTimer(
|
||||
|
@ -149,7 +149,7 @@ TEST_F(clGetHostTimerTest, OsCallPass) {
|
|||
cl_ulong host_timestamp = 0;
|
||||
cl_ulong zero_timestamp = 0;
|
||||
|
||||
auto mDev = Device::create<MockDevice>(nullptr);
|
||||
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
|
||||
mDev->setOSTime(new MockOSTime());
|
||||
|
||||
retVal = clGetHostTimer(
|
||||
|
@ -166,7 +166,7 @@ TEST_F(clGetHostTimerTest, OsCallFail) {
|
|||
cl_ulong host_timestamp = 0;
|
||||
cl_ulong zero_timestamp = 0;
|
||||
|
||||
auto mDev = Device::create<MockDevice>(nullptr);
|
||||
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
|
||||
mDev->setOSTime(new FailOSTime());
|
||||
|
||||
retVal = clGetHostTimer(
|
||||
|
|
|
@ -61,7 +61,7 @@ TEST(Sip, WhenRequestingCsrSipKernelThenProperCompilerInternalOptionsAreReturned
|
|||
}
|
||||
|
||||
TEST(Sip, When32BitAddressesAreNotBeingForcedThenSipLlHasSameBitnessAsHostApplication) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
mockDevice->setForce32BitAddressing(false);
|
||||
const char *src = getSipLlSrc(*mockDevice);
|
||||
|
@ -77,7 +77,7 @@ TEST(Sip, When32BitAddressesAreNotBeingForcedThenSipLlHasSameBitnessAsHostApplic
|
|||
}
|
||||
|
||||
TEST(Sip, When32BitAddressesAreBeingForcedThenSipLlHas32BitAddresses) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
mockDevice->setForce32BitAddressing(true);
|
||||
const char *src = getSipLlSrc(*mockDevice);
|
||||
|
@ -88,7 +88,7 @@ TEST(Sip, When32BitAddressesAreBeingForcedThenSipLlHas32BitAddresses) {
|
|||
}
|
||||
|
||||
TEST(Sip, SipLlContainsMetadataRequiredByCompiler) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
const char *src = getSipLlSrc(*mockDevice);
|
||||
ASSERT_NE(nullptr, src);
|
||||
|
@ -138,7 +138,7 @@ TEST(DebugSip, WhenRequestingDbgCsrWithLocalMemorySipKernelThenProperCompilerInt
|
|||
}
|
||||
|
||||
TEST(DebugSip, DISABLED_givenBuiltInsWhenDbgCsrSipIsRequestedThanCorrectSipKernelIsReturned) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ TEST(CommandQueue, givenCmdQueueBlockedByReadyVirtualEventWhenUnblockingThenUpda
|
|||
|
||||
TEST(CommandQueue, givenCmdQueueBlockedByAbortedVirtualEventWhenUnblockingThenUpdateFlushTaskFromEvent) {
|
||||
auto context = new MockContext;
|
||||
std::unique_ptr<MockDevice> mockDevice(Device::create<MockDevice>(nullptr));
|
||||
std::unique_ptr<MockDevice> mockDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto cmdQ = new CommandQueue(context, mockDevice.get(), 0);
|
||||
|
||||
auto userEvent = new Event(cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
|
||||
|
@ -272,7 +272,7 @@ struct CommandQueueCommandStreamTest : public CommandQueueMemoryDevice,
|
|||
|
||||
HWTEST_F(CommandQueueCommandStreamTest, givenCommandQueueThatWaitsOnAbortedUserEventWhenIsQueueBlockedIsCalledThenTaskLevelAlignsToCsr) {
|
||||
MockContext context;
|
||||
std::unique_ptr<MockDevice> mockDevice(Device::create<MockDevice>(nullptr));
|
||||
std::unique_ptr<MockDevice> mockDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
CommandQueue cmdQ(&context, mockDevice.get(), 0);
|
||||
auto &commandStreamReceiver = mockDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
@ -679,7 +679,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
|
||||
using CommandQueueTests = ::testing::Test;
|
||||
HWTEST_F(CommandQueueTests, givenMultipleCommandQueuesWhenMarkerIsEmittedThenGraphicsAllocationIsReused) {
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(*platformDevices));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
||||
MockContext context(device.get());
|
||||
std::unique_ptr<CommandQueue> commandQ(new CommandQueue(&context, device.get(), 0));
|
||||
*device->getTagAddress() = 0;
|
||||
|
@ -710,7 +710,7 @@ struct WaitForQueueCompletionTests : public ::testing::Test {
|
|||
};
|
||||
|
||||
void SetUp() override {
|
||||
device.reset(Device::create<MockDevice>(*platformDevices));
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
||||
context.reset(new MockContext(device.get()));
|
||||
}
|
||||
|
||||
|
|
|
@ -477,7 +477,7 @@ TEST(SubmissionsAggregator, dontAllocateFlushStamp) {
|
|||
|
||||
struct SubmissionsAggregatorTests : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
device.reset(Device::create<MockDevice>(platformDevices[0]));
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
context.reset(new MockContext(device.get()));
|
||||
}
|
||||
|
||||
|
|
|
@ -704,7 +704,7 @@ const std::string DriverInfoMock::testDeviceName = "testDeviceName";
|
|||
const std::string DriverInfoMock::testVersion = "testVersion";
|
||||
|
||||
TEST(Device_GetCaps, givenSystemWithDriverInfoWhenGettingNameAndVersionThenReturnValuesFromDriverInfo) {
|
||||
auto device = Device::create<OCLRT::MockDevice>(platformDevices[0]);
|
||||
auto device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]);
|
||||
|
||||
DriverInfoMock *driverInfoMock = new DriverInfoMock();
|
||||
device->setDriverInfo(driverInfoMock);
|
||||
|
@ -718,7 +718,7 @@ TEST(Device_GetCaps, givenSystemWithDriverInfoWhenGettingNameAndVersionThenRetur
|
|||
}
|
||||
|
||||
TEST(Device_GetCaps, givenSystemWithNoDriverInfoWhenGettingNameAndVersionThenReturnDefaultValues) {
|
||||
auto device = Device::create<OCLRT::MockDevice>(platformDevices[0]);
|
||||
auto device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]);
|
||||
|
||||
device->setDriverInfo(nullptr);
|
||||
device->name.clear();
|
||||
|
@ -777,7 +777,7 @@ TEST(Device_GetCaps, GivenFlagEnabled64kbPagesWhenSetThenReturnCorrectValue) {
|
|||
}
|
||||
|
||||
TEST(Device_GetCaps, givenDeviceWithNullSourceLevelDebuggerWhenCapsAreInitializedThenSourceLevelDebuggerActiveIsSetToFalse) {
|
||||
std::unique_ptr<Device> device(Device::create<OCLRT::MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
|
||||
const auto &caps = device->getDeviceInfo();
|
||||
EXPECT_EQ(nullptr, device->getSourceLevelDebugger());
|
||||
|
@ -790,7 +790,7 @@ TEST_F(DeviceCapsWithModifiedHwInfoTest, givenPlatformWithSourceLevelDebuggerNot
|
|||
|
||||
hwInfo.capabilityTable.sourceLevelDebuggerSupported = false;
|
||||
|
||||
std::unique_ptr<MockDeviceWithSourceLevelDebugger<>> device(Device::create<MockDeviceWithSourceLevelDebugger<>>(&hwInfo));
|
||||
std::unique_ptr<MockDeviceWithSourceLevelDebugger<>> device(MockDevice::createWithNewExecutionEnvironment<MockDeviceWithSourceLevelDebugger<>>(&hwInfo));
|
||||
|
||||
const auto &caps = device->getDeviceInfo();
|
||||
EXPECT_NE(nullptr, device->getSourceLevelDebugger());
|
||||
|
|
|
@ -134,13 +134,13 @@ struct SmallMockDevice : public Device {
|
|||
|
||||
TEST(DeviceCreation, givenDeviceWithUsedTagAllocationWhenItIsDestroyedThenThereAreNoCrashesAndLeaks) {
|
||||
overrideCommandStreamReceiverCreation = 1;
|
||||
std::unique_ptr<SmallMockDevice> device(Device::create<SmallMockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<SmallMockDevice> device(MockDevice::createWithNewExecutionEnvironment<SmallMockDevice>(platformDevices[0]));
|
||||
auto tagAllocation = device->peekTagAllocation();
|
||||
tagAllocation->taskCount = 1;
|
||||
}
|
||||
|
||||
TEST(DeviceCleanup, givenDeviceWhenItIsDestroyedThenFlushBatchedSubmissionsIsCalled) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockCommandStreamReceiver *csr = new MockCommandStreamReceiver;
|
||||
mockDevice->resetCommandStreamReceiver(csr);
|
||||
int flushedBatchedSubmissionsCalledCount = 0;
|
||||
|
@ -155,7 +155,7 @@ TEST(DeviceCreation, givenSelectedAubCsrInDebugVarsWhenDeviceIsCreatedThenIsSimu
|
|||
DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_AUB);
|
||||
|
||||
overrideCommandStreamReceiverCreation = true;
|
||||
auto mockDevice = std::unique_ptr<Device>(Device::create<Device>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
EXPECT_TRUE(mockDevice->isSimulation());
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ TEST(DeviceCreation, givenSelectedTbxCsrInDebugVarsWhenDeviceIsCreatedThenIsSimu
|
|||
DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_TBX);
|
||||
|
||||
overrideCommandStreamReceiverCreation = true;
|
||||
auto device = std::unique_ptr<Device>(Device::create<Device>(nullptr));
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
EXPECT_TRUE(device->isSimulation());
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ TEST(DeviceCreation, givenSelectedTbxWithAubCsrInDebugVarsWhenDeviceIsCreatedThe
|
|||
DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_TBX_WITH_AUB);
|
||||
|
||||
overrideCommandStreamReceiverCreation = true;
|
||||
auto device = std::unique_ptr<Device>(Device::create<Device>(nullptr));
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
EXPECT_TRUE(device->isSimulation());
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ TEST(DeviceCreation, givenHwWithAubCsrInDebugVarsWhenDeviceIsCreatedThenIsSimula
|
|||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_HW_WITH_AUB);
|
||||
|
||||
auto device = std::unique_ptr<Device>(Device::create<Device>(nullptr));
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
EXPECT_FALSE(device->isSimulation());
|
||||
}
|
||||
|
||||
|
@ -189,6 +189,6 @@ TEST(DeviceCreation, givenDefaultHwCsrInDebugVarsWhenDeviceIsCreatedThenIsSimula
|
|||
int32_t defaultHwCsr = CommandStreamReceiverType::CSR_HW;
|
||||
EXPECT_EQ(defaultHwCsr, DebugManager.flags.SetCommandStreamReceiver.get());
|
||||
|
||||
auto device = std::unique_ptr<Device>(Device::create<Device>(nullptr));
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
EXPECT_FALSE(device->isSimulation());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -31,7 +31,7 @@ TEST(MockOSTime, DeviceHostIncreaseCheck) {
|
|||
cl_ulong deviceTimestamp[2] = {0, 0};
|
||||
cl_ulong hostTimestamp[2] = {0, 0};
|
||||
|
||||
auto mDev = Device::create<MockDevice>(nullptr);
|
||||
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
|
||||
mDev->setOSTime(new MockOSTime());
|
||||
|
||||
mDev->getDeviceAndHostTimer(
|
||||
|
@ -97,7 +97,7 @@ TEST(MockOSTime, DeviceHostDeltaCheck) {
|
|||
TEST(MockOSTime, HostIncreaseCheck) {
|
||||
cl_ulong hostTimestamp[2] = {0, 0};
|
||||
|
||||
auto mDev = Device::create<MockDevice>(nullptr);
|
||||
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
|
||||
mDev->setOSTime(new MockOSTime());
|
||||
|
||||
mDev->getHostTimer(
|
||||
|
@ -114,7 +114,7 @@ TEST(MockOSTime, HostIncreaseCheck) {
|
|||
}
|
||||
|
||||
TEST(MockOSTime, NegativeTest) {
|
||||
auto mDev = Device::create<MockDevice>(nullptr);
|
||||
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
|
||||
mDev->setOSTime(nullptr);
|
||||
|
||||
double zeroRes;
|
||||
|
|
|
@ -494,7 +494,7 @@ class DeviceQueueHwWithKernel : public ExecutionModelKernelFixture {
|
|||
0, 0, 0};
|
||||
cl_int errcodeRet = 0;
|
||||
|
||||
device = Device::create<OCLRT::MockDevice>(platformDevices[0]);
|
||||
device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]);
|
||||
context = new MockContext();
|
||||
ASSERT_NE(nullptr, context);
|
||||
|
||||
|
@ -625,7 +625,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, resetDeviceQueueSetEa
|
|||
|
||||
DebugManager.flags.SchedulerSimulationReturnInstance.set(3);
|
||||
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
MockContext context;
|
||||
std::unique_ptr<MockDeviceQueueHw<FamilyType>> mockDeviceQueueHw(new MockDeviceQueueHw<FamilyType>(&context, device.get(), deviceQueueProperties::minimumProperties[0]));
|
||||
|
||||
|
@ -639,7 +639,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, addMediaStateClearCmd
|
|||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
using MEDIA_VFE_STATE = typename FamilyType::MEDIA_VFE_STATE;
|
||||
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
MockContext context;
|
||||
std::unique_ptr<MockDeviceQueueHw<FamilyType>> mockDeviceQueueHw(new MockDeviceQueueHw<FamilyType>(&context, device.get(), deviceQueueProperties::minimumProperties[0]));
|
||||
|
||||
|
@ -683,7 +683,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, addExecutionModelClea
|
|||
addMediaStateClearCmdsCalled = true;
|
||||
}
|
||||
};
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
MockContext context;
|
||||
std::unique_ptr<MockDeviceQueueWithMediaStateClearRegistering> mockDeviceQueueHw(new MockDeviceQueueWithMediaStateClearRegistering(&context, device.get(), deviceQueueProperties::minimumProperties[0]));
|
||||
|
||||
|
@ -700,7 +700,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, getMediaStateClearCmd
|
|||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
using MEDIA_VFE_STATE = typename FamilyType::MEDIA_VFE_STATE;
|
||||
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
MockContext context;
|
||||
std::unique_ptr<MockDeviceQueueHw<FamilyType>> mockDeviceQueueHw(new MockDeviceQueueHw<FamilyType>(&context, device.get(), deviceQueueProperties::minimumProperties[0]));
|
||||
|
||||
|
@ -716,7 +716,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, getExecutionModelClea
|
|||
using MI_MATH = typename FamilyType::MI_MATH;
|
||||
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
|
||||
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
MockContext context;
|
||||
std::unique_ptr<MockDeviceQueueHw<FamilyType>> mockDeviceQueueHw(new MockDeviceQueueHw<FamilyType>(&context, device.get(), deviceQueueProperties::minimumProperties[0]));
|
||||
|
||||
|
@ -741,7 +741,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, getProfilingEndCmdsSi
|
|||
using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM;
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
MockContext context;
|
||||
std::unique_ptr<MockDeviceQueueHw<FamilyType>> mockDeviceQueueHw(new MockDeviceQueueHw<FamilyType>(&context, device.get(), deviceQueueProperties::minimumProperties[0]));
|
||||
|
||||
|
|
|
@ -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
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -35,7 +35,7 @@ struct DeviceDefaults {
|
|||
template <typename DeviceTraits = DeviceDefaults>
|
||||
struct DeviceHelper {
|
||||
static OCLRT::MockDevice *create(const OCLRT::HardwareInfo *hardwareInfo = nullptr) {
|
||||
OCLRT::MockDevice *device = OCLRT::Device::create<OCLRT::MockDevice>(hardwareInfo);
|
||||
OCLRT::MockDevice *device = OCLRT::MockDevice::createWithNewExecutionEnvironment<OCLRT::MockDevice>(hardwareInfo);
|
||||
assert(device != nullptr);
|
||||
return device;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class KernelDataTest : public testing::Test {
|
|||
protected:
|
||||
void SetUp() override {
|
||||
kernelBinaryHeader.KernelNameSize = kernelNameSize;
|
||||
pDevice = Device::create<MockDevice>(nullptr);
|
||||
pDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
|
|
@ -50,7 +50,7 @@ void DevicePreemptionTests::SetUp() {
|
|||
}
|
||||
const cl_queue_properties properties[3] = {CL_QUEUE_PROPERTIES, 0, 0};
|
||||
kernelInfo.reset(KernelInfo::create());
|
||||
device.reset(MockDevice::create<OCLRT::MockDevice>(nullptr));
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
context.reset(new MockContext(device.get()));
|
||||
cmdQ.reset(new MockCommandQueue(context.get(), device.get(), properties));
|
||||
executionEnvironment.reset(new SPatchExecutionEnvironment);
|
||||
|
|
|
@ -45,7 +45,7 @@ struct Gen10CoherencyRequirements : public ::testing::Test {
|
|||
|
||||
void SetUp() override {
|
||||
csr = new myCsr();
|
||||
device.reset(Device::create<MockDevice>(platformDevices[0]));
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
device->resetCommandStreamReceiver(csr);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ GEN10TEST_F(PreambleTestGen10, givenDisabledPreemptionAndDisabledDebuggingWhenPr
|
|||
GEN10TEST_F(PreambleTestGen10, givenKernelDebuggingActiveAndDisabledPreemptionWhenGetAdditionalCommandsSizeIsCalledThen2MiLoadRegisterImmCmdsAndStateSipAreInlcuded) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::Disabled));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
mockDevice->setSourceLevelDebuggerActive(false);
|
||||
size_t withoutDebugging = PreambleHelper<FamilyType>::getAdditionalCommandsSize(*mockDevice);
|
||||
|
|
|
@ -201,7 +201,7 @@ using PreambleTestGen10 = ::testing::Test;
|
|||
|
||||
GEN10TEST_F(PreambleTestGen10, givenProgrammingPreambleWhenPreemptionIsTakenIntoAccountThenCSRBaseAddressIsEqualCSRGpuAddress) {
|
||||
using GPGPU_CSR_BASE_ADDRESS = typename FamilyType::GPGPU_CSR_BASE_ADDRESS;
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
mockDevice->setPreemptionMode(PreemptionMode::MidThread);
|
||||
auto cmdSizePreemptionMidThread = PreemptionHelper::getRequiredPreambleSize<FamilyType>(*mockDevice);
|
||||
|
|
|
@ -43,7 +43,7 @@ BDWTEST_F(BdwDeviceTest, givenBdwDeviceWhenAskedForClVersionThenReport21) {
|
|||
}
|
||||
|
||||
BDWTEST_F(BdwDeviceTest, givenSourceLevelDebuggerAvailableWhenDeviceIsCreatedThenSourceLevelDebuggerIsDisabled) {
|
||||
auto device = std::unique_ptr<MockDeviceWithSourceLevelDebugger<MockActiveSourceLevelDebugger>>(Device::create<MockDeviceWithSourceLevelDebugger<MockActiveSourceLevelDebugger>>(nullptr));
|
||||
auto device = std::unique_ptr<MockDeviceWithSourceLevelDebugger<MockActiveSourceLevelDebugger>>(MockDevice::createWithNewExecutionEnvironment<MockDeviceWithSourceLevelDebugger<MockActiveSourceLevelDebugger>>(nullptr));
|
||||
const auto &caps = device->getDeviceInfo();
|
||||
EXPECT_NE(nullptr, device->getSourceLevelDebugger());
|
||||
EXPECT_FALSE(caps.sourceLevelDebuggerActive);
|
||||
|
|
|
@ -62,7 +62,7 @@ GEN9TEST_F(PreambleTestGen9, givenDisabledPreemptionAndDisabledDebuggingWhenPrea
|
|||
GEN9TEST_F(PreambleTestGen9, givenKernelDebuggingActiveAndDisabledPreemptionWhenGetAdditionalCommandsSizeIsCalledThen2MiLoadRegisterImmCmdsAndStateSipAreInlcuded) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::Disabled));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
mockDevice->setSourceLevelDebuggerActive(false);
|
||||
size_t withoutDebugging = PreambleHelper<FamilyType>::getAdditionalCommandsSize(*mockDevice);
|
||||
|
@ -77,7 +77,7 @@ GEN9TEST_F(PreambleTestGen9, givenKernelDebuggingActiveAndDisabledPreemptionWhen
|
|||
|
||||
GEN9TEST_F(PreambleTestGen9, givenProgrammingPreambleWhenPreemptionIsTakenIntoAccountThenCSRBaseAddressIsEqualCSRGpuAddress) {
|
||||
using GPGPU_CSR_BASE_ADDRESS = typename FamilyType::GPGPU_CSR_BASE_ADDRESS;
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
mockDevice->setPreemptionMode(PreemptionMode::MidThread);
|
||||
auto cmdSizePreemptionMidThread = PreemptionHelper::getRequiredPreambleSize<FamilyType>(*mockDevice);
|
||||
|
|
|
@ -37,7 +37,7 @@ extern std::string getDebugSipKernelNameWithBitnessAndProductSuffix(std::string
|
|||
typedef ::testing::Test gen9SipTests;
|
||||
|
||||
GEN9TEST_F(gen9SipTests, DISABLED_givenDebugCsrSipKernelWithLocalMemoryWhenAskedForDebugSurfaceBtiAndSizeThenBtiIsZeroAndSizeGreaterThanZero) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
|
|
|
@ -35,6 +35,10 @@ using namespace ::testing;
|
|||
|
||||
namespace OCLRT {
|
||||
class GmmTests : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
execEnv.initGmm(*platformDevices);
|
||||
}
|
||||
ExecutionEnvironment execEnv;
|
||||
};
|
||||
|
||||
TEST_F(GmmTests, resourceCreation) {
|
||||
|
@ -599,31 +603,31 @@ TEST(GmmTest, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThe
|
|||
EXPECT_FALSE(gmm->unifiedAuxTranslationCapable()); // RenderCompressed == 0
|
||||
}
|
||||
|
||||
class MockGmmHelper : public GmmHelper {
|
||||
public:
|
||||
using GmmHelper::destroyContext;
|
||||
using GmmHelper::initContext;
|
||||
MockGmmHelper(const HardwareInfo *hwInfo) : GmmHelper(hwInfo) {}
|
||||
};
|
||||
|
||||
TEST(GmmTest, whenContextIsInitializedMultipleTimesThenDontOverride) {
|
||||
const HardwareInfo *hwinfo = *platformDevices;
|
||||
EXPECT_TRUE(GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||
auto gmmHelper = MockGmmHelper(hwinfo);
|
||||
auto currentClientContext = GmmHelper::gmmClientContext;
|
||||
|
||||
EXPECT_TRUE(GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||
|
||||
gmmHelper.initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo);
|
||||
EXPECT_EQ(currentClientContext, GmmHelper::gmmClientContext);
|
||||
}
|
||||
|
||||
TEST(GmmTest, whenContextIsDestroyedMultimpleTimesThenDontCrash) {
|
||||
const HardwareInfo *hwinfo = *platformDevices;
|
||||
EXPECT_TRUE(GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||
|
||||
GmmHelper::destroyContext();
|
||||
EXPECT_EQ(nullptr, GmmHelper::gmmClientContext);
|
||||
GmmHelper::destroyContext();
|
||||
|
||||
EXPECT_TRUE(GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||
auto gmmHelper = MockGmmHelper(hwinfo);
|
||||
gmmHelper.destroyContext();
|
||||
}
|
||||
|
||||
TEST(GmmTest, givenHwInfoWhenDeviceIsCreatedTheSetThisHwInfoToGmmHelper) {
|
||||
HardwareInfo localHwInfo = **platformDevices;
|
||||
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(&localHwInfo));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
|
||||
EXPECT_EQ(&localHwInfo, GmmHelper::hwInfo);
|
||||
}
|
||||
|
||||
|
@ -645,7 +649,8 @@ TEST(GmmTest, whenResourceIsCreatedThenHandleItsOwnership) {
|
|||
gmmParams.Flags.Info.Cacheable = 1;
|
||||
gmmParams.Flags.Gpu.Texture = 1;
|
||||
gmmParams.Usage = GMM_RESOURCE_USAGE_OCL_BUFFER;
|
||||
|
||||
ExecutionEnvironment execEnv;
|
||||
execEnv.initGmm(*platformDevices);
|
||||
MyMockResourecInfo myMockResourceInfo1(&gmmParams);
|
||||
EXPECT_NE(nullptr, myMockResourceInfo1.resourceInfo.get());
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ using namespace OCLRT;
|
|||
|
||||
struct KmdNotifyTests : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
device.reset(Device::create<MockDevice>(&localHwInfo));
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
|
||||
cmdQ.reset(new CommandQueue(&context, device.get(), nullptr));
|
||||
*device->getTagAddress() = taskCountToWait;
|
||||
device->getCommandStreamReceiver().waitForFlushStamp(flushStampToWait);
|
||||
|
|
|
@ -369,7 +369,7 @@ HWTEST_TYPED_TEST(KernelArgSvmTestTyped, GivenBufferKernelArgWhenBufferOffsetIsN
|
|||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
constexpr size_t rendSurfSize = sizeof(RENDER_SURFACE_STATE);
|
||||
|
||||
std::unique_ptr<Device> device(Device::create<MockDevice>(*platformDevices));
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
||||
|
||||
uint32_t svmSize = MemoryConstants::pageSize;
|
||||
char *svmPtr = reinterpret_cast<char *>(alignedMalloc(svmSize, MemoryConstants::pageSize));
|
||||
|
|
|
@ -32,7 +32,7 @@ class PatchedKernelTest : public ::testing::Test {
|
|||
public:
|
||||
void SetUp() override {
|
||||
constructPlatform();
|
||||
device.reset(MockDevice::create<MockDevice>(nullptr));
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
context.reset(new MockContext(device.get()));
|
||||
program.reset(Program::create("FillBufferBytes", context.get(), *device.get(), true, &retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
|
|
@ -655,7 +655,7 @@ TEST(KernelReflectionSurfaceTestSingle, CreateKernelReflectionSurfaceCalledOnNon
|
|||
TEST(KernelReflectionSurfaceTestSingle, ObtainKernelReflectionSurfaceWithoutKernelArgs) {
|
||||
MockProgram program;
|
||||
MockContext context;
|
||||
std::unique_ptr<MockDevice> device(Device::create<OCLRT::MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
KernelInfo *blockInfo = new KernelInfo;
|
||||
KernelInfo &info = *blockInfo;
|
||||
cl_queue_properties properties[1] = {0};
|
||||
|
@ -706,7 +706,7 @@ TEST(KernelReflectionSurfaceTestSingle, ObtainKernelReflectionSurfaceWithoutKern
|
|||
TEST(KernelReflectionSurfaceTestSingle, ObtainKernelReflectionSurfaceWithDeviceQueueKernelArg) {
|
||||
MockProgram program;
|
||||
MockContext context;
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
|
||||
KernelInfo *blockInfo = new KernelInfo;
|
||||
KernelInfo &info = *blockInfo;
|
||||
|
|
|
@ -2194,7 +2194,7 @@ TEST(KernelTest, givenKernelWithKernelInfoWith32bitPointerSizeThenReport32bit) {
|
|||
|
||||
MockContext context;
|
||||
MockProgram program(&context, false);
|
||||
std::unique_ptr<MockDevice> device(Device::create<OCLRT::MockDevice>(nullptr));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, info, *device.get()));
|
||||
|
||||
EXPECT_TRUE(kernel->is32Bit());
|
||||
|
@ -2206,7 +2206,7 @@ TEST(KernelTest, givenKernelWithKernelInfoWith64bitPointerSizeThenReport64bit) {
|
|||
|
||||
MockContext context;
|
||||
MockProgram program(&context, false);
|
||||
std::unique_ptr<MockDevice> device(Device::create<OCLRT::MockDevice>(nullptr));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, info, *device.get()));
|
||||
|
||||
EXPECT_FALSE(kernel->is32Bit());
|
||||
|
|
|
@ -142,16 +142,11 @@ LONG WINAPI UltExceptionFilter(
|
|||
#endif
|
||||
|
||||
void initializeTestHelpers() {
|
||||
const HardwareInfo *hwinfo = *platformDevices;
|
||||
auto initialized = GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable,
|
||||
hwinfo->pWaTable, hwinfo->pSysInfo);
|
||||
ASSERT_TRUE(initialized);
|
||||
GlobalMockSipProgram::initSipProgram();
|
||||
}
|
||||
|
||||
void cleanTestHelpers() {
|
||||
GlobalMockSipProgram::shutDownSipProgram();
|
||||
GmmHelper::destroyContext();
|
||||
}
|
||||
|
||||
std::string getHardwarePrefix() {
|
||||
|
|
|
@ -765,7 +765,7 @@ TEST(SharedBuffersTest, whenBuffersIsCreatedWithSharingHandlerThenItIsSharedBuff
|
|||
class BufferTests : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
device.reset(Device::create<MockDevice>(*platformDevices));
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
||||
}
|
||||
void TearDown() override {
|
||||
}
|
||||
|
|
|
@ -955,7 +955,7 @@ class ImageCompressionTests : public ::testing::Test {
|
|||
|
||||
void SetUp() override {
|
||||
myMemoryManager = new MyMemoryManager();
|
||||
mockDevice.reset(Device::create<MockDevice>(*platformDevices));
|
||||
mockDevice.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
||||
mockDevice->injectMemoryManager(myMemoryManager);
|
||||
mockContext.reset(new MockContext(mockDevice.get()));
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class ImageHostPtrTransferTests : public testing::Test {
|
|||
|
||||
public:
|
||||
void SetUp() override {
|
||||
device.reset(Device::create<MockDevice>(*platformDevices));
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
||||
context.reset(new MockContext(device.get()));
|
||||
}
|
||||
|
||||
|
|
|
@ -822,6 +822,8 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenAllocateGraphicsMemor
|
|||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
ExecutionEnvironment execEnv;
|
||||
execEnv.initGmm(*platformDevices);
|
||||
auto queryGmm = MockGmm::queryImgParams(imgInfo);
|
||||
|
||||
auto imageAllocation = memoryManager.allocateGraphicsMemoryForImage(imgInfo, queryGmm.get());
|
||||
|
|
|
@ -37,11 +37,13 @@ class MockBufferStorage {
|
|||
}
|
||||
char data[128];
|
||||
MockGraphicsAllocation mockGfxAllocation;
|
||||
std::unique_ptr<Device> device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
};
|
||||
|
||||
class MockBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
using Buffer::magic;
|
||||
using MockBufferStorage::device;
|
||||
|
||||
MockBuffer(GraphicsAllocation &alloc)
|
||||
: MockBufferStorage(), Buffer(nullptr, CL_MEM_USE_HOST_PTR, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false),
|
||||
|
@ -59,12 +61,12 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
|||
void setArgStateful(void *memory) override {
|
||||
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), (externalAlloc != nullptr) ? externalAlloc : &mockGfxAllocation);
|
||||
}
|
||||
std::unique_ptr<Device> device = std::unique_ptr<Device>(OCLRT::Device::create<OCLRT::MockDevice>(nullptr));
|
||||
GraphicsAllocation *externalAlloc = nullptr;
|
||||
};
|
||||
|
||||
class AlignedBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
using MockBufferStorage::device;
|
||||
AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, CL_MEM_USE_HOST_PTR, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), &mockGfxAllocation, true, false, false) {
|
||||
}
|
||||
AlignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(), Buffer(nullptr, CL_MEM_USE_HOST_PTR, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), gfxAllocation, true, false, false) {
|
||||
|
@ -72,11 +74,11 @@ class AlignedBuffer : public MockBufferStorage, public Buffer {
|
|||
void setArgStateful(void *memory) override {
|
||||
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), &mockGfxAllocation);
|
||||
}
|
||||
std::unique_ptr<Device> device = std::unique_ptr<Device>(OCLRT::Device::create<OCLRT::MockDevice>(nullptr));
|
||||
};
|
||||
|
||||
class UnalignedBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
using MockBufferStorage::device;
|
||||
UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, CL_MEM_USE_HOST_PTR, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), &mockGfxAllocation, false, false, false) {
|
||||
}
|
||||
UnalignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(true), Buffer(nullptr, CL_MEM_USE_HOST_PTR, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), gfxAllocation, false, false, false) {
|
||||
|
@ -84,5 +86,4 @@ class UnalignedBuffer : public MockBufferStorage, public Buffer {
|
|||
void setArgStateful(void *memory) override {
|
||||
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), &mockGfxAllocation);
|
||||
}
|
||||
std::unique_ptr<Device> device = std::unique_ptr<Device>(OCLRT::Device::create<OCLRT::MockDevice>(nullptr));
|
||||
};
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#pragma once
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
||||
|
@ -102,6 +103,7 @@ class MockDevice : public Device {
|
|||
MemoryManager *memManager) {
|
||||
pHwInfo = getDeviceInitHwInfo(pHwInfo);
|
||||
T *device = new T(*pHwInfo);
|
||||
device->connectToExecutionEnvironment(new ExecutionEnvironment);
|
||||
if (memManager) {
|
||||
device->setMemoryManager(memManager);
|
||||
}
|
||||
|
@ -111,6 +113,10 @@ class MockDevice : public Device {
|
|||
}
|
||||
return device;
|
||||
}
|
||||
template <typename T>
|
||||
static T *createWithNewExecutionEnvironment(const HardwareInfo *pHwInfo) {
|
||||
return Device::create<T>(pHwInfo, new ExecutionEnvironment);
|
||||
}
|
||||
|
||||
void allocatePreemptionAllocationIfNotPresent() {
|
||||
if (this->preemptionAllocation == nullptr) {
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace OCLRT;
|
|||
typedef ::testing::Test DeviceQueueHwMtTest;
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueHwMtTest, givenTakenIgilCriticalSectionWhenSecondThreadIsWaitingThenDontHang) {
|
||||
auto device = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr));
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto context = std::unique_ptr<MockContext>(new MockContext());
|
||||
|
||||
cl_queue_properties properties[3] = {0};
|
||||
|
|
|
@ -399,7 +399,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDontDumpKernelArgsForNullMdi) {
|
|||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsForMdi) {
|
||||
MockProgram program;
|
||||
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
|
||||
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr));
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
auto multiDispatchInfo = unique_ptr<MockMultiDispatchInfo>(new MockMultiDispatchInfo(kernel.get()));
|
||||
|
||||
|
@ -441,7 +441,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelNullKernel) {
|
|||
TEST(DebugSettingsManager, WithDebugFunctionalityAndEmptyKernelDontDumpKernelArgs) {
|
||||
MockProgram program;
|
||||
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
|
||||
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr));
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
|
||||
FullyEnabledTestDebugManager debugManager;
|
||||
|
@ -455,7 +455,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityAndEmptyKernelDontDumpKernelArg
|
|||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsImmediate) {
|
||||
MockProgram program;
|
||||
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
|
||||
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr));
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
@ -486,7 +486,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsImmediate) {
|
|||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsImmediateZeroSize) {
|
||||
MockProgram program;
|
||||
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
|
||||
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr));
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
@ -514,7 +514,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsImmediateZeroSize
|
|||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsLocalBuffer) {
|
||||
MockProgram program;
|
||||
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
|
||||
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr));
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
@ -535,7 +535,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsLocalBuffer) {
|
|||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsBufferNotSet) {
|
||||
MockProgram program;
|
||||
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
|
||||
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr));
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
@ -566,7 +566,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsBuffer) {
|
|||
|
||||
MockProgram program(&context, false);
|
||||
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
|
||||
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr));
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
@ -600,7 +600,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsBuffer) {
|
|||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsSampler) {
|
||||
MockProgram program;
|
||||
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
|
||||
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr));
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
@ -623,7 +623,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsSampler) {
|
|||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsImageNotSet) {
|
||||
MockProgram program;
|
||||
auto kernelInfo = unique_ptr<KernelInfo>(KernelInfo::create());
|
||||
auto device = unique_ptr<Device>(Device::create<OCLRT::Device>(nullptr));
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
|
||||
SKernelBinaryHeaderCommon kernelHeader;
|
||||
|
@ -900,4 +900,3 @@ TEST(DebugSettingsManager, whenOnlyRegKeysAreEnabledThenAllOtherDebugFunctionali
|
|||
static_assert(false == debugManager.kernelArgDumpingAvailable(), "");
|
||||
static_assert(debugManager.registryReadAvailable(), "");
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ using namespace ::testing;
|
|||
namespace OCLRT {
|
||||
TEST(DeviceOsTest, osSpecificExtensions) {
|
||||
auto hwInfo = *platformDevices;
|
||||
auto pDevice = Device::create<OCLRT::Device>(hwInfo);
|
||||
auto pDevice = MockDevice::createWithNewExecutionEnvironment<Device>(hwInfo);
|
||||
|
||||
std::string extensionString(pDevice->getDeviceInfo().deviceExtensions);
|
||||
|
||||
|
@ -53,7 +53,7 @@ TEST(DeviceOsTest, osSpecificExtensions) {
|
|||
}
|
||||
|
||||
TEST(DeviceOsTest, supportedSimultaneousInterops) {
|
||||
auto pDevice = std::unique_ptr<Device>(Device::create<OCLRT::Device>(*platformDevices));
|
||||
auto pDevice = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(*platformDevices));
|
||||
|
||||
std::vector<unsigned int> expected = {0};
|
||||
|
||||
|
@ -62,7 +62,7 @@ TEST(DeviceOsTest, supportedSimultaneousInterops) {
|
|||
|
||||
TEST(DeviceOsTest, DeviceCreationFail) {
|
||||
auto hwInfo = *platformDevices;
|
||||
auto pDevice = Device::create<OCLRT::FailDevice>(hwInfo);
|
||||
auto pDevice = MockDevice::createWithNewExecutionEnvironment<FailDevice>(hwInfo);
|
||||
|
||||
EXPECT_THAT(pDevice, nullptr);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ TEST(ApiOsTest, notSupportedApiList) {
|
|||
TEST(DeviceOsTest, DeviceCreationFailMidThreadPreemption) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::MidThread));
|
||||
auto pDevice = Device::create<OCLRT::FailDeviceAfterOne>(nullptr);
|
||||
auto pDevice = MockDevice::createWithNewExecutionEnvironment<FailDeviceAfterOne>(nullptr);
|
||||
|
||||
EXPECT_THAT(pDevice, nullptr);
|
||||
}
|
||||
|
|
|
@ -1120,7 +1120,7 @@ TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenAllHeapsAreExh
|
|||
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.Force32bitAddressing.set(true);
|
||||
std::unique_ptr<Device> pDevice(Device::create<OCLRT::MockDevice>(nullptr));
|
||||
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
memoryManager->device = pDevice.get();
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
|
||||
|
@ -1150,7 +1150,7 @@ TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenAllHeapsAreExh
|
|||
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.Force32bitAddressing.set(true);
|
||||
std::unique_ptr<Device> pDevice(Device::create<OCLRT::MockDevice>(nullptr));
|
||||
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
pDevice->increaseProgramCount();
|
||||
memoryManager->device = pDevice.get();
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
|
@ -1166,7 +1166,7 @@ TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenInternalHeapIs
|
|||
DebugManagerStateRestore dbgStateRestore;
|
||||
DebugManager.flags.Force32bitAddressing.set(true);
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
std::unique_ptr<Device> pDevice(Device::create<OCLRT::MockDevice>(nullptr));
|
||||
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
memoryManager->device = pDevice.get();
|
||||
|
||||
auto allocator = memoryManager->getDrmInternal32BitAllocator();
|
||||
|
@ -1195,6 +1195,8 @@ TEST_F(DrmMemoryManagerTest, GivenMemoryManagerWhenAllocateGraphicsMemoryForImag
|
|||
imgInfo.size = 4096u;
|
||||
imgInfo.rowPitch = 512u;
|
||||
|
||||
ExecutionEnvironment execEnv;
|
||||
execEnv.initGmm(*platformDevices);
|
||||
auto queryGmm = MockGmm::queryImgParams(imgInfo);
|
||||
auto imageGraphicsAllocation = memoryManager->allocateGraphicsMemoryForImage(imgInfo, queryGmm.get());
|
||||
queryGmm.release();
|
||||
|
@ -1738,6 +1740,8 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
|
|||
imgInfo.size = 4096u;
|
||||
imgInfo.rowPitch = 512u;
|
||||
|
||||
ExecutionEnvironment execEnv;
|
||||
execEnv.initGmm(*platformDevices);
|
||||
auto queryGmm = MockGmm::queryImgParams(imgInfo);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryForImage(imgInfo, queryGmm.get());
|
||||
queryGmm.release();
|
||||
|
|
|
@ -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
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -24,6 +24,7 @@
|
|||
#include "runtime/os_interface/os_time.h"
|
||||
#include "runtime/os_interface/os_interface.h"
|
||||
#include "unit_tests/os_interface/mock_performance_counters.h"
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
@ -46,7 +47,7 @@ struct PerformanceCountersDeviceTest : public PerformanceCountersDeviceFixture,
|
|||
|
||||
TEST_F(PerformanceCountersDeviceTest, createDeviceWithPerformanceCounters) {
|
||||
hwInfoToModify->capabilityTable.instrumentationEnabled = true;
|
||||
auto device = Device::create<OCLRT::Device>(hwInfoToModify);
|
||||
auto device = MockDevice::createWithNewExecutionEnvironment<Device>(hwInfoToModify);
|
||||
EXPECT_NE(nullptr, device->getPerformanceCounters());
|
||||
EXPECT_EQ(1, PerfCounterFlags::initalizeCalled);
|
||||
delete device;
|
||||
|
@ -54,7 +55,7 @@ TEST_F(PerformanceCountersDeviceTest, createDeviceWithPerformanceCounters) {
|
|||
|
||||
TEST_F(PerformanceCountersDeviceTest, createDeviceWithoutPerformanceCounters) {
|
||||
hwInfoToModify->capabilityTable.instrumentationEnabled = false;
|
||||
auto device = Device::create<OCLRT::Device>(hwInfoToModify);
|
||||
auto device = MockDevice::createWithNewExecutionEnvironment<Device>(hwInfoToModify);
|
||||
EXPECT_EQ(nullptr, device->getPerformanceCounters());
|
||||
EXPECT_EQ(0, PerfCounterFlags::initalizeCalled);
|
||||
delete device;
|
||||
|
|
|
@ -76,7 +76,7 @@ class WddmCommandStreamFixture {
|
|||
memManager = mockWddmMM;
|
||||
csr->setMemoryManager(memManager);
|
||||
|
||||
device = MockDevice::create<MockDevice>(platformDevices[0]);
|
||||
device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]);
|
||||
ASSERT_NE(nullptr, device);
|
||||
memManager->device = device;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ using namespace ::testing;
|
|||
namespace OCLRT {
|
||||
TEST(DeviceOsTest, osSpecificExtensions) {
|
||||
auto hwInfo = *platformDevices;
|
||||
auto pDevice = Device::create<OCLRT::Device>(hwInfo);
|
||||
auto pDevice = MockDevice::createWithNewExecutionEnvironment<Device>(hwInfo);
|
||||
|
||||
std::string extensionString(pDevice->getDeviceInfo().deviceExtensions);
|
||||
|
||||
|
@ -48,7 +48,7 @@ TEST(DeviceOsTest, osSpecificExtensions) {
|
|||
}
|
||||
|
||||
TEST(DeviceOsTest, supportedSimultaneousInterops) {
|
||||
auto pDevice = std::unique_ptr<Device>(Device::create<OCLRT::Device>(*platformDevices));
|
||||
auto pDevice = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(*platformDevices));
|
||||
|
||||
std::vector<unsigned int> expected = {CL_GL_CONTEXT_KHR,
|
||||
CL_WGL_HDC_KHR,
|
||||
|
@ -67,7 +67,7 @@ TEST(DeviceOsTest, supportedSimultaneousInterops) {
|
|||
|
||||
TEST(DeviceOsTest, DeviceCreationFail) {
|
||||
auto hwInfo = *platformDevices;
|
||||
auto pDevice = Device::create<OCLRT::FailDevice>(hwInfo);
|
||||
auto pDevice = MockDevice::createWithNewExecutionEnvironment<FailDevice>(hwInfo);
|
||||
|
||||
EXPECT_THAT(pDevice, nullptr);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ TEST(DeviceOsTest, DeviceCreationFail) {
|
|||
TEST(DeviceOsTest, DeviceCreationFailMidThreadPreemption) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::MidThread));
|
||||
auto pDevice = Device::create<OCLRT::FailDeviceAfterOne>(nullptr);
|
||||
auto pDevice = MockDevice::createWithNewExecutionEnvironment<FailDeviceAfterOne>(nullptr);
|
||||
|
||||
EXPECT_THAT(pDevice, nullptr);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ Wddm *DriverInfoDeviceTest::wddmMock = nullptr;
|
|||
|
||||
TEST_F(DriverInfoDeviceTest, GivenDeviceCreatedWhenCorrectOSInterfaceThenCreateDriverInfo) {
|
||||
overrideCommandStreamReceiverCreation = true;
|
||||
auto device = Device::create<OCLRT::MockDevice>(hwInfo);
|
||||
auto device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(hwInfo);
|
||||
|
||||
EXPECT_TRUE(device->hasDriverInfo());
|
||||
delete device;
|
||||
|
@ -77,7 +77,7 @@ TEST_F(DriverInfoDeviceTest, GivenDeviceCreatedWhenCorrectOSInterfaceThenCreateD
|
|||
|
||||
TEST_F(DriverInfoDeviceTest, GivenDeviceCreatedWithoutCorrectOSInterfaceThenDontCreateDriverInfo) {
|
||||
overrideCommandStreamReceiverCreation = false;
|
||||
auto device = Device::create<OCLRT::MockDevice>(hwInfo);
|
||||
auto device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(hwInfo);
|
||||
|
||||
EXPECT_FALSE(device->hasDriverInfo());
|
||||
delete device;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/gmm_helper/gmm.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
|
@ -531,8 +532,9 @@ HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceOnInit) {
|
|||
D3DKMT_HANDLE adapterHandle = ADAPTER_HANDLE;
|
||||
D3DKMT_HANDLE deviceHandle = DEVICE_HANDLE;
|
||||
const HardwareInfo hwInfo = *platformDevices[0];
|
||||
ExecutionEnvironment execEnv;
|
||||
execEnv.initGmm(&hwInfo);
|
||||
BOOLEAN FtrL3IACoherency = hwInfo.pSkuTable->ftrL3IACoherency ? 1 : 0;
|
||||
|
||||
EXPECT_CALL(*gmmMem, configureDeviceAddressSpace(adapterHandle,
|
||||
deviceHandle,
|
||||
wddm->gdi->escape.mFunc,
|
||||
|
@ -551,6 +553,8 @@ HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceOnInit) {
|
|||
|
||||
HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoAdapter) {
|
||||
wddm->adapter = static_cast<D3DKMT_HANDLE>(0);
|
||||
ExecutionEnvironment execEnv;
|
||||
execEnv.initGmm(*platformDevices);
|
||||
EXPECT_CALL(*gmmMem, configureDeviceAddressSpace(static_cast<D3DKMT_HANDLE>(0),
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
|
@ -569,6 +573,8 @@ HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoAdapter) {
|
|||
|
||||
HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoDevice) {
|
||||
wddm->device = static_cast<D3DKMT_HANDLE>(0);
|
||||
ExecutionEnvironment execEnv;
|
||||
execEnv.initGmm(*platformDevices);
|
||||
EXPECT_CALL(*gmmMem, configureDeviceAddressSpace(::testing::_,
|
||||
static_cast<D3DKMT_HANDLE>(0),
|
||||
::testing::_,
|
||||
|
@ -587,6 +593,8 @@ HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoDevice) {
|
|||
|
||||
HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoEscFunc) {
|
||||
wddm->gdi->escape = static_cast<PFND3DKMT_ESCAPE>(nullptr);
|
||||
ExecutionEnvironment execEnv;
|
||||
execEnv.initGmm(*platformDevices);
|
||||
EXPECT_CALL(*gmmMem, configureDeviceAddressSpace(::testing::_,
|
||||
::testing::_,
|
||||
static_cast<PFND3DKMT_ESCAPE>(nullptr),
|
||||
|
|
|
@ -49,10 +49,4 @@ Wddm::VirtualFreeFcn getVirtualFree() {
|
|||
Wddm::VirtualAllocFcn getVirtualAlloc() {
|
||||
return ULTVirtualAlloc;
|
||||
}
|
||||
|
||||
bool Wddm::initGmmContext() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Wddm::destroyGmmContext() {}
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -38,7 +38,7 @@ using PreambleTest = ::testing::Test;
|
|||
using namespace OCLRT;
|
||||
|
||||
HWTEST_F(PreambleTest, PreemptionIsTakenIntoAccountWhenProgrammingPreamble) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
mockDevice->setPreemptionMode(PreemptionMode::MidThread);
|
||||
auto cmdSizePreambleMidThread = PreambleHelper<FamilyType>::getAdditionalCommandsSize(*mockDevice);
|
||||
|
@ -122,7 +122,7 @@ HWTEST_F(PreambleTest, whenKernelDebuggingCommandsAreProgrammedThenCorrectComman
|
|||
HWTEST_F(PreambleTest, givenKernelDebuggingActiveWhenPreambleIsProgrammedThenProgramKernelDebuggingIsCalled) {
|
||||
typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
mockDevice->setPreemptionMode(PreemptionMode::Disabled);
|
||||
mockDevice->setSourceLevelDebuggerActive(false);
|
||||
|
@ -157,7 +157,7 @@ HWTEST_F(PreambleTest, givenKernelDebuggingActiveWhenPreambleIsProgrammedThenPro
|
|||
}
|
||||
|
||||
HWTEST_F(PreambleTest, givenKernelDebuggingActiveAndMidThreadPreemptionWhenGetAdditionalCommandsSizeIsCalledThen2MiLoadRegisterImmCmdsAreAdded) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
mockDevice->setPreemptionMode(PreemptionMode::MidThread);
|
||||
|
||||
mockDevice->setSourceLevelDebuggerActive(false);
|
||||
|
|
|
@ -318,7 +318,7 @@ HWTEST_P(PreemptionHwTest, getRequiredCmdStreamSizeReturns0WhenPreemptionModeIsN
|
|||
StackVec<char, 4096> buffer(requiredSize);
|
||||
LinearStream cmdStream(buffer.begin(), buffer.size());
|
||||
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
{
|
||||
MockBuiltins tmpBuiltins;
|
||||
tmpBuiltins.overrideSipKernel(std::unique_ptr<OCLRT::SipKernel>(new OCLRT::SipKernel{SipKernelType::Csr, getSipProgramWithCustomBinary()}));
|
||||
|
@ -346,7 +346,7 @@ HWTEST_P(PreemptionHwTest, getRequiredCmdStreamSizeReturnsSizeOfMiLoadRegisterIm
|
|||
StackVec<char, 4096> buffer(requiredSize);
|
||||
LinearStream cmdStream(buffer.begin(), buffer.size());
|
||||
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
size_t minCsrSize = mockDevice->getHardwareInfo().pSysInfo->CsrSizeInMb * MemoryConstants::megaByte;
|
||||
uint64_t minCsrAlignment = 2 * 256 * MemoryConstants::kiloByte;
|
||||
|
@ -360,7 +360,7 @@ HWTEST_P(PreemptionHwTest, getRequiredCmdStreamSizeReturnsSizeOfMiLoadRegisterIm
|
|||
HWTEST_P(PreemptionHwTest, programCmdStreamAddsProperMiLoadRegisterImmCommandToTheStream) {
|
||||
PreemptionMode mode = GetParam();
|
||||
PreemptionMode differentPreemptionMode = static_cast<PreemptionMode>(0);
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
if (false == GetPreemptionTestHwDetails<FamilyType>().supportsPreemptionProgramming()) {
|
||||
LinearStream cmdStream(nullptr, 0U);
|
||||
|
@ -409,7 +409,7 @@ HWTEST_F(MidThreadPreemptionTests, createCsrSurfaceNoWa) {
|
|||
tmpWaTable.waCSRUncachable = false;
|
||||
const_cast<HardwareInfo *>(platformDevices[0])->pWaTable = &tmpWaTable;
|
||||
|
||||
std::unique_ptr<MockDevice> mockDevice(Device::create<OCLRT::MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> mockDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
ASSERT_NE(nullptr, mockDevice.get());
|
||||
|
||||
auto &csr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
@ -429,7 +429,7 @@ HWTEST_F(MidThreadPreemptionTests, createCsrSurfaceWa) {
|
|||
tmpWaTable.waCSRUncachable = true;
|
||||
const_cast<HardwareInfo *>(platformDevices[0])->pWaTable = &tmpWaTable;
|
||||
|
||||
std::unique_ptr<MockDevice> mockDevice(Device::create<OCLRT::MockDevice>(platformDevices[0]));
|
||||
std::unique_ptr<MockDevice> mockDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
ASSERT_NE(nullptr, mockDevice.get());
|
||||
|
||||
auto &csr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/string.h"
|
||||
#include "runtime/program/print_formatter.h"
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
#include "unit_tests/mocks/mock_kernel.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
|
@ -59,7 +60,7 @@ class PrintFormatterTest : public testing::Test {
|
|||
data = new MockGraphicsAllocation(underlyingBuffer, PrintFormatter::maxPrintfOutputLength);
|
||||
|
||||
kernelInfo = KernelInfo::create();
|
||||
device = Device::create<OCLRT::Device>(nullptr);
|
||||
device = MockDevice::createWithNewExecutionEnvironment<Device>(nullptr);
|
||||
kernel = new MockKernel(&program, *kernelInfo, *device);
|
||||
|
||||
printFormatter = new PrintFormatter(*kernel, *data);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
typedef ::testing::Test CommandStreamReceiverWithActiveDebuggerTest;
|
||||
|
||||
HWTEST_F(CommandStreamReceiverWithActiveDebuggerTest, givenCsrWithActiveDebuggerAndDisabledPreemptionWhenFlushTaskIsCalledThenSipKernelIsMadeResident) {
|
||||
auto device = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr));
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
device->setSourceLevelDebuggerActive(true);
|
||||
device->allocatePreemptionAllocationIfNotPresent();
|
||||
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
|
||||
|
|
|
@ -73,7 +73,7 @@ TEST(DeviceCreation, givenDeviceWithMidThreadPreemptionAndDebuggingActiveWhenDev
|
|||
EXPECT_FALSE(mockBuiltins->getSipKernelCalled);
|
||||
|
||||
DebugManager.flags.ForcePreemptionMode.set((int32_t)PreemptionMode::MidThread);
|
||||
auto device = std::unique_ptr<MockDeviceWithActiveDebugger<>>(Device::create<MockDeviceWithActiveDebugger<>>(nullptr));
|
||||
auto device = std::unique_ptr<MockDeviceWithActiveDebugger<>>(MockDevice::createWithNewExecutionEnvironment<MockDeviceWithActiveDebugger<>>(nullptr));
|
||||
|
||||
EXPECT_TRUE(mockBuiltins->getSipKernelCalled);
|
||||
EXPECT_LE(SipKernelType::DbgCsr, mockBuiltins->getSipKernelType);
|
||||
|
@ -96,7 +96,7 @@ TEST(DeviceCreation, givenDeviceWithDisabledPreemptionAndDebuggingActiveWhenDevi
|
|||
EXPECT_FALSE(mockBuiltins->getSipKernelCalled);
|
||||
|
||||
DebugManager.flags.ForcePreemptionMode.set((int32_t)PreemptionMode::Disabled);
|
||||
auto device = std::unique_ptr<MockDeviceWithActiveDebugger<>>(Device::create<MockDeviceWithActiveDebugger<>>(nullptr));
|
||||
auto device = std::unique_ptr<MockDeviceWithActiveDebugger<>>(MockDevice::createWithNewExecutionEnvironment<MockDeviceWithActiveDebugger<>>(nullptr));
|
||||
|
||||
EXPECT_TRUE(mockBuiltins->getSipKernelCalled);
|
||||
EXPECT_LE(SipKernelType::DbgCsr, mockBuiltins->getSipKernelType);
|
||||
|
@ -107,12 +107,12 @@ TEST(DeviceCreation, givenDeviceWithDisabledPreemptionAndDebuggingActiveWhenDevi
|
|||
}
|
||||
|
||||
TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhenDeviceIsDestructedThenSourceLevelDebuggerIsNotified) {
|
||||
auto device = std::unique_ptr<MockDeviceWithActiveDebugger<::testing::NiceMock<GMockSourceLevelDebugger>>>(Device::create<MockDeviceWithActiveDebugger<::testing::NiceMock<GMockSourceLevelDebugger>>>(nullptr));
|
||||
auto device = std::unique_ptr<MockDeviceWithActiveDebugger<::testing::NiceMock<GMockSourceLevelDebugger>>>(MockDevice::createWithNewExecutionEnvironment<MockDeviceWithActiveDebugger<::testing::NiceMock<GMockSourceLevelDebugger>>>(nullptr));
|
||||
GMockSourceLevelDebugger *gmock = device->getSourceLevelDebugger();
|
||||
EXPECT_CALL(*gmock, notifyDeviceDestruction()).Times(1);
|
||||
}
|
||||
|
||||
TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhenDeviceIsCreatedThenPreemptionIsDisabled) {
|
||||
auto device = std::unique_ptr<MockDeviceWithActiveDebugger<MockActiveSourceLevelDebugger>>(Device::create<MockDeviceWithActiveDebugger<MockActiveSourceLevelDebugger>>(nullptr));
|
||||
auto device = std::unique_ptr<MockDeviceWithActiveDebugger<MockActiveSourceLevelDebugger>>(MockDevice::createWithNewExecutionEnvironment<MockDeviceWithActiveDebugger<MockActiveSourceLevelDebugger>>(nullptr));
|
||||
EXPECT_EQ(PreemptionMode::Disabled, device->getPreemptionMode());
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ using namespace OCLRT;
|
|||
template <typename GfxFamily>
|
||||
void SourceLevelDebuggerPreambleTest<GfxFamily>::givenMidThreadPreemptionAndDebuggingActiveWhenPreambleIsPrograamedThenCorrectSipKernelIsUsedTest() {
|
||||
using STATE_SIP = typename GfxFamily::STATE_SIP;
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
mockDevice->setSourceLevelDebuggerActive(true);
|
||||
mockDevice->setPreemptionMode(PreemptionMode::MidThread);
|
||||
|
@ -54,7 +54,7 @@ void SourceLevelDebuggerPreambleTest<GfxFamily>::givenMidThreadPreemptionAndDebu
|
|||
template <typename GfxFamily>
|
||||
void SourceLevelDebuggerPreambleTest<GfxFamily>::givenMidThreadPreemptionAndDisabledDebuggingWhenPreambleIsPrograamedThenCorrectSipKernelIsUsedTest() {
|
||||
using STATE_SIP = typename GfxFamily::STATE_SIP;
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
mockDevice->setSourceLevelDebuggerActive(false);
|
||||
mockDevice->setPreemptionMode(PreemptionMode::MidThread);
|
||||
|
@ -83,7 +83,7 @@ void SourceLevelDebuggerPreambleTest<GfxFamily>::givenMidThreadPreemptionAndDisa
|
|||
template <typename GfxFamily>
|
||||
void SourceLevelDebuggerPreambleTest<GfxFamily>::givenPreemptionDisabledAndDebuggingActiveWhenPreambleIsProgrammedThenCorrectSipKernelIsUsedTest() {
|
||||
using STATE_SIP = typename GfxFamily::STATE_SIP;
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
mockDevice->setSourceLevelDebuggerActive(true);
|
||||
mockDevice->setPreemptionMode(PreemptionMode::Disabled);
|
||||
|
@ -111,7 +111,7 @@ void SourceLevelDebuggerPreambleTest<GfxFamily>::givenPreemptionDisabledAndDebug
|
|||
|
||||
template <typename GfxFamily>
|
||||
void SourceLevelDebuggerPreambleTest<GfxFamily>::givenMidThreadPreemptionAndDebuggingActiveWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturnedTest() {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
mockDevice->setSourceLevelDebuggerActive(true);
|
||||
mockDevice->setPreemptionMode(PreemptionMode::MidThread);
|
||||
size_t requiredPreambleSize = PreemptionHelper::getRequiredPreambleSize<GfxFamily>(*mockDevice);
|
||||
|
@ -121,7 +121,7 @@ void SourceLevelDebuggerPreambleTest<GfxFamily>::givenMidThreadPreemptionAndDebu
|
|||
|
||||
template <typename GfxFamily>
|
||||
void SourceLevelDebuggerPreambleTest<GfxFamily>::givenPreemptionDisabledAndDebuggingActiveWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturnedTest() {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
mockDevice->setSourceLevelDebuggerActive(true);
|
||||
mockDevice->setPreemptionMode(PreemptionMode::Disabled);
|
||||
size_t requiredPreambleSize = PreemptionHelper::getRequiredPreambleSize<GfxFamily>(*mockDevice);
|
||||
|
@ -131,7 +131,7 @@ void SourceLevelDebuggerPreambleTest<GfxFamily>::givenPreemptionDisabledAndDebug
|
|||
|
||||
template <typename GfxFamily>
|
||||
void SourceLevelDebuggerPreambleTest<GfxFamily>::givenMidThreadPreemptionAndDisabledDebuggingWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturnedTest() {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
mockDevice->setSourceLevelDebuggerActive(false);
|
||||
mockDevice->setPreemptionMode(PreemptionMode::MidThread);
|
||||
size_t requiredPreambleSize = PreemptionHelper::getRequiredPreambleSize<GfxFamily>(*mockDevice);
|
||||
|
@ -141,7 +141,7 @@ void SourceLevelDebuggerPreambleTest<GfxFamily>::givenMidThreadPreemptionAndDisa
|
|||
|
||||
template <typename GfxFamily>
|
||||
void SourceLevelDebuggerPreambleTest<GfxFamily>::givenDisabledPreemptionAndDisabledDebuggingWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturnedTest() {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
mockDevice->setSourceLevelDebuggerActive(false);
|
||||
mockDevice->setPreemptionMode(PreemptionMode::Disabled);
|
||||
size_t requiredPreambleSize = PreemptionHelper::getRequiredPreambleSize<GfxFamily>(*mockDevice);
|
||||
|
|
|
@ -409,8 +409,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreate
|
|||
DebuggerLibrary::setDebuggerActive(true);
|
||||
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
|
||||
|
||||
unique_ptr<MockDevice> device(new MockDevice(*platformDevices[0]));
|
||||
MockDevice::createDeviceImpl(platformDevices[0], *device.get());
|
||||
unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
||||
EXPECT_TRUE(interceptor.newDeviceCalled);
|
||||
uint32_t deviceHandleExpected = device->getCommandStreamReceiver().getOSInterface() != nullptr ? device->getCommandStreamReceiver().getOSInterface()->getDeviceHandle() : 0;
|
||||
EXPECT_EQ(reinterpret_cast<GfxDeviceHandle>(static_cast<uint64_t>(deviceHandleExpected)), interceptor.newDeviceArgIn.dh);
|
||||
|
@ -429,7 +428,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreate
|
|||
overrideCommandStreamReceiverCreation = true;
|
||||
|
||||
// Device::create must be used to create correct OS memory manager
|
||||
unique_ptr<Device> device(Device::create<Device>(platformDevices[0]));
|
||||
unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(platformDevices[0]));
|
||||
ASSERT_NE(nullptr, device->getCommandStreamReceiver().getOSInterface());
|
||||
|
||||
EXPECT_TRUE(interceptor.newDeviceCalled);
|
||||
|
|
Loading…
Reference in New Issue