Pass execution environment to command stream receiver.

Change-Id: I598f67f8b005b5ce8249b638e080657eb6dc3547
This commit is contained in:
Mrozek, Michal 2018-08-08 13:49:09 +02:00 committed by sys_ocldev
parent 287d33d87e
commit 1599ea800e
76 changed files with 362 additions and 334 deletions

View File

@ -33,7 +33,7 @@
namespace OCLRT {
AubCommandStreamReceiverCreateFunc aubCommandStreamReceiverFactory[IGFX_MAX_CORE] = {};
CommandStreamReceiver *AUBCommandStreamReceiver::create(const HardwareInfo &hwInfo, const std::string &baseName, bool standalone) {
CommandStreamReceiver *AUBCommandStreamReceiver::create(const HardwareInfo &hwInfo, const std::string &baseName, bool standalone, ExecutionEnvironment &executionEnvironment) {
std::string hwPrefix = hardwarePrefix[hwInfo.pPlatform->eProductFamily];
// Generate the full filename
@ -57,7 +57,7 @@ CommandStreamReceiver *AUBCommandStreamReceiver::create(const HardwareInfo &hwIn
}
auto pCreate = aubCommandStreamReceiverFactory[hwInfo.pPlatform->eRenderCoreFamily];
return pCreate ? pCreate(hwInfo, filePath, standalone) : nullptr;
return pCreate ? pCreate(hwInfo, filePath, standalone, executionEnvironment) : nullptr;
}
} // namespace OCLRT

View File

@ -27,12 +27,13 @@
namespace OCLRT {
struct HardwareInfo;
class CommandStreamReceiver;
class ExecutionEnvironment;
struct AUBCommandStreamReceiver {
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, const std::string &filename, bool standalone);
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, const std::string &filename, bool standalone, ExecutionEnvironment &executionEnvironment);
using AubFileStream = AubMemDump::AubFileStream;
};
typedef CommandStreamReceiver *(*AubCommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone);
typedef CommandStreamReceiver *(*AubCommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone, ExecutionEnvironment &executionEnvironment);
} // namespace OCLRT

View File

@ -57,9 +57,9 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
void addContextToken();
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone);
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone, ExecutionEnvironment &executionEnvironment);
AUBCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone);
AUBCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone, ExecutionEnvironment &executionEnvironment);
~AUBCommandStreamReceiverHw() override;
AUBCommandStreamReceiverHw(const AUBCommandStreamReceiverHw &) = delete;

View File

@ -36,8 +36,8 @@
namespace OCLRT {
template <typename GfxFamily>
AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone)
: BaseClass(hwInfoIn),
AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone, ExecutionEnvironment &executionEnvironment)
: BaseClass(hwInfoIn, executionEnvironment),
stream(std::unique_ptr<AUBCommandStreamReceiver::AubFileStream>(new AUBCommandStreamReceiver::AubFileStream())),
subCaptureManager(std::unique_ptr<AubSubCaptureManager>(new AubSubCaptureManager(fileName))),
standalone(standalone) {
@ -233,8 +233,8 @@ void AUBCommandStreamReceiverHw<GfxFamily>::freeEngineInfoTable() {
}
template <typename GfxFamily>
CommandStreamReceiver *AUBCommandStreamReceiverHw<GfxFamily>::create(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone) {
auto csr = new AUBCommandStreamReceiverHw<GfxFamily>(hwInfoIn, fileName, standalone);
CommandStreamReceiver *AUBCommandStreamReceiverHw<GfxFamily>::create(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone, ExecutionEnvironment &executionEnvironment) {
auto csr = new AUBCommandStreamReceiverHw<GfxFamily>(hwInfoIn, fileName, standalone, executionEnvironment);
if (!csr->subCaptureManager->isSubCaptureMode()) {
csr->initFile(fileName);

View File

@ -37,7 +37,7 @@ namespace OCLRT {
// Global table of CommandStreamReceiver factories for HW and tests
CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE] = {};
CommandStreamReceiver::CommandStreamReceiver() {
CommandStreamReceiver::CommandStreamReceiver(ExecutionEnvironment &executionEnvironment) : executionEnvironment(executionEnvironment) {
latestSentStatelessMocsConfig = CacheSettings::unknownMocs;
submissionAggregator.reset(new SubmissionAggregator());
if (DebugManager.flags.CsrDispatchMode.get()) {

View File

@ -43,6 +43,7 @@ class IndirectHeap;
class LinearStream;
class MemoryManager;
class OSInterface;
class ExecutionEnvironment;
enum class DispatchMode {
DeviceDefault = 0, //default for given device
@ -60,7 +61,7 @@ class CommandStreamReceiver {
samplerCacheFlushAfter //add sampler cache flush after Walker with redescribed image
};
using MutexType = std::recursive_mutex;
CommandStreamReceiver();
CommandStreamReceiver(ExecutionEnvironment &executionEnvironment);
virtual ~CommandStreamReceiver();
virtual FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) = 0;
@ -203,7 +204,8 @@ class CommandStreamReceiver {
std::unique_ptr<ExperimentalCommandBuffer> experimentalCmdBuffer;
MutexType ownershipMutex;
std::unique_ptr<KmdNotifyHelper> kmdNotifyHelper;
ExecutionEnvironment &executionEnvironment;
};
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump);
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment);
} // namespace OCLRT

View File

@ -37,11 +37,11 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
typedef typename GfxFamily::PIPE_CONTROL PIPE_CONTROL;
public:
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn) {
return new CommandStreamReceiverHw<GfxFamily>(hwInfoIn);
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment) {
return new CommandStreamReceiverHw<GfxFamily>(hwInfoIn, executionEnvironment);
}
CommandStreamReceiverHw(const HardwareInfo &hwInfoIn);
CommandStreamReceiverHw(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment);
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) override;

View File

@ -40,7 +40,7 @@
namespace OCLRT {
template <typename GfxFamily>
CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(const HardwareInfo &hwInfoIn) : hwInfo(hwInfoIn) {
CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment) : CommandStreamReceiver(executionEnvironment), hwInfo(hwInfoIn) {
requiredThreadArbitrationPolicy = PreambleHelper<GfxFamily>::getDefaultThreadArbitrationPolicy();
resetKmdNotifyHelper(new KmdNotifyHelper(&(hwInfoIn.capabilityTable.kmdNotifyProperties)));
flatBatchBufferHelper.reset(new FlatBatchBufferHelperHw<GfxFamily>(this->memoryManager));

View File

@ -28,7 +28,7 @@ namespace OCLRT {
template <typename BaseCSR>
class CommandStreamReceiverWithAUBDump : public BaseCSR {
public:
CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn);
CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment);
~CommandStreamReceiverWithAUBDump() override;
CommandStreamReceiverWithAUBDump(const CommandStreamReceiverWithAUBDump &) = delete;

View File

@ -28,9 +28,9 @@ namespace OCLRT {
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
template <typename BaseCSR>
CommandStreamReceiverWithAUBDump<BaseCSR>::CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn)
: BaseCSR(hwInfoIn, nullptr) {
aubCSR = AUBCommandStreamReceiver::create(hwInfoIn, "aubfile", false);
CommandStreamReceiverWithAUBDump<BaseCSR>::CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment)
: BaseCSR(hwInfoIn, nullptr, executionEnvironment) {
aubCSR = AUBCommandStreamReceiver::create(hwInfoIn, "aubfile", false, executionEnvironment);
}
template <typename BaseCSR>

View File

@ -31,7 +31,7 @@ namespace OCLRT {
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo) {
CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo, ExecutionEnvironment &executionEnvironment) {
auto funcCreate = commandStreamReceiverFactory[pHwInfo->pPlatform->eRenderCoreFamily];
if (funcCreate == nullptr) {
return nullptr;
@ -41,22 +41,22 @@ CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo) {
if (csr) {
switch (csr) {
case CSR_AUB:
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile", true);
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile", true, executionEnvironment);
break;
case CSR_TBX:
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, false);
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, false, executionEnvironment);
break;
case CSR_HW_WITH_AUB:
commandStreamReceiver = funcCreate(*pHwInfo, true);
commandStreamReceiver = funcCreate(*pHwInfo, true, executionEnvironment);
break;
case CSR_TBX_WITH_AUB:
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, true);
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, true, executionEnvironment);
break;
default:
break;
}
} else {
commandStreamReceiver = funcCreate(*pHwInfo, false);
commandStreamReceiver = funcCreate(*pHwInfo, false, executionEnvironment);
}
return commandStreamReceiver;
}

View File

@ -26,6 +26,6 @@
namespace OCLRT {
class ExecutionEnvironment;
extern CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo);
extern CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo, ExecutionEnvironment &executionEnvironment);
extern bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment);
} // namespace OCLRT

View File

@ -31,11 +31,11 @@ class DeviceCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
typedef CommandStreamReceiverHw<GfxFamily> BaseClass;
protected:
DeviceCommandStreamReceiver(const HardwareInfo &hwInfoIn)
: BaseClass(hwInfoIn) {
DeviceCommandStreamReceiver(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment)
: BaseClass(hwInfoIn, executionEnvironment) {
}
public:
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, bool withAubDump);
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, bool withAubDump, ExecutionEnvironment &executionEnvironment);
};
} // namespace OCLRT

View File

@ -29,7 +29,7 @@ namespace OCLRT {
TbxCommandStreamReceiverCreateFunc tbxCommandStreamReceiverFactory[IGFX_MAX_CORE] = {};
CommandStreamReceiver *TbxCommandStreamReceiver::create(const HardwareInfo &hwInfo, bool withAubDump) {
CommandStreamReceiver *TbxCommandStreamReceiver::create(const HardwareInfo &hwInfo, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
if (hwInfo.pPlatform->eRenderCoreFamily >= IGFX_MAX_CORE) {
DEBUG_BREAK_IF(!false);
@ -38,6 +38,6 @@ CommandStreamReceiver *TbxCommandStreamReceiver::create(const HardwareInfo &hwIn
auto pCreate = tbxCommandStreamReceiverFactory[hwInfo.pPlatform->eRenderCoreFamily];
return pCreate ? pCreate(hwInfo, withAubDump) : nullptr;
return pCreate ? pCreate(hwInfo, withAubDump, executionEnvironment) : nullptr;
}
} // namespace OCLRT

View File

@ -34,6 +34,7 @@ namespace OCLRT {
struct HardwareInfo;
class CommandStreamReceiver;
class TbxSockets;
class ExecutionEnvironment;
class TbxStream : public AubMemDump::AubStream {
TbxSockets *socket = nullptr;
@ -58,10 +59,10 @@ class TbxStream : public AubMemDump::AubStream {
};
struct TbxCommandStreamReceiver {
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, bool withAubDump);
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, bool withAubDump, ExecutionEnvironment &executionEnvironment);
using TbxStream = OCLRT::TbxStream;
};
typedef CommandStreamReceiver *(*TbxCommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump);
typedef CommandStreamReceiver *(*TbxCommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment);
} // namespace OCLRT

View File

@ -58,9 +58,9 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
void initGlobalMMIO();
void initEngineMMIO(EngineType engineType);
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, bool withAubDump);
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment);
TbxCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, void *ptr);
TbxCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, void *ptr, ExecutionEnvironment &executionEnvironment);
~TbxCommandStreamReceiverHw() override;
void initializeEngine(EngineType engineType);

View File

@ -32,8 +32,8 @@
namespace OCLRT {
template <typename GfxFamily>
TbxCommandStreamReceiverHw<GfxFamily>::TbxCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, void *ptr)
: BaseClass(hwInfoIn) {
TbxCommandStreamReceiverHw<GfxFamily>::TbxCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, void *ptr, ExecutionEnvironment &executionEnvironment)
: BaseClass(hwInfoIn, executionEnvironment) {
for (auto &engineInfo : engineInfoTable) {
engineInfo.pLRCA = nullptr;
engineInfo.ggttLRCA = 0u;
@ -170,12 +170,12 @@ void TbxCommandStreamReceiverHw<GfxFamily>::initializeEngine(EngineType engineTy
}
template <typename GfxFamily>
CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const HardwareInfo &hwInfoIn, bool withAubDump) {
CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
TbxCommandStreamReceiverHw<GfxFamily> *csr;
if (withAubDump) {
csr = new CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<GfxFamily>>(hwInfoIn);
csr = new CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<GfxFamily>>(hwInfoIn, executionEnvironment);
} else {
csr = new TbxCommandStreamReceiverHw<GfxFamily>(hwInfoIn, nullptr);
csr = new TbxCommandStreamReceiverHw<GfxFamily>(hwInfoIn, nullptr, executionEnvironment);
}
// Open our stream

View File

@ -63,7 +63,7 @@ void DeviceVector::toDeviceIDs(std::vector<cl_device_id> &devIDs) {
}
}
CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo);
CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo, ExecutionEnvironment &executionEnvironment);
// Global table of hardware prefixes
const char *hardwarePrefix[IGFX_MAX_PRODUCT] = {

View File

@ -32,8 +32,8 @@
namespace OCLRT {
CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo) {
return createCommandStreamImpl(pHwInfo);
CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo, ExecutionEnvironment &executionEnvironment) {
return createCommandStreamImpl(pHwInfo, executionEnvironment);
}
bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnviornment) {

View File

@ -31,7 +31,7 @@
namespace OCLRT {
ExecutionEnvironment::ExecutionEnvironment() = default;
ExecutionEnvironment::~ExecutionEnvironment() = default;
extern CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo);
extern CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo, ExecutionEnvironment &executionEnvironment);
void ExecutionEnvironment::initGmm(const HardwareInfo *hwInfo) {
if (!gmmHelper) {
@ -42,7 +42,7 @@ bool ExecutionEnvironment::initializeCommandStreamReceiver(const HardwareInfo *p
if (this->commandStreamReceiver) {
return true;
}
CommandStreamReceiver *commandStreamReceiver = createCommandStream(pHwInfo);
CommandStreamReceiver *commandStreamReceiver = createCommandStream(pHwInfo, *this);
if (!commandStreamReceiver) {
return false;
}

View File

@ -29,11 +29,11 @@
namespace OCLRT {
template <typename GfxFamily>
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo, bool withAubDump) {
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
if (withAubDump) {
return new CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<GfxFamily>>(hwInfo);
return new CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<GfxFamily>>(hwInfo, executionEnvironment);
} else {
return new DrmCommandStreamReceiver<GfxFamily>(hwInfo, nullptr);
return new DrmCommandStreamReceiver<GfxFamily>(hwInfo, nullptr, executionEnvironment);
}
};
} // namespace OCLRT

View File

@ -48,7 +48,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
public:
// When drm is null default implementation is used. In this case DrmCommandStreamReceiver is responsible to free drm.
// When drm is passed, DCSR will not free it at destruction
DrmCommandStreamReceiver(const HardwareInfo &hwInfoIn, Drm *drm, gemCloseWorkerMode mode = gemCloseWorkerMode::gemCloseWorkerActive);
DrmCommandStreamReceiver(const HardwareInfo &hwInfoIn, Drm *drm, ExecutionEnvironment &executionEnvironment, gemCloseWorkerMode mode = gemCloseWorkerMode::gemCloseWorkerActive);
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) override;
void makeResident(GraphicsAllocation &gfxAllocation) override;

View File

@ -41,8 +41,8 @@ namespace OCLRT {
template <typename GfxFamily>
DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver(const HardwareInfo &hwInfoIn,
Drm *drm, gemCloseWorkerMode mode)
: BaseClass(hwInfoIn), gemCloseWorkerOperationMode(mode) {
Drm *drm, ExecutionEnvironment &executionEnvironment, gemCloseWorkerMode mode)
: BaseClass(hwInfoIn, executionEnvironment), gemCloseWorkerOperationMode(mode) {
this->drm = drm ? drm : Drm::get(0);
residency.reserve(512);
execObjectsStorage.reserve(512);

View File

@ -33,11 +33,11 @@
namespace OCLRT {
template <typename GfxFamily>
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo, bool withAubDump) {
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
if (withAubDump) {
return new CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<GfxFamily>>(hwInfo);
return new CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<GfxFamily>>(hwInfo, executionEnvironment);
} else {
return new WddmCommandStreamReceiver<GfxFamily>(hwInfo, nullptr);
return new WddmCommandStreamReceiver<GfxFamily>(hwInfo, nullptr, executionEnvironment);
}
}
} // namespace OCLRT

View File

@ -37,7 +37,7 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiver::memoryManager;
public:
WddmCommandStreamReceiver(const HardwareInfo &hwInfoIn, Wddm *wddm);
WddmCommandStreamReceiver(const HardwareInfo &hwInfoIn, Wddm *wddm, ExecutionEnvironment &executionEnvironment);
virtual ~WddmCommandStreamReceiver();
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) override;

View File

@ -48,8 +48,8 @@ namespace OCLRT {
DECLARE_COMMAND_BUFFER(CommandBufferHeader, UMD_OCL, FALSE, FALSE, PERFTAG_OCL);
template <typename GfxFamily>
WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareInfo &hwInfoIn, Wddm *wddm)
: BaseClass(hwInfoIn) {
WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareInfo &hwInfoIn, Wddm *wddm, ExecutionEnvironment &executionEnvironment)
: BaseClass(hwInfoIn, executionEnvironment) {
this->wddm = wddm;
if (this->wddm == nullptr) {
this->wddm = Wddm::createWddm(Wddm::pickWddmInterfaceVersion(hwInfoIn));

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
* copy of this software and associated documentation files (the "Software"),
@ -40,7 +40,7 @@ void AUBCommandStreamFixture::SetUp(CommandQueue *pCmdQ) {
strfilename << testInfo->test_case_name() << "_" << testInfo->name();
const auto &hwInfo = device.getHardwareInfo();
pCommandStreamReceiver = AUBCommandStreamReceiver::create(hwInfo, strfilename.str(), true);
pCommandStreamReceiver = AUBCommandStreamReceiver::create(hwInfo, strfilename.str(), true, *device.executionEnvironment);
ASSERT_NE(nullptr, pCommandStreamReceiver);
device.resetCommandStreamReceiver(pCommandStreamReceiver);

View File

@ -355,7 +355,7 @@ HWTEST_F(CommandQueueHwTest, GivenEventsWaitlistOnBlockingMapBufferWillWaitForEv
HWTEST_F(CommandQueueHwTest, GivenNotCompleteUserEventPassedToEnqueueWhenEventIsUnblockedThenAllSurfacesForBlockedCommandsAreMadeResident) {
int32_t executionStamp = 0;
auto mockCSR = new MockCsr<FamilyType>(executionStamp);
auto mockCSR = new MockCsr<FamilyType>(executionStamp, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCSR);
UserEvent userEvent(context);
@ -846,7 +846,7 @@ HWTEST_F(CommandQueueHwTest, givenBlockedInOrderCmdQueueAndAsynchronouslyComplet
CommandQueueHw<FamilyType> *cmdQHw = static_cast<CommandQueueHw<FamilyType> *>(this->pCmdQ);
int32_t executionStamp = 0;
auto mockCSR = new MockCsr<FamilyType>(executionStamp);
auto mockCSR = new MockCsr<FamilyType>(executionStamp, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCSR);
@ -901,7 +901,7 @@ HWTEST_F(OOQueueHwTest, givenBlockedOutOfOrderCmdQueueAndAsynchronouslyCompleted
CommandQueueHw<FamilyType> *cmdQHw = static_cast<CommandQueueHw<FamilyType> *>(this->pCmdQ);
int32_t executionStamp = 0;
auto mockCSR = new MockCsr<FamilyType>(executionStamp);
auto mockCSR = new MockCsr<FamilyType>(executionStamp, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCSR);
MockKernelWithInternals mockKernelWithInternals(*pDevice);

View File

@ -49,8 +49,8 @@ class CommandStreamReceiverDrmMock : public UltCommandStreamReceiver<FamilyType>
return 0;
}
CommandStreamReceiverDrmMock<FamilyType>()
: BaseClass(*platformDevices[0]) {
CommandStreamReceiverDrmMock<FamilyType>(ExecutionEnvironment &executionEnvironment)
: BaseClass(*platformDevices[0], executionEnvironment) {
}
~CommandStreamReceiverDrmMock() override {
@ -66,7 +66,7 @@ HWTEST_F(DrmRequirementsTests, enqueueKernel) {
size_t globalWorkOffset[3] = {0, 0, 0};
size_t globalWorkSize[3] = {1, 1, 1};
auto pCommandStreamReceiver = new CommandStreamReceiverDrmMock<FamilyType>;
auto pCommandStreamReceiver = new CommandStreamReceiverDrmMock<FamilyType>(*pDevice->executionEnvironment);
ASSERT_NE(nullptr, pCommandStreamReceiver);
pDevice->resetCommandStreamReceiver(pCommandStreamReceiver);
@ -85,7 +85,7 @@ HWTEST_F(DrmRequirementsTests, enqueueKernel) {
}
HWTEST_F(DrmRequirementsTests, finishTwice) {
CommandStreamReceiver *pCommandStreamReceiver = new CommandStreamReceiverDrmMock<FamilyType>;
CommandStreamReceiver *pCommandStreamReceiver = new CommandStreamReceiverDrmMock<FamilyType>(*pDevice->executionEnvironment);
ASSERT_NE(nullptr, pCommandStreamReceiver);
size_t GWS = 1;
pDevice->resetCommandStreamReceiver(pCommandStreamReceiver);
@ -112,7 +112,7 @@ HWTEST_F(DrmRequirementsTests, enqueueKernelFinish) {
size_t globalWorkOffset[3] = {0, 0, 0};
size_t globalWorkSize[3] = {1, 1, 1};
CommandStreamReceiver *pCommandStreamReceiver = new CommandStreamReceiverDrmMock<FamilyType>();
CommandStreamReceiver *pCommandStreamReceiver = new CommandStreamReceiverDrmMock<FamilyType>(*pDevice->executionEnvironment);
ASSERT_NE(nullptr, pCommandStreamReceiver);
// Replace the legacy command streamer with the Drm file version
@ -145,7 +145,7 @@ HWTEST_F(DrmRequirementsTests, enqueueKernelFinish) {
}
HWTEST_F(DrmRequirementsTests, csrNewCS) {
CommandStreamReceiver *pCSR = new UltCommandStreamReceiver<FamilyType>(*platformDevices[0]);
CommandStreamReceiver *pCSR = new UltCommandStreamReceiver<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
ASSERT_NE(nullptr, pCSR);
pCSR->setMemoryManager(pDevice->getMemoryManager());
auto memoryManager = pCSR->getMemoryManager();
@ -171,7 +171,7 @@ HWTEST_F(DrmRequirementsTests, csrNewCS) {
}
HWTEST_F(DrmRequirementsTests, csrNewCSSized) {
CommandStreamReceiver *pCSR = new UltCommandStreamReceiver<FamilyType>(*platformDevices[0]);
CommandStreamReceiver *pCSR = new UltCommandStreamReceiver<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
ASSERT_NE(nullptr, pCSR);
pCSR->setMemoryManager(pDevice->getMemoryManager());
auto memoryManager = pCSR->getMemoryManager();

View File

@ -37,7 +37,7 @@ using namespace OCLRT;
HWTEST_F(EnqueueHandlerTest, enqueueHandlerWithKernelCallsProcessEvictionOnCSR) {
int32_t tag;
auto csr = new MockCsrBase<FamilyType>(tag);
auto csr = new MockCsrBase<FamilyType>(tag, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(csr);
MockKernelWithInternals mockKernel(*pDevice);
@ -51,7 +51,7 @@ HWTEST_F(EnqueueHandlerTest, enqueueHandlerWithKernelCallsProcessEvictionOnCSR)
HWTEST_F(EnqueueHandlerTest, enqueueHandlerCallOnEnqueueMarkerDoesntCallProcessEvictionOnCSR) {
int32_t tag;
auto csr = new MockCsrBase<FamilyType>(tag);
auto csr = new MockCsrBase<FamilyType>(tag, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(csr);
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(context, pDevice, 0));
@ -68,7 +68,7 @@ HWTEST_F(EnqueueHandlerTest, enqueueHandlerCallOnEnqueueMarkerDoesntCallProcessE
HWTEST_F(EnqueueHandlerTest, enqueueHandlerForMarkerOnUnblockedQueueDoesntIncrementTaskLevel) {
int32_t tag;
auto csr = new MockCsrBase<FamilyType>(tag);
auto csr = new MockCsrBase<FamilyType>(tag, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(csr);
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(context, pDevice, 0));
@ -86,7 +86,7 @@ HWTEST_F(EnqueueHandlerTest, enqueueHandlerForMarkerOnUnblockedQueueDoesntIncrem
HWTEST_F(EnqueueHandlerTest, enqueueHandlerForMarkerOnBlockedQueueShouldNotIncrementTaskLevel) {
int32_t tag;
auto csr = new MockCsrBase<FamilyType>(tag);
auto csr = new MockCsrBase<FamilyType>(tag, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(csr);
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(context, pDevice, 0));
@ -233,7 +233,7 @@ HWTEST_F(EnqueueHandlerTest, enqueueWithOutputEventRegistersEvent) {
}
HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenAddPatchInfoCommentsForAUBDumpIsNotSetThenPatchInfoDataIsNotTransferredToCSR) {
auto csr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto csr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
auto mockHelper = new MockFlatBatchBufferHelper<FamilyType>(csr->getMemoryManager());
csr->overwriteFlatBatchBufferHelper(mockHelper);
pDevice->resetCommandStreamReceiver(csr);
@ -255,7 +255,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenAddPatchInfoCommentsForAUBDu
DebugManager.flags.AddPatchInfoCommentsForAUBDump.set(true);
DebugManager.flags.FlattenBatchBufferForAUBDump.set(true);
auto csr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto csr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
auto mockHelper = new MockFlatBatchBufferHelper<FamilyType>(csr->getMemoryManager());
csr->overwriteFlatBatchBufferHelper(mockHelper);
pDevice->resetCommandStreamReceiver(csr);

View File

@ -29,7 +29,7 @@ typedef HelloWorldFixture<HelloWorldFixtureFactory> EnqueueKernelFixture;
typedef Test<EnqueueKernelFixture> EnqueueKernelTest;
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenFinishIsCalledThenBatchesSubmissionsAreFlushed) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);

View File

@ -636,7 +636,7 @@ INSTANTIATE_TEST_CASE_P(EnqueueKernel,
typedef EnqueueKernelTypeTest<int> EnqueueKernelWithScratch;
HWTEST_P(EnqueueKernelWithScratch, GivenKernelRequiringScratchWhenItIsEnqueuedWithDifferentScratchSizesThenPreviousScratchAllocationIsMadeNonResidentPriorStoringOnResueList) {
auto mockCsr = new MockCsrHw<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
SPatchMediaVFEState mediaVFEstate;
@ -992,7 +992,7 @@ HWTEST_F(EnqueueKernelTest, givenEnqueueWithGlobalWorkSizeWhenZeroValueIsPassedI
}
HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenEnqueueKernelIsCalledThenKernelIsRecorded) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1023,7 +1023,7 @@ HWTEST_F(EnqueueKernelTest, givenDefaultCommandStreamReceiverWhenClFlushIsCalled
}
HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeAndBatchedKernelWhenFlushIsCalledThenKernelIsSubmitted) {
auto mockCsrmockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsrmockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsrmockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsrmockCsr);
@ -1044,7 +1044,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeAndBatchedKe
}
HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeAndBatchedKernelWhenFlushIsCalledTwiceThenNothingChanges) {
auto mockCsrmockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsrmockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsrmockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsrmockCsr);
@ -1064,7 +1064,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeAndBatchedKe
EXPECT_EQ(1, mockCsrmockCsr->flushCalledCount);
}
HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenKernelIsEnqueuedTwiceThenTwoSubmissionsAreRecorded) {
auto mockCsrmockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsrmockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsrmockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsrmockCsr);
@ -1093,7 +1093,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenKernelIs
}
HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenFlushIsCalledOnTwoBatchedKernelsThenTheyAreExecutedInOrder) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1111,7 +1111,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenFlushIsC
}
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenFinishIsCalledThenBatchesSubmissionsAreFlushed) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1130,7 +1130,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenFinishIsCalledThenBatchesS
}
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenThressEnqueueKernelsAreCalledThenBatchesSubmissionsAreFlushed) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1150,7 +1150,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenThressEnqueueKernelsAreCal
}
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenWaitForEventsIsCalledThenBatchedSubmissionsAreFlushed) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1174,7 +1174,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenWaitForEventsIsCalledThenB
}
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenCommandIsFlushedThenFlushStampIsUpdatedInCommandQueueCsrAndEvent) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1206,7 +1206,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenCommandIsFlushedThenFlushS
}
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenCommandWithEventIsFollowedByCommandWithoutEventThenFlushStampIsUpdatedInCommandQueueCsrAndEvent) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1238,7 +1238,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenCommandWithEventIsFollowed
}
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenClFlushIsCalledThenQueueFlushStampIsUpdated) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1255,7 +1255,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenClFlushIsCalledThenQueueFl
}
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenWaitForEventsIsCalledWithUnflushedTaskCountThenBatchedSubmissionsAreFlushed) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1279,7 +1279,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenWaitForEventsIsCalledWithU
}
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenFinishIsCalledWithUnflushedTaskCountThenBatchedSubmissionsAreFlushed) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1306,7 +1306,7 @@ HWTEST_F(EnqueueKernelTest, givenOutOfOrderCommandQueueWhenEnqueueKernelIsMadeTh
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
auto ooq = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1328,7 +1328,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelIsMadeThenP
const cl_queue_properties props[] = {0};
auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1350,7 +1350,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelThatHasShar
const cl_queue_properties props[] = {0};
auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1371,7 +1371,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelThatHasShar
}
HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelThatHasSharedObjectsAsArgIsMadeThenPipeControlDoesntHaveDcFlush) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1387,7 +1387,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelReturningEv
const cl_queue_properties props[] = {0};
auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1413,7 +1413,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelReturningEv
const cl_queue_properties props[] = {0};
auto inOrderQueue = clCreateCommandQueueWithProperties(context, pDevice, props, nullptr);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->enableNTo1SubmissionModel();
@ -1437,7 +1437,7 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelReturningEv
}
HWTEST_F(EnqueueKernelTest, givenOutOfOrderCommandQueueWhenEnqueueKernelReturningEventIsMadeThenPipeControlPositionIsRecorded) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1465,7 +1465,7 @@ HWTEST_F(EnqueueKernelTest, givenOutOfOrderCommandQueueWhenEnqueueKernelReturnin
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenBlockingCallIsMadeThenEventAssociatedWithCommandHasProperFlushStamp) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.MakeEachEnqueueBlocking.set(true);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1482,7 +1482,7 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenBlockingCallIsMadeThenEven
}
HWTEST_F(EnqueueKernelTest, givenKernelWhenItIsEnqueuedThenAllResourceGraphicsAllocationsAreUpdatedWithCsrTaskCount) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
@ -1546,7 +1546,7 @@ TEST_F(EnqueueKernelTest, givenEnqueueCommandThatLwsExceedsDeviceCapabilitiesWhe
}
HWTEST_F(EnqueueKernelTest, givenVMEKernelWhenEnqueueKernelThenDispatchFlagsHaveMediaSamplerRequired) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -1558,7 +1558,7 @@ HWTEST_F(EnqueueKernelTest, givenVMEKernelWhenEnqueueKernelThenDispatchFlagsHave
}
HWTEST_F(EnqueueKernelTest, givenNonVMEKernelWhenEnqueueKernelThenDispatchFlagsDoesntHaveMediaSamplerRequired) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);

View File

@ -44,7 +44,7 @@ class CommandStreamReceiverMock : public UltCommandStreamReceiver<FamilyType> {
public:
size_t expectedToFreeCount = (size_t)-1;
CommandStreamReceiverMock(Device *pDevice) : UltCommandStreamReceiver<FamilyType>(*platformDevices[0]) {
CommandStreamReceiverMock(Device *pDevice) : UltCommandStreamReceiver<FamilyType>(*platformDevices[0], *pDevice->getExecutionEnvironment()) {
this->pDevice = pDevice;
}

View File

@ -136,7 +136,7 @@ HWTEST_F(OOQTaskTests, givenCommandQueueWithLowerTaskLevelThenCsrWhenItIsSubmitt
}
HWTEST_F(OOQTaskTests, givenCommandQueueAtTaskLevel100WhenMultipleEnqueueAreDoneThenTaskLevelDoesntChnage) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
mockCsr->taskLevel = 100;
@ -151,7 +151,7 @@ HWTEST_F(OOQTaskTests, givenCommandQueueAtTaskLevel100WhenMultipleEnqueueAreDone
}
HWTEST_F(OOQTaskTests, givenCommandQueueAtTaskLevel100WhenItIsFlushedAndFollowedByNewCommandsThenTheyHaveHigherTaskLevel) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
mockCsr->taskLevel = 100;
@ -170,7 +170,7 @@ HWTEST_F(OOQTaskTests, givenCommandQueueAtTaskLevel100WhenItIsFlushedAndFollowed
}
HWTEST_F(OOQTaskTests, givenCommandQueueAtTaskLevel100WhenItIsFlushedAndFollowedByNewCommandsAndBarrierThenCsrTaskLevelIncreases) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
mockCsr->taskLevel = 100;
@ -190,7 +190,7 @@ HWTEST_F(OOQTaskTests, givenCommandQueueAtTaskLevel100WhenItIsFlushedAndFollowed
}
HWTEST_F(OOQTaskTests, givenCommandQueueAtTaskLevel100WhenItIsFlushedAndFollowedByNewCommandsAndMarkerThenCsrTaskLevelIsNotIncreasing) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
mockCsr->taskLevel = 100;
@ -210,7 +210,7 @@ HWTEST_F(OOQTaskTests, givenCommandQueueAtTaskLevel100WhenItIsFlushedAndFollowed
}
HWTEST_F(OOQTaskTests, givenTwoEnqueueCommandSynchronizedByEventsWhenTheyAreEnqueueThenSecondHasHigherTaskLevelThenFirst) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
auto currentTaskLevel = this->pCmdQ->taskLevel;

View File

@ -54,8 +54,8 @@ typedef Test<DeviceFixture> AubCommandStreamReceiverTests;
template <typename GfxFamily>
struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
MockAubCsr(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone)
: AUBCommandStreamReceiverHw<GfxFamily>(hwInfoIn, fileName, standalone){};
MockAubCsr(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone, ExecutionEnvironment &executionEnvironment)
: AUBCommandStreamReceiverHw<GfxFamily>(hwInfoIn, fileName, standalone, executionEnvironment){};
DispatchMode peekDispatchMode() const {
return this->dispatchMode;
@ -136,7 +136,7 @@ struct AubExecutionEnvironment {
template <typename CsrType>
std::unique_ptr<AubExecutionEnvironment> getEnvironment(bool createTagAllocation, bool allocateCommandBuffer, bool standalone) {
std::unique_ptr<ExecutionEnvironment> executionEnvironment(new ExecutionEnvironment);
executionEnvironment->commandStreamReceiver.reset(new CsrType(*platformDevices[0], "", standalone));
executionEnvironment->commandStreamReceiver.reset(new CsrType(*platformDevices[0], "", standalone, *executionEnvironment));
executionEnvironment->memoryManager.reset(executionEnvironment->commandStreamReceiver->createMemoryManager(false));
executionEnvironment->commandStreamReceiver->setMemoryManager(executionEnvironment->memoryManager.get());
if (createTagAllocation) {
@ -178,7 +178,7 @@ TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreat
const_cast<PLATFORM *>(hwInfo.pPlatform)->eRenderCoreFamily = GFXCORE_FAMILY_FORCE_ULONG; // wrong gfx core family
CommandStreamReceiver *aubCsr = AUBCommandStreamReceiver::create(hwInfo, "", true);
CommandStreamReceiver *aubCsr = AUBCommandStreamReceiver::create(hwInfo, "", true, *pDevice->executionEnvironment);
EXPECT_EQ(nullptr, aubCsr);
const_cast<PLATFORM *>(hwInfo.pPlatform)->eRenderCoreFamily = family;
@ -186,7 +186,7 @@ TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreat
TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenTypeIsCheckedThenAubCsrIsReturned) {
HardwareInfo hwInfo = *platformDevices[0];
std::unique_ptr<CommandStreamReceiver> aubCsr(AUBCommandStreamReceiver::create(hwInfo, "", true));
std::unique_ptr<CommandStreamReceiver> aubCsr(AUBCommandStreamReceiver::create(hwInfo, "", true, *pDevice->executionEnvironment));
EXPECT_NE(nullptr, aubCsr);
EXPECT_EQ(CommandStreamReceiverType::CSR_AUB, aubCsr->getType());
}
@ -194,19 +194,19 @@ TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenTypeIsChe
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenItIsCreatedWithDefaultSettingsThenItHasBatchedDispatchModeEnabled) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.CsrDispatchMode.set(0);
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
EXPECT_EQ(DispatchMode::BatchedDispatch, aubCsr->peekDispatchMode());
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenItIsCreatedWithDebugSettingsThenItHasProperDispatchModeEnabled) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::ImmediateDispatch));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
EXPECT_EQ(DispatchMode::ImmediateDispatch, aubCsr->peekDispatchMode());
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreatedThenMemoryManagerIsNotNull) {
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(**platformDevices, "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(**platformDevices, "", true, *pDevice->executionEnvironment));
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
EXPECT_NE(nullptr, memoryManager.get());
aubCsr->setMemoryManager(nullptr);
@ -217,7 +217,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
DebugManager.flags.AUBDumpSubCaptureMode.set(static_cast<int32_t>(AubSubCaptureManager::SubCaptureMode::Filter));
HardwareInfo hwInfo = *platformDevices[0];
std::string fileName = "file_name.aub";
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(reinterpret_cast<AUBCommandStreamReceiverHw<FamilyType> *>(AUBCommandStreamReceiver::create(hwInfo, fileName, true)));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(reinterpret_cast<AUBCommandStreamReceiverHw<FamilyType> *>(AUBCommandStreamReceiver::create(hwInfo, fileName, true, *pDevice->executionEnvironment)));
EXPECT_NE(nullptr, aubCsr);
EXPECT_FALSE(aubCsr->isFileOpen());
}
@ -225,7 +225,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrInSubCaptureModeWhenItIsCreatedWithoutDebugFilterSettingsThenItInitializesSubCaptureFiltersWithDefaults) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.AUBDumpSubCaptureMode.set(static_cast<int32_t>(AubSubCaptureManager::SubCaptureMode::Filter));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
EXPECT_EQ(0u, aubCsr->subCaptureManager->subCaptureFilter.dumpKernelStartIdx);
EXPECT_EQ(static_cast<uint32_t>(-1), aubCsr->subCaptureManager->subCaptureFilter.dumpKernelEndIdx);
EXPECT_STREQ("", aubCsr->subCaptureManager->subCaptureFilter.dumpKernelName.c_str());
@ -237,14 +237,14 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrInSubCaptureModeWhenItIsCreat
DebugManager.flags.AUBDumpFilterKernelStartIdx.set(10);
DebugManager.flags.AUBDumpFilterKernelEndIdx.set(100);
DebugManager.flags.AUBDumpFilterKernelName.set("kernel_name");
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
EXPECT_EQ(static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterKernelStartIdx.get()), aubCsr->subCaptureManager->subCaptureFilter.dumpKernelStartIdx);
EXPECT_EQ(static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterKernelEndIdx.get()), aubCsr->subCaptureManager->subCaptureFilter.dumpKernelEndIdx);
EXPECT_STREQ(DebugManager.flags.AUBDumpFilterKernelName.get().c_str(), aubCsr->subCaptureManager->subCaptureFilter.dumpKernelName.c_str());
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenInitFileIsCalledWithInvalidFileNameThenFileIsNotOpened) {
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(**platformDevices, "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(**platformDevices, "", true, *pDevice->executionEnvironment));
std::string invalidFileName = "";
aubCsr->initFile(invalidFileName);
@ -252,7 +252,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenInitFil
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenInitFileIsCalledThenFileIsOpenedAndFileNameIsStored) {
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(**platformDevices, "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(**platformDevices, "", true, *pDevice->executionEnvironment));
std::string fileName = "file_name.aub";
aubCsr->initFile(fileName);
@ -266,7 +266,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenInitFil
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentCalledMultipleTimesAffectsResidencyOnce) {
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
@ -634,7 +634,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnBufferAndImageTypeAllocationsThenAllocationsHaveAubWritableSetToFalse) {
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
@ -657,7 +657,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcessResidencyIsCalledOnBufferAndImageAllocationsThenAllocationsTypesShouldBeMadeNonAubWritable) {
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
@ -679,7 +679,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModWhenProcessResidencyIsCalledWithDumpAubNonWritableFlagThenAllocationsTypesShouldBeMadeAubWritable) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
@ -705,7 +705,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcessResidencyIsCalledWithoutDumpAubWritableFlagThenAllocationsTypesShouldBeKeptNonAubWritable) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
@ -730,7 +730,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationTypeIsntNonAubWritableThenWriteMemoryIsAllowed) {
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
@ -742,7 +742,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationTypeIsNonAubWritableThenWriteMemoryIsNotAllowed) {
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
@ -754,7 +754,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationSizeIsZeroThenWriteMemoryIsNotAllowed) {
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
GraphicsAllocation gfxAllocation((void *)0x1234, 0);
EXPECT_FALSE(aubCsr->writeMemory(gfxAllocation));
@ -762,7 +762,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenAubSubCaptureIsActivatedThenFileIsOpened) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -783,7 +783,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenAubSubCaptureRemainsActivedThenTheSameFileShouldBeKeptOpened) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -807,7 +807,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenAubSubCaptureIsActivatedWithNewFileNameThenNewFileShouldBeReOpened) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false, *pDevice->executionEnvironment));
std::string newFileName = "new_file_name.aub";
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
@ -835,7 +835,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenAubSubCaptureIsActivatedForNewFileThenOldEngineInfoTableShouldBeFreed) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false, *pDevice->executionEnvironment));
std::string newFileName = "new_file_name.aub";
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
@ -865,7 +865,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenAubSubCaptureIsActivatedThenForceDumpingAllocationsAubNonWritable) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", false));
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", false, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -884,7 +884,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenAubSubCaptureRemainsActivatedThenDontForceDumpingAllocationsAubNonWritable) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", false));
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", false, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -904,7 +904,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenSubCaptureModeRemainsDeactivatedThenSubCaptureIsDisabled) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -920,7 +920,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenSubCaptureIsToggledOnThenSubCaptureGetsEnabled) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", false, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -938,7 +938,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneAndSubCaptureModeWhenSubCaptureRemainsDeactivatedThenNeitherProgrammingFlagsAreInitializedNorCsrIsFlushed) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -957,7 +957,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneAndSubCaptureModeWhenSubCaptureRemainsActivatedThenNeitherProgrammingFlagsAreInitializedNorCsrIsFlushed) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -976,7 +976,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneAndSubCaptureModeWhenSubCaptureGetsActivatedThenProgrammingFlagsAreInitialized) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -995,7 +995,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneAndSubCaptureModeWhenSubCaptureGetsDeactivatedThenCsrIsFlushed) {
DebugManagerStateRestore stateRestore;
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
auto subCaptureManagerMock = new AubSubCaptureManagerMock("");
subCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
@ -1014,7 +1014,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedBatchBufferFlatteningInImmediateDispatchModeThenNewCombinedBatchBufferIsCreated) {
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto flatBatchBufferHelper = new FlatBatchBufferHelperHw<FamilyType>(memoryManager.get());
aubCsr->overwriteFlatBatchBufferHelper(flatBatchBufferHelper);
@ -1042,7 +1042,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedBatchBufferInImmediateDispatchModeAndNoChainedBatchBufferThenCombinedBatchBufferIsNotCreated) {
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto flatBatchBufferHelper = new FlatBatchBufferHelperHw<FamilyType>(memoryManager.get());
aubCsr->overwriteFlatBatchBufferHelper(flatBatchBufferHelper);
@ -1064,7 +1064,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedBatchBufferAndNotImmediateOrBatchedDispatchModeThenCombinedBatchBufferIsNotCreated) {
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
auto flatBatchBufferHelper = new FlatBatchBufferHelperHw<FamilyType>(memoryManager.get());
aubCsr->overwriteFlatBatchBufferHelper(flatBatchBufferHelper);
@ -1613,7 +1613,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGetIndi
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGetIndirectPatchCommandsIsCalledForNonEmptyPatchInfoListThenIndirectPatchCommandBufferIsCreated) {
typedef typename FamilyType::MI_STORE_DATA_IMM MI_STORE_DATA_IMM;
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
PatchInfoData patchInfo1(0xA000, 0u, PatchInfoAllocationType::KernelArg, 0x6000, 0x100, PatchInfoAllocationType::IndirectObjectHeap);
@ -1640,7 +1640,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenAddBatc
DebugManager.flags.FlattenBatchBufferForAUBDump.set(true);
std::unique_ptr<MemoryManager> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(aubCsr->createMemoryManager(false));
MI_BATCH_BUFFER_START bbStart;
@ -1657,7 +1657,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenAddBatc
HWTEST_F(AubCommandStreamReceiverTests, givenFlatBatchBufferHelperWhenSettingSroreQwordOnSDICommandThenAppropriateBitIsSet) {
typedef typename FamilyType::MI_STORE_DATA_IMM MI_STORE_DATA_IMM;
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
MI_STORE_DATA_IMM cmd;
cmd.init();
@ -1706,7 +1706,7 @@ class OsAgnosticMemoryManagerForImagesWithNoHostPtr : public OsAgnosticMemoryMan
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnImageWithNoHostPtrThenResourceShouldBeLockedToGetCpuAddress) {
std::unique_ptr<OsAgnosticMemoryManagerForImagesWithNoHostPtr> memoryManager(nullptr);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
memoryManager.reset(new OsAgnosticMemoryManagerForImagesWithNoHostPtr);
aubCsr->setMemoryManager(memoryManager.get());
@ -1736,7 +1736,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
HWTEST_F(AubCommandStreamReceiverTests, givenNoDbgDeviceIdFlagWhenAubCsrIsCreatedThenUseDefaultDeviceId) {
const HardwareInfo &hwInfoIn = *platformDevices[0];
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(hwInfoIn, "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(hwInfoIn, "", true, *pDevice->executionEnvironment));
EXPECT_EQ(hwInfoIn.capabilityTable.aubDeviceId, aubCsr->aubDeviceId);
}
@ -1744,13 +1744,13 @@ HWTEST_F(AubCommandStreamReceiverTests, givenDbgDeviceIdFlagIsSetWhenAubCsrIsCre
DebugManagerStateRestore stateRestore;
DebugManager.flags.OverrideAubDeviceId.set(9); //this is Hsw, not used
const HardwareInfo &hwInfoIn = *platformDevices[0];
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(hwInfoIn, "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(hwInfoIn, "", true, *pDevice->executionEnvironment));
EXPECT_EQ(9u, aubCsr->aubDeviceId);
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGetGTTDataIsCalledThenLocalMemoryShouldBeDisabled) {
const HardwareInfo &hwInfoIn = *platformDevices[0];
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(hwInfoIn, "", true));
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(hwInfoIn, "", true, *pDevice->executionEnvironment));
AubGTTData data = {};
aubCsr->getGTTData(nullptr, data);
EXPECT_TRUE(data.present);

View File

@ -74,7 +74,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenCsrInBatchingModeThreeRe
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
auto mockHelper = new MockFlatBatchBufferHelper<FamilyType>(mockCsr->getMemoryManager());
mockCsr->overwriteFlatBatchBufferHelper(mockHelper);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -140,7 +140,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenA
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
auto mockHelper = new MockFlatBatchBufferHelper<FamilyType>(mockCsr->getMemoryManager());
mockCsr->overwriteFlatBatchBufferHelper(mockHelper);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -167,7 +167,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenA
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
auto mockHelper = new MockFlatBatchBufferHelper<FamilyType>(mockCsr->getMemoryManager());
mockCsr->overwriteFlatBatchBufferHelper(mockHelper);
@ -219,7 +219,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenA
HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCsrWhenCollectStateBaseAddresPatchInfoIsCalledThenAppropriateAddressesAreTaken) {
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*platformDevices[0]));
std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment));
auto mockHelper = new MockFlatBatchBufferHelper<FamilyType>(mockCsr->getMemoryManager());
mockCsr->overwriteFlatBatchBufferHelper(mockHelper);

View File

@ -116,7 +116,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenconfigureCSRtoNonDirtyStateWh
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSubmittedViaCsrThenBbEndCoversPaddingEnoughToFitMiBatchBufferStart) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -137,7 +137,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSu
EXPECT_EQ(expectedUsedSize, mockCsr->commandStream.getUsed());
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSubmittedViaCommandStreamThenBbEndCoversPaddingEnoughToFitMiBatchBufferStart) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -164,7 +164,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSu
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenflushTaskThenDshAndIohNotEvictable) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
DispatchFlags dispatchFlags;
@ -188,7 +188,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenflushTaskThenDshAndIoh
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndMidThreadPreemptionWhenFlushTaskIsCalledThenSipKernelIsMadeResident) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -220,7 +220,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndMidThread
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeAndMidThreadPreemptionWhenFlushTaskIsCalledThenSipKernelIsMadeResident) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
@ -252,7 +252,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeAndMidThreadP
HWTEST_F(CommandStreamReceiverFlushTaskTests, sameTaskLevelShouldntSendAPipeControl) {
WhitelistedRegisters forceRegs = {0};
pDevice->setForceWhitelistedRegs(true, &forceRegs);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
@ -272,7 +272,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDeviceWithThreadGroupPreempti
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::ThreadGroup));
WhitelistedRegisters forceRegs = {0};
pDevice->setForceWhitelistedRegs(true, &forceRegs);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->setPreemptionMode(PreemptionMode::ThreadGroup);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
@ -760,8 +760,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithOnlyEnoughMemoryForPr
template <typename FamilyType>
struct CommandStreamReceiverHwLog : public UltCommandStreamReceiver<FamilyType> {
CommandStreamReceiverHwLog(const HardwareInfo &hwInfoIn) : UltCommandStreamReceiver<FamilyType>(hwInfoIn),
flushCount(0) {
CommandStreamReceiverHwLog(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment) : UltCommandStreamReceiver<FamilyType>(hwInfoIn, executionEnvironment),
flushCount(0) {
}
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) override {
@ -773,7 +773,7 @@ struct CommandStreamReceiverHwLog : public UltCommandStreamReceiver<FamilyType>
};
HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithBothCSCallsFlushOnce) {
CommandStreamReceiverHwLog<FamilyType> commandStreamReceiver(*platformDevices[0]);
CommandStreamReceiverHwLog<FamilyType> commandStreamReceiver(*platformDevices[0], *pDevice->executionEnvironment);
commandStreamReceiver.setMemoryManager(pDevice->getMemoryManager());
commandStreamReceiver.initializeTagAllocation();
commandStream.getSpace(sizeof(typename FamilyType::MI_NOOP));
@ -866,7 +866,7 @@ HWTEST_F(CommandStreamReceiverCQFlushTaskTests, getCSShouldReturnACSWithEnoughSi
HWTEST_F(CommandStreamReceiverFlushTaskTests, blockingFlushTaskWithOnlyPipeControl) {
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
// Configure the CSR to not need to submit any state or commands
@ -1332,7 +1332,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, GivenFlushedCal
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDefaultCommandStreamReceiverThenRoundRobinPolicyIsSelected) {
MockCsrHw<FamilyType> commandStreamReceiver(*platformDevices[0]);
MockCsrHw<FamilyType> commandStreamReceiver(*platformDevices[0], *pDevice->executionEnvironment);
EXPECT_EQ(PreambleHelper<FamilyType>::getDefaultThreadArbitrationPolicy(), commandStreamReceiver.peekThreadArbitrationPolicy());
}
@ -1342,7 +1342,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenKernelWithSlmWhenPreviousSLML
MockContext ctx(pDevice);
MockKernelWithInternals kernel(*pDevice);
CommandQueueHw<FamilyType> commandQueue(&ctx, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
auto &commandStreamCSR = commandStreamReceiver->getCS();
@ -1368,7 +1368,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenKernelWithSlmWhenPreviousSLML
HWTEST_F(CommandStreamReceiverFlushTaskTests, CreateCommandStreamReceiverHw) {
const HardwareInfo hwInfo = *platformDevices[0];
auto csrHw = CommandStreamReceiverHw<FamilyType>::create(hwInfo);
auto csrHw = CommandStreamReceiverHw<FamilyType>::create(hwInfo, executionEnvironment);
EXPECT_NE(nullptr, csrHw);
MemoryManager *mm = csrHw->createMemoryManager(false);
@ -1379,14 +1379,15 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, CreateCommandStreamReceiverHw) {
int32_t GetCsr = DebugManager.flags.SetCommandStreamReceiver.get();
EXPECT_EQ(0, GetCsr);
auto csr = OCLRT::createCommandStream(&hwInfo);
ExecutionEnvironment executionEnvironment;
auto csr = OCLRT::createCommandStream(&hwInfo, executionEnvironment);
EXPECT_NE(nullptr, csr);
delete csr;
DebugManager.flags.SetCommandStreamReceiver.set(0);
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, handleTagAndScratchAllocationsResidencyOnEachFlush) {
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
commandStreamReceiver->setRequiredScratchSize(1024); // whatever > 0
@ -1429,7 +1430,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenTwoConsecu
MockContext ctx(pDevice);
MockKernelWithInternals kernel(*pDevice);
CommandQueueHw<FamilyType> commandQueue(&ctx, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
size_t GWS = 1;
@ -1539,7 +1540,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenNDRangeKer
MockContext ctx(pDevice);
MockKernelWithInternals kernel(*pDevice);
CommandQueueHw<FamilyType> commandQueue(&ctx, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
size_t GWS = 1;
@ -1651,7 +1652,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, InForced32BitAllocationsModeDoNotS
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.Force32bitAddressing.set(true);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->getMemoryManager()->setForce32BitAllocations(true);
@ -1685,7 +1686,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, InForced32BitAllocationsModeStore3
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.Force32bitAddressing.set(true);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->getMemoryManager()->setForce32BitAllocations(true);
@ -1906,7 +1907,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInNonDirtyStateWhenflushTa
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
configureCSRtoNonDirtyState<FamilyType>();
@ -1929,7 +1930,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInNonDirtyStateAndBatching
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -1964,7 +1965,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTas
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2021,7 +2022,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndTwoRecord
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2072,7 +2073,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndThreeReco
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2134,7 +2135,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndThreeReco
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2202,7 +2203,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTas
auto initialBase = commandStream.getCpuBase();
auto initialUsed = commandStream.getUsed();
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2275,7 +2276,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenRecorded
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2343,7 +2344,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenRecorded
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrCreatedWithDedicatedDebugFlagWhenItIsCreatedThenItHasProperDispatchMode) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::AdaptiveDispatch));
std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*platformDevices[0]));
std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment));
EXPECT_EQ(DispatchMode::AdaptiveDispatch, mockCsr->dispatchMode);
}
@ -2351,7 +2352,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenBlocking
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2379,7 +2380,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenBlocking
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenBufferToFlushWhenFlushTaskCalledThenUpdateFlushStamp) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
commandStream.getSpace(1);
@ -2392,7 +2393,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenBufferToFlushWhenFlushTaskCal
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenNothingToFlushWhenFlushTaskCalledThenDontFlushStamp) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
configureCSRtoNonDirtyState<FamilyType>();
@ -2409,7 +2410,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTas
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2462,7 +2463,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenWaitForT
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2502,7 +2503,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenEnqueueI
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2542,7 +2543,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenSusbsequ
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2598,7 +2599,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalRes
auto &commandStream = commandQueue.getCS(4096u);
std::unique_ptr<MockedMemoryManager> mockedMemoryManager(new MockedMemoryManager());
std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*platformDevices[0]));
std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment));
mockedMemoryManager->device = pDevice;
mockCsr->setMemoryManager(mockedMemoryManager.get());
@ -2656,7 +2657,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrInBatch
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2737,7 +2738,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushI
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2765,7 +2766,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenCommandA
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2796,7 +2797,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWithOutOfOrd
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2827,7 +2828,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushI
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2858,7 +2859,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrInBatch
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2916,7 +2917,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrInBatch
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -2977,7 +2978,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrInBatch
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -3116,7 +3117,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetT
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -3148,7 +3149,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetT
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -3180,7 +3181,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetT
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);

View File

@ -148,7 +148,7 @@ typedef Test<DeviceFixture> CommandStreamReceiverHwTest;
HWTEST_F(CommandStreamReceiverHwTest, givenCsrHwWhenTypeIsCheckedThenCsrHwIsReturned) {
HardwareInfo hwInfo = *platformDevices[0];
auto csr = std::unique_ptr<CommandStreamReceiver>(CommandStreamReceiverHw<FamilyType>::create(hwInfo));
auto csr = std::unique_ptr<CommandStreamReceiver>(CommandStreamReceiverHw<FamilyType>::create(hwInfo, *pDevice->executionEnvironment));
EXPECT_EQ(CommandStreamReceiverType::CSR_HW, csr->getType());
}

View File

@ -49,7 +49,7 @@ void CommandStreamReceiverHwTest<GfxFamily>::givenKernelWithSlmWhenPreviousNOSLM
MockContext ctx(pDevice);
MockKernelWithInternals kernel(*pDevice);
CommandQueueHw<GfxFamily> commandQueue(&ctx, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<GfxFamily>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<GfxFamily>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
auto &commandStreamCSR = commandStreamReceiver->getCS();
@ -90,7 +90,7 @@ void CommandStreamReceiverHwTest<GfxFamily>::givenBlockedKernelWithSlmWhenPrevio
MockContext ctx(pDevice);
MockKernelWithInternals kernel(*pDevice);
CommandQueueHw<GfxFamily> commandQueue(&ctx, pDevice, 0);
auto commandStreamReceiver = new MockCsrHw<GfxFamily>(*platformDevices[0]);
auto commandStreamReceiver = new MockCsrHw<GfxFamily>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(commandStreamReceiver);
cl_event blockingEvent;
MockEvent<UserEvent> mockEvent(&ctx);

View File

@ -23,6 +23,7 @@
#include "unit_tests/libult/ult_command_stream_receiver.h"
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/dispatch_info.h"
#include "test.h"
@ -30,7 +31,7 @@
using namespace OCLRT;
struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
MyMockCsr(const HardwareInfo &hwInfoIn, void *ptr) : UltCommandStreamReceiver(hwInfoIn) {
MyMockCsr(const HardwareInfo &hwInfoIn, void *ptr, ExecutionEnvironment &executionEnvironment) : UltCommandStreamReceiver(hwInfoIn, executionEnvironment) {
}
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineOrdinal, ResidencyContainer *allocationsForResidency) override {
@ -92,14 +93,14 @@ struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
template <typename BaseCSR>
struct MyMockCsrWithAubDump : CommandStreamReceiverWithAUBDump<BaseCSR> {
MyMockCsrWithAubDump<BaseCSR>(const HardwareInfo &hwInfoIn, bool createAubCSR) : CommandStreamReceiverWithAUBDump<BaseCSR>(hwInfoIn) {
MyMockCsrWithAubDump<BaseCSR>(const HardwareInfo &hwInfoIn, bool createAubCSR, ExecutionEnvironment &executionEnvironment) : CommandStreamReceiverWithAUBDump<BaseCSR>(hwInfoIn, executionEnvironment) {
if (this->aubCSR != nullptr) {
delete this->aubCSR;
this->aubCSR = nullptr;
}
if (createAubCSR) {
// overwrite with mock
this->aubCSR = new MyMockCsr(hwInfoIn, nullptr);
this->aubCSR = new MyMockCsr(hwInfoIn, nullptr, executionEnvironment);
}
}
@ -111,7 +112,7 @@ struct MyMockCsrWithAubDump : CommandStreamReceiverWithAUBDump<BaseCSR> {
struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParam<bool /*createAubCSR*/> {
void SetUp() override {
createAubCSR = GetParam();
csrWithAubDump = new MyMockCsrWithAubDump<MyMockCsr>(DEFAULT_TEST_PLATFORM::hwInfo, createAubCSR);
csrWithAubDump = new MyMockCsrWithAubDump<MyMockCsr>(DEFAULT_TEST_PLATFORM::hwInfo, createAubCSR, executionEnvironment);
ASSERT_NE(nullptr, csrWithAubDump);
memoryManager = csrWithAubDump->createMemoryManager(false);
@ -122,7 +123,7 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParam<bo
delete csrWithAubDump;
delete memoryManager;
}
ExecutionEnvironment executionEnvironment;
MyMockCsrWithAubDump<MyMockCsr> *csrWithAubDump;
MemoryManager *memoryManager;
bool createAubCSR;

View File

@ -55,7 +55,8 @@ HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetTo
overrideCommandStreamReceiverCreation = true;
DebugManager.flags.SetCommandStreamReceiver.set(csrType);
executionEnvironment.commandStreamReceiver.reset(createCommandStream(&hwInfo));
ExecutionEnvironment executionEnvironment;
executionEnvironment.commandStreamReceiver.reset(createCommandStream(&hwInfo, executionEnvironment));
if (csrType < CommandStreamReceiverType::CSR_TYPES_NUM) {
EXPECT_NE(nullptr, executionEnvironment.commandStreamReceiver.get());
executionEnvironment.memoryManager.reset(executionEnvironment.commandStreamReceiver->createMemoryManager(false));
@ -77,4 +78,4 @@ static CommandStreamReceiverType commandStreamReceiverTypes[] = {
INSTANTIATE_TEST_CASE_P(
CreateCommandStreamReceiverTest_Create,
CreateCommandStreamReceiverTest,
testing::ValuesIn(commandStreamReceiverTypes));
testing::ValuesIn(commandStreamReceiverTypes));

View File

@ -495,7 +495,7 @@ HWTEST_F(SubmissionsAggregatorTests, givenMultipleQueuesWhenCmdBuffersAreRecorde
MockKernelWithInternals kernel(*device.get());
CommandQueueHw<FamilyType> cmdQ1(context.get(), device.get(), 0);
CommandQueueHw<FamilyType> cmdQ2(context.get(), device.get(), 0);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *device->executionEnvironment);
size_t GWS = 1;
overrideCsr(mockCsr);
@ -527,7 +527,7 @@ HWTEST_F(SubmissionsAggregatorTests, givenMultipleQueuesWhenCmdBuffersAreRecorde
HWTEST_F(SubmissionsAggregatorTests, givenCmdQueueWhenCmdBufferWithEventIsRecordedThenAssignFlushStampObjForEveryone) {
MockKernelWithInternals kernel(*device.get());
CommandQueueHw<FamilyType> cmdQ1(context.get(), device.get(), 0);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *device->executionEnvironment);
size_t GWS = 1;
overrideCsr(mockCsr);
@ -553,7 +553,7 @@ HWTEST_F(SubmissionsAggregatorTests, givenMultipleCmdBuffersWhenFlushThenUpdateA
MockKernelWithInternals kernel(*device.get());
CommandQueueHw<FamilyType> cmdQ1(context.get(), device.get(), 0);
CommandQueueHw<FamilyType> cmdQ2(context.get(), device.get(), 0);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *device->executionEnvironment);
size_t GWS = 1;
overrideCsr(mockCsr);
@ -580,7 +580,7 @@ HWTEST_F(SubmissionsAggregatorTests, givenMultipleCmdBuffersWhenNotAggregatedDur
MockKernelWithInternals kernel(*device.get());
CommandQueueHw<FamilyType> cmdQ1(context.get(), device.get(), 0);
CommandQueueHw<FamilyType> cmdQ2(context.get(), device.get(), 0);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *device->executionEnvironment);
size_t GWS = 1;
overrideCsr(mockCsr);

View File

@ -33,7 +33,7 @@ namespace OCLRT {
void TbxCommandStreamFixture::SetUp(MockDevice *pDevice) {
// Create our TBX command stream receiver based on HW type
const auto &hwInfo = pDevice->getHardwareInfo();
pCommandStreamReceiver = TbxCommandStreamReceiver::create(hwInfo, false);
pCommandStreamReceiver = TbxCommandStreamReceiver::create(hwInfo, false, *pDevice->executionEnvironment);
ASSERT_NE(nullptr, pCommandStreamReceiver);
mmTbx = pCommandStreamReceiver->createMemoryManager(false);
pDevice->resetCommandStreamReceiver(pCommandStreamReceiver);

View File

@ -58,7 +58,7 @@ template <typename GfxFamily>
class MockTbxCsr : public TbxCommandStreamReceiverHw<GfxFamily> {
public:
using CommandStreamReceiver::latestFlushedTaskCount;
MockTbxCsr(const HardwareInfo &hwInfoIn, void *ptr) : TbxCommandStreamReceiverHw<GfxFamily>(hwInfoIn, ptr) {}
MockTbxCsr(const HardwareInfo &hwInfoIn, void *ptr, ExecutionEnvironment &executionEnvironment) : TbxCommandStreamReceiverHw<GfxFamily>(hwInfoIn, ptr, executionEnvironment) {}
void makeCoherent(GraphicsAllocation &gfxAllocation) override {
auto tagAddress = reinterpret_cast<uint32_t *>(gfxAllocation.getUnderlyingBuffer());
@ -134,14 +134,6 @@ HWTEST_F(TbxCommandStreamTests, DISABLED_getCsTraits) {
}
#if defined(__linux__)
TEST(TbxCommandStreamReceiverTest, DISABLED_createShouldReturnFunctionPointer) {
TbxCommandStreamReceiver tbx;
const HardwareInfo *hwInfo = platformDevices[0];
CommandStreamReceiver *csr = tbx.create(*hwInfo, false);
EXPECT_NE(nullptr, csr);
delete csr;
}
namespace OCLRT {
TEST(TbxCommandStreamReceiverTest, createShouldReturnNullptrForEmptyEntryInFactory) {
extern TbxCommandStreamReceiverCreateFunc tbxCommandStreamReceiverFactory[IGFX_MAX_PRODUCT];
@ -152,7 +144,8 @@ TEST(TbxCommandStreamReceiverTest, createShouldReturnNullptrForEmptyEntryInFacto
auto pCreate = tbxCommandStreamReceiverFactory[family];
tbxCommandStreamReceiverFactory[family] = nullptr;
CommandStreamReceiver *csr = tbx.create(*hwInfo, false);
ExecutionEnvironment executionEnvironment;
CommandStreamReceiver *csr = tbx.create(*hwInfo, false, executionEnvironment);
EXPECT_EQ(nullptr, csr);
tbxCommandStreamReceiverFactory[family] = pCreate;
@ -165,8 +158,8 @@ TEST(TbxCommandStreamReceiverTest, givenTbxCommandStreamReceiverWhenItIsCreatedW
GFXCORE_FAMILY family = hwInfo.pPlatform->eRenderCoreFamily;
const_cast<PLATFORM *>(hwInfo.pPlatform)->eRenderCoreFamily = GFXCORE_FAMILY_FORCE_ULONG; // wrong gfx core family
CommandStreamReceiver *csr = TbxCommandStreamReceiver::create(hwInfo, false);
ExecutionEnvironment executionEnvironment;
CommandStreamReceiver *csr = TbxCommandStreamReceiver::create(hwInfo, false, executionEnvironment);
EXPECT_EQ(nullptr, csr);
const_cast<PLATFORM *>(hwInfo.pPlatform)->eRenderCoreFamily = family;
@ -174,7 +167,8 @@ TEST(TbxCommandStreamReceiverTest, givenTbxCommandStreamReceiverWhenItIsCreatedW
TEST(TbxCommandStreamReceiverTest, givenTbxCommandStreamReceiverWhenTypeIsCheckedThenTbxCsrIsReturned) {
HardwareInfo hwInfo = *platformDevices[0];
std::unique_ptr<CommandStreamReceiver> csr(TbxCommandStreamReceiver::create(hwInfo, false));
ExecutionEnvironment executionEnvironment;
std::unique_ptr<CommandStreamReceiver> csr(TbxCommandStreamReceiver::create(hwInfo, false, executionEnvironment));
EXPECT_NE(nullptr, csr);
EXPECT_EQ(CommandStreamReceiverType::CSR_TBX, csr->getType());
}
@ -317,13 +311,14 @@ HWTEST_F(TbxCommandStreamTests, givenDbgDeviceIdFlagIsSetWhenTbxCsrIsCreatedThen
DebugManagerStateRestore stateRestore;
DebugManager.flags.OverrideAubDeviceId.set(9); //this is Hsw, not used
const HardwareInfo &hwInfoIn = *platformDevices[0];
std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>> tbxCsr(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(TbxCommandStreamReceiver::create(hwInfoIn, false)));
ExecutionEnvironment executionEnvironment;
std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>> tbxCsr(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(TbxCommandStreamReceiver::create(hwInfoIn, false, executionEnvironment)));
EXPECT_EQ(9u, tbxCsr->aubDeviceId);
}
HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenWaitBeforeMakeNonResidentWhenRequiredIsCalledWithBlockingFlagTrueThenFunctionStallsUntilMakeCoherentUpdatesTagAddress) {
uint32_t tag = 0;
MockTbxCsr<FamilyType> tbxCsr(*platformDevices[0], &tag);
MockTbxCsr<FamilyType> tbxCsr(*platformDevices[0], &tag, *pDevice->executionEnvironment);
GraphicsAllocation graphicsAllocation(&tag, sizeof(tag));
tbxCsr.setTagAllocation(&graphicsAllocation);

View File

@ -893,7 +893,7 @@ HWTEST_F(InternalsEventTest, GivenBufferWithoutZeroCopyOnCommandMapOrUnmapFlushe
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props);
MockNonZeroCopyBuff buffer(executionStamp);
MockCsr<FamilyType> csr(executionStamp);
MockCsr<FamilyType> csr(executionStamp, *pDevice->executionEnvironment);
csr.setMemoryManager(pDevice->getMemoryManager());
csr.setTagAllocation(pDevice->getTagAllocation());
@ -1363,7 +1363,7 @@ TEST_F(EventTest, addChildForEventCompleted) {
HWTEST_F(EventTest, givenQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestToWaitingFunction) {
struct MyCsr : public UltCommandStreamReceiver<FamilyType> {
MyCsr(const HardwareInfo &hwInfo) : UltCommandStreamReceiver<FamilyType>(hwInfo) {}
MyCsr(const HardwareInfo &hwInfo, const ExecutionEnvironment &executionEnvironment) : UltCommandStreamReceiver<FamilyType>(hwInfo, const_cast<ExecutionEnvironment &>(executionEnvironment)) {}
MOCK_METHOD3(waitForCompletionWithTimeout, bool(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
};
HardwareInfo localHwInfo = pDevice->getHardwareInfo();
@ -1372,7 +1372,7 @@ HWTEST_F(EventTest, givenQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestToWa
localHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds = 1;
localHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds = 2;
auto csr = new ::testing::NiceMock<MyCsr>(localHwInfo);
auto csr = new ::testing::NiceMock<MyCsr>(localHwInfo, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(csr);
Event event(pCmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
@ -1387,7 +1387,7 @@ HWTEST_F(EventTest, givenQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestToWa
HWTEST_F(EventTest, givenNonQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestToWaitingFunction) {
struct MyCsr : public UltCommandStreamReceiver<FamilyType> {
MyCsr(const HardwareInfo &hwInfo) : UltCommandStreamReceiver<FamilyType>(hwInfo) {}
MyCsr(const HardwareInfo &hwInfo, const ExecutionEnvironment &executionEnvironment) : UltCommandStreamReceiver<FamilyType>(hwInfo, const_cast<ExecutionEnvironment &>(executionEnvironment)) {}
MOCK_METHOD3(waitForCompletionWithTimeout, bool(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
};
HardwareInfo localHwInfo = pDevice->getHardwareInfo();
@ -1396,7 +1396,7 @@ HWTEST_F(EventTest, givenNonQuickKmdSleepRequestWhenWaitIsCalledThenPassRequestT
localHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds = 1;
localHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds = 2;
auto csr = new ::testing::NiceMock<MyCsr>(localHwInfo);
auto csr = new ::testing::NiceMock<MyCsr>(localHwInfo, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(csr);
Event event(pCmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);

View File

@ -122,7 +122,7 @@ HWTEST_P(ParentKernelEnqueueTest, GivenParentKernelWithPrivateSurfaceWhenEnqueue
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
int32_t executionStamp = 0;
auto mockCSR = new MockCsr<FamilyType>(executionStamp);
auto mockCSR = new MockCsr<FamilyType>(executionStamp, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCSR);
GraphicsAllocation *privateSurface = mockCSR->getMemoryManager()->allocateGraphicsMemory(10);
@ -367,7 +367,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenNonBlockedQueueWhenPar
MockMultiDispatchInfo multiDispatchInfo(pKernel);
int32_t executionStamp = 0;
auto mockCSR = new MockCsrBase<FamilyType>(executionStamp);
auto mockCSR = new MockCsrBase<FamilyType>(executionStamp, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCSR);
pCmdQ->enqueueKernel(pKernel, 1, globalOffsets, workItems, workItems, 0, nullptr, nullptr);
@ -522,7 +522,7 @@ HWTEST_F(ParentKernelEnqueueFixture, ParentKernelEnqueuedToNonBlockedQueueFlushe
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
int32_t execStamp;
auto mockCsr = new MockCsr<FamilyType>(execStamp);
auto mockCsr = new MockCsr<FamilyType>(execStamp, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
pCmdQ->enqueueKernel(parentKernel, 1, offset, gws, gws, 0, nullptr, nullptr);
@ -546,7 +546,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelEnqueueFixture, ParentKernelEnqueuedWith
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
int32_t execStamp;
auto mockCsr = new MockCsr<FamilyType>(execStamp);
auto mockCsr = new MockCsr<FamilyType>(execStamp, *pDevice->executionEnvironment);
BuiltinKernelsSimulation::SchedulerSimulation<FamilyType>::enabled = false;
@ -563,7 +563,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelEnqueueFixture, ParentKernelEnqueuedWith
HWTEST_F(ParentKernelEnqueueFixture, givenCsrInBatchingModeWhenExecutionModelKernelIsSubmittedThenItIsFlushed) {
if (pDevice->getSupportedClVersion() >= 20) {
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
pDevice->resetCommandStreamReceiver(mockCsr);
@ -589,7 +589,7 @@ HWTEST_F(ParentKernelEnqueueFixture, ParentKernelEnqueueMarksCSRMediaVFEStateDir
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
int32_t execStamp;
auto mockCsr = new MockCsr<FamilyType>(execStamp);
auto mockCsr = new MockCsr<FamilyType>(execStamp, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideMediaVFEStateDirty(false);

View File

@ -37,5 +37,6 @@ struct DeviceFixture {
volatile uint32_t *pTagMemory = nullptr;
HardwareInfo hwInfoHelper = {};
PLATFORM platformHelper = {};
ExecutionEnvironment executionEnvironment;
};
} // namespace OCLRT
} // namespace OCLRT

View File

@ -34,8 +34,8 @@ void MemoryManagerWithCsrFixture::SetUp() {
ON_CALL(*gmockMemoryManager, cleanAllocationList(::testing::_, ::testing::_)).WillByDefault(::testing::Invoke(gmockMemoryManager, &GMockMemoryManager::MemoryManagerCleanAllocationList));
ON_CALL(*gmockMemoryManager, populateOsHandles(::testing::_)).WillByDefault(::testing::Invoke(gmockMemoryManager, &GMockMemoryManager::MemoryManagerPopulateOsHandles));
csr.tagAddress = &currentGpuTag;
memoryManager->csr = &csr;
csr->tagAddress = &currentGpuTag;
memoryManager->csr = csr.get();
}
void MemoryManagerWithCsrFixture::TearDown() {

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
* copy of this software and associated documentation files (the "Software"),
@ -34,11 +34,13 @@ class MemoryManagerWithCsrFixture {
public:
MemoryManager *memoryManager;
GMockMemoryManager *gmockMemoryManager;
MockCommandStreamReceiver csr;
ExecutionEnvironment executionEnvironment;
std::unique_ptr<MockCommandStreamReceiver> csr;
uint32_t taskCount = 0;
uint32_t currentGpuTag = initialHardwareTag;
MemoryManagerWithCsrFixture() {
csr = std::make_unique<MockCommandStreamReceiver>(this->executionEnvironment);
}
~MemoryManagerWithCsrFixture() = default;

View File

@ -34,7 +34,7 @@ struct Gen10CoherencyRequirements : public ::testing::Test {
struct myCsr : public CommandStreamReceiverHw<CNLFamily> {
using CommandStreamReceiver::commandStream;
myCsr() : CommandStreamReceiverHw<CNLFamily>(*platformDevices[0]){};
myCsr(ExecutionEnvironment &executionEnvironment) : CommandStreamReceiverHw<CNLFamily>(*platformDevices[0], executionEnvironment){};
CsrSizeRequestFlags *getCsrRequestFlags() { return &csrSizeRequestFlags; }
};
@ -44,8 +44,8 @@ struct Gen10CoherencyRequirements : public ::testing::Test {
}
void SetUp() override {
csr = new myCsr();
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
csr = new myCsr(*device->executionEnvironment);
device->resetCommandStreamReceiver(csr);
}

View File

@ -153,7 +153,7 @@ GEN10TEST_F(Gen10PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenE
WhitelistedRegisters regs = {};
regs.csChicken1_0x2580 = true;
pDevice->setForceWhitelistedRegs(true, &regs);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
@ -172,7 +172,7 @@ GEN10TEST_F(Gen10PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenE
WhitelistedRegisters regs = {};
regs.csChicken1_0x2580 = true;
pDevice->setForceWhitelistedRegs(true, &regs);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
@ -247,7 +247,7 @@ GEN10TEST_F(Gen10PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueue
pDevice->setPreemptionMode(PreemptionMode::Disabled);
WhitelistedRegisters regs = {};
pDevice->setForceWhitelistedRegs(true, &regs);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);

View File

@ -21,6 +21,7 @@
*/
#include "runtime/command_stream/command_stream_receiver_hw.h"
#include "runtime/execution_environment/execution_environment.h"
#include "test.h"
using namespace OCLRT;
@ -28,7 +29,8 @@ using namespace OCLRT;
typedef ::testing::Test Gen8CoherencyRequirements;
GEN8TEST_F(Gen8CoherencyRequirements, noCoherencyProgramming) {
CommandStreamReceiverHw<BDWFamily> csr(*platformDevices[0]);
ExecutionEnvironment executionEnvironment;
CommandStreamReceiverHw<BDWFamily> csr(*platformDevices[0], executionEnvironment);
LinearStream stream;
DispatchFlags flags = {};

View File

@ -51,7 +51,7 @@ GEN8TEST_F(CommandStreamReceiverHwTestGen8, GivenBlockedKernelWithSlmWhenPreviou
}
GEN8TEST_F(CommandStreamReceiverHwTestGen8, GivenChangedL3ConfigWhenL3IsProgrammedThenClearSLMWorkAroundIsAdded) {
MockCsrHw2<FamilyType> csr(pDevice->getHardwareInfo());
MockCsrHw2<FamilyType> csr(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
csr.csrSizeRequestFlags.l3ConfigChanged = true;
csr.isPreambleSent = true;

View File

@ -83,7 +83,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSamePreempt
GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnqueueKernelCalledThenPassDevicePreemptionMode) {
pDevice->setPreemptionMode(PreemptionMode::ThreadGroup);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
@ -99,7 +99,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq
GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnqueueKernelCalledAndBlockedThenPassDevicePreemptionMode) {
pDevice->setPreemptionMode(PreemptionMode::ThreadGroup);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
@ -120,7 +120,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq
GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKernelCalledThenPassDisabledPreemptionMode) {
pDevice->setPreemptionMode(PreemptionMode::Disabled);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);

View File

@ -21,6 +21,7 @@
*/
#include "runtime/command_stream/command_stream_receiver_hw.h"
#include "runtime/execution_environment/execution_environment.h"
#include "test.h"
using namespace OCLRT;
@ -28,7 +29,8 @@ using namespace OCLRT;
typedef ::testing::Test Gen9CoherencyRequirements;
GEN9TEST_F(Gen9CoherencyRequirements, noCoherencyProgramming) {
CommandStreamReceiverHw<SKLFamily> csr(*platformDevices[0]);
ExecutionEnvironment executionEnvironment;
CommandStreamReceiverHw<SKLFamily> csr(*platformDevices[0], executionEnvironment);
LinearStream stream;
DispatchFlags flags = {};

View File

@ -234,7 +234,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq
WhitelistedRegisters regs = {};
regs.csChicken1_0x2580 = true;
pDevice->setForceWhitelistedRegs(true, &regs);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
@ -253,7 +253,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq
WhitelistedRegisters regs = {};
regs.csChicken1_0x2580 = true;
pDevice->setForceWhitelistedRegs(true, &regs);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
@ -460,7 +460,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKe
pDevice->setPreemptionMode(PreemptionMode::Disabled);
WhitelistedRegisters regs = {};
pDevice->setForceWhitelistedRegs(true, &regs);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo(), *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);

View File

@ -82,14 +82,14 @@ struct KmdNotifyTests : public ::testing::Test {
template <typename Family>
class MockKmdNotifyCsr : public UltCommandStreamReceiver<Family> {
public:
MockKmdNotifyCsr(const HardwareInfo &hwInfo) : UltCommandStreamReceiver<Family>(hwInfo) {}
MockKmdNotifyCsr(const HardwareInfo &hwInfo, const ExecutionEnvironment &executionEnvironment) : UltCommandStreamReceiver<Family>(hwInfo, const_cast<ExecutionEnvironment &>(executionEnvironment)) {}
MOCK_METHOD1(waitForFlushStamp, bool(FlushStamp &flushStampToWait));
MOCK_METHOD3(waitForCompletionWithTimeout, bool(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
};
template <typename Family>
MockKmdNotifyCsr<Family> *createMockCsr() {
auto csr = new ::testing::NiceMock<MockKmdNotifyCsr<Family>>(device->getHardwareInfo());
auto csr = new ::testing::NiceMock<MockKmdNotifyCsr<Family>>(device->getHardwareInfo(), *device->executionEnvironment);
device->resetCommandStreamReceiver(csr);
mockKmdNotifyHelper = new MockKmdNotifyHelper(&device->getHardwareInfo().capabilityTable.kmdNotifyProperties);

View File

@ -206,7 +206,7 @@ HWTEST_F(KernelImageArgTest, givenImgWithMcsAllocWhenMakeResidentThenMakeMcsAllo
pKernel->setArg(0, sizeof(memObj), &memObj);
std::unique_ptr<OsAgnosticMemoryManager> memoryManager(new OsAgnosticMemoryManager());
std::unique_ptr<MockCsr<FamilyType>> csr(new MockCsr<FamilyType>(execStamp));
std::unique_ptr<MockCsr<FamilyType>> csr(new MockCsr<FamilyType>(execStamp, *pDevice->executionEnvironment));
csr->setMemoryManager(memoryManager.get());
pKernel->makeResident(*csr.get());

View File

@ -422,7 +422,8 @@ class CommandStreamReceiverMock : public CommandStreamReceiver {
typedef CommandStreamReceiver BaseClass;
public:
CommandStreamReceiverMock() : BaseClass() {
CommandStreamReceiverMock() : BaseClass(*(new ExecutionEnvironment)) {
this->mockExecutionEnvironment.reset(&this->executionEnvironment);
}
void makeResident(GraphicsAllocation &graphicsAllocation) override {
@ -465,6 +466,7 @@ class CommandStreamReceiverMock : public CommandStreamReceiver {
}
std::map<const void *, size_t> residency;
std::unique_ptr<ExecutionEnvironment> mockExecutionEnvironment;
};
TEST_F(KernelPrivateSurfaceTest, testPrivateSurface) {

View File

@ -36,7 +36,7 @@ bool getDevicesResult = true;
bool overrideCommandStreamReceiverCreation = false;
bool overrideDeviceWithDefaultHardwareInfo = true;
CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo) {
CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo, ExecutionEnvironment &executionEnvironment) {
CommandStreamReceiver *commandStreamReceiver = nullptr;
assert(nullptr != pHwInfo->pPlatform);
auto offset = !overrideCommandStreamReceiverCreation ? IGFX_MAX_CORE : 0;
@ -44,10 +44,10 @@ CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo) {
if (offset != 0) {
auto funcCreate = commandStreamReceiverFactory[offset + pHwInfo->pPlatform->eRenderCoreFamily];
if (funcCreate) {
commandStreamReceiver = funcCreate(*pHwInfo, false);
commandStreamReceiver = funcCreate(*pHwInfo, false, executionEnvironment);
}
} else {
commandStreamReceiver = createCommandStreamImpl(pHwInfo);
commandStreamReceiver = createCommandStreamImpl(pHwInfo, executionEnvironment);
}
return commandStreamReceiver;
}

View File

@ -26,6 +26,6 @@ namespace OCLRT {
extern bool overrideCommandStreamReceiverCreation;
extern bool overrideDeviceWithDefaultHardwareInfo;
extern CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo);
extern CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo, ExecutionEnvironment &executionEnvironment);
extern bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment);
} // namespace OCLRT

View File

@ -42,6 +42,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
using BaseClass::CommandStreamReceiver::commandStream;
using BaseClass::CommandStreamReceiver::disableL3Cache;
using BaseClass::CommandStreamReceiver::dispatchMode;
using BaseClass::CommandStreamReceiver::executionEnvironment;
using BaseClass::CommandStreamReceiver::experimentalCmdBuffer;
using BaseClass::CommandStreamReceiver::flushStamp;
using BaseClass::CommandStreamReceiver::isPreambleSent;
@ -60,11 +61,11 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
UltCommandStreamReceiver(const UltCommandStreamReceiver &) = delete;
UltCommandStreamReceiver &operator=(const UltCommandStreamReceiver &) = delete;
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, bool withAubDump) {
return new UltCommandStreamReceiver<GfxFamily>(hwInfoIn);
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
return new UltCommandStreamReceiver<GfxFamily>(hwInfoIn, executionEnvironment);
}
UltCommandStreamReceiver(const HardwareInfo &hwInfoIn) : BaseClass(hwInfoIn) {
UltCommandStreamReceiver(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment) : BaseClass(hwInfoIn, executionEnvironment) {
this->storeMakeResidentAllocations = false;
if (hwInfoIn.capabilityTable.defaultPreemptionMode == PreemptionMode::MidThread) {
tempPreemptionLocation = new GraphicsAllocation(nullptr, 0);

View File

@ -32,7 +32,7 @@ using namespace OCLRT;
template <typename Family>
class MyCsr : public UltCommandStreamReceiver<Family> {
public:
MyCsr(const HardwareInfo &hwInfo) : UltCommandStreamReceiver<Family>(hwInfo) {}
MyCsr(const HardwareInfo &hwInfo, const ExecutionEnvironment &executionEnvironment) : UltCommandStreamReceiver<Family>(hwInfo, const_cast<ExecutionEnvironment &>(executionEnvironment)) {}
MOCK_METHOD1(waitForFlushStamp, bool(FlushStamp &flushStampToWait));
MOCK_METHOD3(waitForCompletionWithTimeout, bool(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
};
@ -138,7 +138,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
memObj->setDestructorCallback(emptyDestructorCallback, nullptr);
}
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo(), *device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
bool desired = true;
@ -168,7 +168,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
memObj->setAllocatedMapPtr(allocatedPtr);
}
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo(), *device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
bool desired = true;
@ -209,7 +209,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
}
makeMemObjUsed();
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo(), *device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
bool desired = true;
@ -242,7 +242,7 @@ HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithDestructableAllocationWhenAsy
} else {
makeMemObjNotReady();
}
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo(), *device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
bool desired = true;
@ -267,7 +267,7 @@ HWTEST_P(MemObjSyncDestructionTest, givenMemObjWithDestructableAllocationWhenAsy
} else {
makeMemObjNotReady();
}
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo(), *device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
bool desired = true;

View File

@ -1386,7 +1386,7 @@ TEST_F(MemoryManagerWithCsrTest, GivenAllocationsInHostPtrManagerReadyForCleanin
// All fragments ready for release
taskCount = taskCountReady;
csr.latestSentTaskCount = taskCountReady;
csr->latestSentTaskCount = taskCountReady;
auto graphicsAllocation3 = memoryManager->allocateGraphicsMemory(MemoryConstants::pageSize * 10, cpuPtr3);
@ -1474,7 +1474,7 @@ TEST_F(MemoryManagerWithCsrTest, checkAllocationsForOverlappingWithBiggerOverlap
// All fragments ready for release
taskCount = taskCountReady;
csr.latestSentTaskCount = taskCountReady;
csr->latestSentTaskCount = taskCountReady;
AllocationRequirements requirements;
CheckedFragments checkedFragments;
@ -1518,7 +1518,7 @@ TEST_F(MemoryManagerWithCsrTest, checkAllocationsForOverlappingWithBiggerOverlap
// All fragments ready for release
currentGpuTag = 1;
csr.latestSentTaskCount = taskCountReady - 1;
csr->latestSentTaskCount = taskCountReady - 1;
AllocationRequirements requirements;
CheckedFragments checkedFragments;
@ -1574,7 +1574,7 @@ TEST_F(MemoryManagerWithCsrTest, checkAllocationsForOverlappingWithBiggerOverlap
// All fragments ready for release
currentGpuTag = taskCountReady - 1;
csr.latestSentTaskCount = taskCountReady - 1;
csr->latestSentTaskCount = taskCountReady - 1;
AllocationRequirements requirements;
CheckedFragments checkedFragments;

View File

@ -71,7 +71,8 @@ TYPED_TEST_CASE(SurfaceTest, SurfaceTypes);
HWTEST_TYPED_TEST(SurfaceTest, GivenSurfaceWhenInterfaceIsUsedThenSurfaceBehavesCorrectly) {
int32_t execStamp;
MockCsr<FamilyType> *csr = new MockCsr<FamilyType>(execStamp);
ExecutionEnvironment executionEnvironment;
MockCsr<FamilyType> *csr = new MockCsr<FamilyType>(execStamp, executionEnvironment);
auto memManager = csr->createMemoryManager(false);

View File

@ -23,6 +23,7 @@
#pragma once
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/command_stream/command_stream_receiver_hw.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/flat_batch_buffer_helper_hw.h"
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/helpers/options.h"
@ -46,11 +47,11 @@ class MockCsrBase : public UltCommandStreamReceiver<GfxFamily> {
MockCsrBase() = delete;
MockCsrBase(int32_t &execStamp)
: BaseUltCsrClass(*platformDevices[0]), executionStamp(&execStamp), flushTaskStamp(-1) {
MockCsrBase(int32_t &execStamp, ExecutionEnvironment &executionEnvironment)
: BaseUltCsrClass(*platformDevices[0], executionEnvironment), executionStamp(&execStamp), flushTaskStamp(-1) {
}
MockCsrBase(const HardwareInfo &hwInfoIn) : BaseUltCsrClass(hwInfoIn) {
MockCsrBase(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment) : BaseUltCsrClass(hwInfoIn, executionEnvironment) {
}
void makeResident(GraphicsAllocation &gfxAllocation) override {
@ -108,7 +109,7 @@ class MockCsr : public MockCsrBase<GfxFamily> {
MockCsr() = delete;
MockCsr(const HardwareInfo &hwInfoIn) = delete;
MockCsr(int32_t &execStamp) : BaseClass(execStamp) {
MockCsr(int32_t &execStamp, ExecutionEnvironment &executionEnvironment) : BaseClass(execStamp, executionEnvironment) {
}
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) override {
@ -161,7 +162,7 @@ class MockCsrHw2 : public CommandStreamReceiverHw<GfxFamily> {
using CommandStreamReceiver::taskCount;
using CommandStreamReceiver::taskLevel;
MockCsrHw2(const HardwareInfo &hwInfoIn) : CommandStreamReceiverHw<GfxFamily>(hwInfoIn) {}
MockCsrHw2(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment) : CommandStreamReceiverHw<GfxFamily>(hwInfoIn, executionEnvironment) {}
SubmissionAggregator *peekSubmissionAggregator() {
return this->submissionAggregator.get();
@ -219,12 +220,19 @@ class MockFlatBatchBufferHelper : public FlatBatchBufferHelperHw<GfxFamily> {
class MockCommandStreamReceiver : public CommandStreamReceiver {
public:
using CommandStreamReceiver::CommandStreamReceiver;
using CommandStreamReceiver::latestFlushedTaskCount;
using CommandStreamReceiver::latestSentTaskCount;
using CommandStreamReceiver::tagAddress;
std::vector<char> instructionHeapReserveredData;
int *flushBatchedSubmissionsCallCounter = nullptr;
std::unique_ptr<ExecutionEnvironment> mockExecutionEnvironment;
MockCommandStreamReceiver() : CommandStreamReceiver(*(new ExecutionEnvironment)) {
mockExecutionEnvironment.reset(&this->executionEnvironment);
}
~MockCommandStreamReceiver() {
}

View File

@ -32,7 +32,7 @@ using namespace OCLRT;
MockDevice::MockDevice(const HardwareInfo &hwInfo)
: MockDevice(hwInfo, new ExecutionEnvironment) {
CommandStreamReceiver *commandStreamReceiver = createCommandStream(&hwInfo);
CommandStreamReceiver *commandStreamReceiver = createCommandStream(&hwInfo, *this->executionEnvironment);
executionEnvironment->commandStreamReceiver.reset(commandStreamReceiver);
commandStreamReceiver->setMemoryManager(this->mockMemoryManager.get());
this->executionEnvironment->memoryManager = std::move(this->mockMemoryManager);

View File

@ -34,7 +34,7 @@ class OSTime;
class MemoryManager;
class MockMemoryManager;
extern CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo);
extern CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo, ExecutionEnvironment &executionEnvironment);
class MockDevice : public Device {
public:

View File

@ -39,19 +39,19 @@ using namespace OCLRT;
typedef Test<DeviceFixture> DeviceCommandStreamLeaksTest;
HWTEST_F(DeviceCommandStreamLeaksTest, Create) {
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false));
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false, this->executionEnvironment));
DrmMockSuccess mockDrm;
EXPECT_NE(nullptr, ptr);
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false));
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false, this->executionEnvironment));
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerActive);
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWithAubDumWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], true));
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], true, this->executionEnvironment));
auto drmCsrWithAubDump = (CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *)ptr.get();
EXPECT_EQ(drmCsrWithAubDump->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerActive);
auto aubCSR = static_cast<CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *>(ptr.get())->aubCSR;

View File

@ -20,6 +20,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/os_interface/linux/drm_command_stream.h"
#include "runtime/os_interface/linux/drm_memory_manager.h"
#include "unit_tests/helpers/debug_manager_state_restore.h"
@ -34,12 +35,13 @@ class DrmCommandStreamMMTest : public ::testing::Test {
HWTEST_F(DrmCommandStreamMMTest, MMwithPinBB) {
DebugManagerStateRestore dbgRestorer;
{
ExecutionEnvironment executionEnvironment;
DebugManager.flags.EnableForcePin.set(true);
std::unique_ptr<DrmMockCustom> mock(new DrmMockCustom());
ASSERT_NE(nullptr, mock);
DrmCommandStreamReceiver<FamilyType> csr(*platformDevices[0], mock.get(), gemCloseWorkerMode::gemCloseWorkerInactive);
DrmCommandStreamReceiver<FamilyType> csr(*platformDevices[0], mock.get(), executionEnvironment, gemCloseWorkerMode::gemCloseWorkerInactive);
auto mm = (DrmMemoryManager *)csr.createMemoryManager(false);
ASSERT_NE(nullptr, mm);
@ -53,12 +55,13 @@ HWTEST_F(DrmCommandStreamMMTest, MMwithPinBB) {
HWTEST_F(DrmCommandStreamMMTest, givenForcePinDisabledWhenMemoryManagerIsCreatedThenPinBBIsCreated) {
DebugManagerStateRestore dbgRestorer;
{
ExecutionEnvironment executionEnvironment;
DebugManager.flags.EnableForcePin.set(false);
std::unique_ptr<DrmMockCustom> mock(new DrmMockCustom());
ASSERT_NE(nullptr, mock);
DrmCommandStreamReceiver<FamilyType> csr(*platformDevices[0], mock.get(), gemCloseWorkerMode::gemCloseWorkerInactive);
DrmCommandStreamReceiver<FamilyType> csr(*platformDevices[0], mock.get(), executionEnvironment, gemCloseWorkerMode::gemCloseWorkerInactive);
auto mm = (DrmMemoryManager *)csr.createMemoryManager(false);
csr.setMemoryManager(nullptr);

View File

@ -63,7 +63,7 @@ class DrmCommandStreamFixture {
this->mock = new DrmMockImpl(mockFd);
csr = new DrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], mock, gemCloseWorkerMode::gemCloseWorkerActive);
csr = new DrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], mock, executionEnvironment, gemCloseWorkerMode::gemCloseWorkerActive);
ASSERT_NE(nullptr, csr);
// Memory manager creates pinBB with ioctl, expect one call
@ -91,6 +91,7 @@ class DrmCommandStreamFixture {
}
static const uint64_t alignment = MemoryConstants::allocationAlignment;
DebugManagerStateRestore *dbgState;
ExecutionEnvironment executionEnvironment;
};
typedef Test<DrmCommandStreamFixture> DrmCommandStreamTest;
@ -508,7 +509,7 @@ struct DrmCsrVfeTests : ::testing::Test {
using DrmCommandStreamReceiver<FamilyType>::mediaVfeStateLowPriorityDirty;
using CommandStreamReceiver::commandStream;
MyCsr() : DrmCommandStreamReceiver<FamilyType>(*platformDevices[0], nullptr, gemCloseWorkerMode::gemCloseWorkerInactive) {}
MyCsr(ExecutionEnvironment &executionEnvironment) : DrmCommandStreamReceiver<FamilyType>(*platformDevices[0], nullptr, executionEnvironment, gemCloseWorkerMode::gemCloseWorkerInactive) {}
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) override {
return (FlushStamp)0;
}
@ -532,7 +533,7 @@ struct DrmCsrVfeTests : ::testing::Test {
HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForDefaultContextWhenLowPriorityIsFlushedThenReprogram) {
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>;
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
@ -560,7 +561,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForDefaultContextWhe
HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContextWhenDefaultPriorityIsFlushedThenReprogram) {
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>;
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
@ -588,7 +589,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContex
HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContextWhenLowPriorityIsFlushedThenDontReprogram) {
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>;
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
@ -616,7 +617,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContex
HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedLowWithScratchRequirementThenMakeDefaultDirty) {
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>;
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
@ -637,7 +638,7 @@ HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedLowWit
HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedDefaultWithScratchRequirementThenMakeLowDirty) {
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto mockCsr = new MyCsr<FamilyType>;
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);
@ -668,16 +669,17 @@ class DrmCommandStreamEnhancedFixture
DrmMemoryManager *mm = nullptr;
MockDevice *device = nullptr;
DebugManagerStateRestore *dbgState;
ExecutionEnvironment *executionEnvironment;
void SetUp() {
ExecutionEnvironment *executionEnvironment = new ExecutionEnvironment;
executionEnvironment = new ExecutionEnvironment;
executionEnvironment->initGmm(*platformDevices);
this->dbgState = new DebugManagerStateRestore();
//make sure this is disabled, we don't want test this now
DebugManager.flags.EnableForcePin.set(false);
mock = new DrmMockCustom();
tCsr = new TestedDrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(mock);
tCsr = new TestedDrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(mock, *executionEnvironment);
csr = tCsr;
ASSERT_NE(nullptr, csr);
mm = reinterpret_cast<DrmMemoryManager *>(csr->createMemoryManager(false));
@ -710,9 +712,9 @@ class DrmCommandStreamEnhancedFixture
public:
using CommandStreamReceiver::commandStream;
TestedDrmCommandStreamReceiver(Drm *drm, gemCloseWorkerMode mode) : DrmCommandStreamReceiver<GfxFamily>(*platformDevices[0], drm, mode) {
TestedDrmCommandStreamReceiver(Drm *drm, gemCloseWorkerMode mode, ExecutionEnvironment &executionEnvironment) : DrmCommandStreamReceiver<GfxFamily>(*platformDevices[0], drm, executionEnvironment, mode) {
}
TestedDrmCommandStreamReceiver(Drm *drm) : DrmCommandStreamReceiver<GfxFamily>(*platformDevices[0], drm, gemCloseWorkerMode::gemCloseWorkerInactive) {
TestedDrmCommandStreamReceiver(Drm *drm, ExecutionEnvironment &executionEnvironment) : DrmCommandStreamReceiver<GfxFamily>(*platformDevices[0], drm, executionEnvironment, gemCloseWorkerMode::gemCloseWorkerInactive) {
}
void overrideGemCloseWorkerOperationMode(gemCloseWorkerMode overrideValue) {
@ -923,7 +925,7 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenCommandStreamWithDuplicatesWhenItIsF
}
TEST_F(DrmCommandStreamGemWorkerTests, givenDrmCsrCreatedWithInactiveGemCloseWorkerPolicyThenThreadIsNotCreated) {
TestedDrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> testedCsr(mock, gemCloseWorkerMode::gemCloseWorkerInactive);
TestedDrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> testedCsr(mock, gemCloseWorkerMode::gemCloseWorkerInactive, *this->executionEnvironment);
EXPECT_EQ(gemCloseWorkerMode::gemCloseWorkerInactive, testedCsr.peekGemCloseWorkerOperationMode());
}

View File

@ -72,7 +72,7 @@ class WddmCommandStreamFixture {
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::ImmediateDispatch));
csr.reset(new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], wddm));
csr.reset(new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], wddm, *device->executionEnvironment));
ASSERT_NE(nullptr, csr);
mockWddmMM = new MockWddmMemoryManager(wddm);
@ -92,7 +92,7 @@ class WddmCommandStreamFixture {
template <typename GfxFamily>
struct MockWddmCsr : public WddmCommandStreamReceiver<GfxFamily> {
MockWddmCsr(const HardwareInfo &hwInfoIn, Wddm *wddm) : WddmCommandStreamReceiver(hwInfoIn, wddm){};
MockWddmCsr(const HardwareInfo &hwInfoIn, Wddm *wddm, ExecutionEnvironment &executionEnvironment) : WddmCommandStreamReceiver(hwInfoIn, wddm, executionEnvironment){};
using CommandStreamReceiver::commandStream;
using CommandStreamReceiver::dispatchMode;
using CommandStreamReceiver::getCS;
@ -133,7 +133,7 @@ class WddmCommandStreamWithMockGdiFixture {
wddm->gdi.reset(gdi);
ASSERT_NE(wddm, nullptr);
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::ImmediateDispatch));
csr = new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], wddm);
csr = new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], wddm, *executionEnvironment);
ASSERT_NE(nullptr, csr);
memManager = csr->createMemoryManager(false);
@ -162,14 +162,14 @@ using WddmDefaultTest = ::Test<WddmCommandStreamFixture>;
using DeviceCommandStreamTest = ::Test<GmmEnvironmentFixture>;
TEST_F(DeviceCommandStreamTest, CreateWddmCSR) {
std::unique_ptr<DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>> csr(static_cast<DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>::create(DEFAULT_TEST_PLATFORM::hwInfo, false)));
std::unique_ptr<DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>> csr(static_cast<DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>::create(DEFAULT_TEST_PLATFORM::hwInfo, false, this->executionEnvironment)));
EXPECT_NE(nullptr, csr);
std::unique_ptr<Wddm> wddm(static_cast<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(csr.get())->peekWddm());
EXPECT_NE(nullptr, wddm);
}
TEST_F(DeviceCommandStreamTest, CreateWddmCSRWithAubDump) {
std::unique_ptr<DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>> csr(static_cast<DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>::create(DEFAULT_TEST_PLATFORM::hwInfo, true)));
std::unique_ptr<DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>> csr(static_cast<DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>::create(DEFAULT_TEST_PLATFORM::hwInfo, true, this->executionEnvironment)));
EXPECT_NE(nullptr, csr);
std::unique_ptr<Wddm> wddm(static_cast<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(csr.get())->peekWddm());
EXPECT_NE(nullptr, wddm);
@ -248,7 +248,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf
auto localHwInfo = *platformDevices[0];
localHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
ExecutionEnvironment executionEnvironment;
executionEnvironment.commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(localHwInfo, wddm);
executionEnvironment.commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(localHwInfo, wddm, executionEnvironment);
executionEnvironment.memoryManager.reset(executionEnvironment.commandStreamReceiver->createMemoryManager(false));
executionEnvironment.commandStreamReceiver->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
@ -270,7 +270,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn
auto localHwInfo = *platformDevices[0];
localHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
ExecutionEnvironment executionEnvironment;
executionEnvironment.commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(localHwInfo, wddm);
executionEnvironment.commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(localHwInfo, wddm, executionEnvironment);
executionEnvironment.memoryManager.reset(executionEnvironment.commandStreamReceiver->createMemoryManager(false));
executionEnvironment.commandStreamReceiver->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
@ -290,7 +290,8 @@ TEST(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStream
std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
auto localHwInfo = *platformDevices[0];
localHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(localHwInfo, wddm.get());
ExecutionEnvironment executionEnvironment;
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(localHwInfo, wddm.get(), executionEnvironment);
auto commandHeader = commandStreamReceiver->commandBufferHeader;
auto header = reinterpret_cast<COMMAND_BUFFER_HEADER *>(commandHeader);
EXPECT_TRUE(header->NeedsMidBatchPreEmptionSupport);
@ -300,7 +301,8 @@ TEST(WddmPreemptionHeaderTests, givenDevicenotSupportingPreemptionWhenCommandStr
std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
auto localHwInfo = *platformDevices[0];
localHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(localHwInfo, wddm.get());
ExecutionEnvironment executionEnvironment;
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(localHwInfo, wddm.get(), executionEnvironment);
auto commandHeader = commandStreamReceiver->commandBufferHeader;
auto header = reinterpret_cast<COMMAND_BUFFER_HEADER *>(commandHeader);
EXPECT_FALSE(header->NeedsMidBatchPreEmptionSupport);
@ -698,7 +700,7 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt
tmpAllocation = GlobalMockSipProgram::sipProgram->getAllocation();
GlobalMockSipProgram::sipProgram->resetAllocation(memManager->allocateGraphicsMemory(1024));
}
auto mockCsr = new MockWddmCsr<FamilyType>(*platformDevices[0], this->wddm);
auto mockCsr = new MockWddmCsr<FamilyType>(*platformDevices[0], this->wddm, *device->executionEnvironment);
mockCsr->setMemoryManager(memManager);
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
@ -779,7 +781,7 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt
HWTEST_F(WddmDefaultTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedOn) {
DebugManager.flags.CsrDispatchMode.set(0);
std::unique_ptr<MockWddmCsr<FamilyType>> mockCsr(new MockWddmCsr<FamilyType>(*platformDevices[0], this->wddm));
std::unique_ptr<MockWddmCsr<FamilyType>> mockCsr(new MockWddmCsr<FamilyType>(*platformDevices[0], this->wddm, *device->executionEnvironment));
EXPECT_EQ(DispatchMode::BatchedDispatch, mockCsr->dispatchMode);
}
@ -791,7 +793,7 @@ HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVer
myFtrTable.ftrWddmHwQueues = false;
EXPECT_TRUE(WddmInterfaceVersion::Wddm20 == Wddm::pickWddmInterfaceVersion(myHwInfo));
{
WddmCommandStreamReceiver<FamilyType> wddmCsr20(myHwInfo, nullptr);
WddmCommandStreamReceiver<FamilyType> wddmCsr20(myHwInfo, nullptr, *device->executionEnvironment);
auto wddm20 = wddmCsr20.peekWddm();
EXPECT_EQ(typeid(*wddm20), typeid(WddmMock20));
delete wddm20;
@ -800,7 +802,7 @@ HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVer
myFtrTable.ftrWddmHwQueues = true;
EXPECT_TRUE(WddmInterfaceVersion::Wddm23 == Wddm::pickWddmInterfaceVersion(myHwInfo));
{
WddmCommandStreamReceiver<FamilyType> wddmCsr23(myHwInfo, nullptr);
WddmCommandStreamReceiver<FamilyType> wddmCsr23(myHwInfo, nullptr, *device->executionEnvironment);
auto wddm23 = wddmCsr23.peekWddm();
EXPECT_EQ(typeid(*wddm23), typeid(WddmMock23));
delete wddm23;
@ -835,7 +837,7 @@ HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenInitializedThenCrea
setCompressionEnabled(compressionEnabled[i][0], compressionEnabled[i][1]);
createMockWddm();
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm.get());
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm.get(), *device->executionEnvironment);
ASSERT_NE(nullptr, myMockWddm->getPageTableManager());
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
@ -877,7 +879,7 @@ HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenInitializedThenCrea
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenInitializedThenDontCreatePagetableMngr) {
setCompressionEnabled(false, false);
createMockWddm();
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm.get());
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm.get(), *device->executionEnvironment);
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
}
@ -886,7 +888,7 @@ HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenFlushingThenInitTra
for (size_t i = 0; i < 2; i++) {
setCompressionEnabled(compressionEnabled[i][0], compressionEnabled[i][1]);
createMockWddm();
auto mockWddmCsr = new MockWddmCsr<FamilyType>(hwInfo, myMockWddm.get());
auto mockWddmCsr = new MockWddmCsr<FamilyType>(hwInfo, myMockWddm.get(), *device->executionEnvironment);
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
@ -925,7 +927,7 @@ HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenFlushingThenInitTra
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontInitTranslationTable) {
setCompressionEnabled(false, false);
createMockWddm();
auto mockWddmCsr = new MockWddmCsr<FamilyType>(hwInfo, myMockWddm.get());
auto mockWddmCsr = new MockWddmCsr<FamilyType>(hwInfo, myMockWddm.get(), *device->executionEnvironment);
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());

View File

@ -35,7 +35,7 @@ namespace OCLRT {
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn, bool withAubDump);
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment);
class DriverInfoDeviceTest : public ::testing::Test {
public:
@ -56,7 +56,7 @@ class DriverInfoDeviceTest : public ::testing::Test {
const HardwareInfo *hwInfo;
};
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn, bool withAubDump) {
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
auto csr = new MockCommandStreamReceiver();
OSInterface *osInterface = new OSInterface();
DriverInfoDeviceTest::wddmMock = new WddmMock();

View File

@ -98,7 +98,7 @@ namespace OCLRT {
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
}
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn, bool withAubDump) {
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
return nullptr;
};
@ -207,4 +207,4 @@ TEST(PlatformConstructionTest, givenPlatformThatIsNotInitializedWhenGetDevicesIs
Platform platform;
auto devices = platform.getDevices();
EXPECT_EQ(nullptr, devices);
}
}

View File

@ -1307,7 +1307,7 @@ class CommandStreamReceiverMock : public UltCommandStreamReceiver<FamilyType> {
typedef UltCommandStreamReceiver<FamilyType> BaseClass;
public:
CommandStreamReceiverMock() : BaseClass(*platformDevices[0]) {
CommandStreamReceiverMock(ExecutionEnvironment &executionEnvironment) : BaseClass(*platformDevices[0], executionEnvironment) {
}
void makeResident(GraphicsAllocation &graphicsAllocation) override {
@ -1357,7 +1357,7 @@ HWTEST_F(PatchTokenTests, givenKernelRequiringConstantAllocationWhenMakeResident
ASSERT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, pKernel);
auto pCommandStreamReceiver = new CommandStreamReceiverMock<FamilyType>();
auto pCommandStreamReceiver = new CommandStreamReceiverMock<FamilyType>(*pDevice->executionEnvironment);
ASSERT_NE(nullptr, pCommandStreamReceiver);
pDevice->resetCommandStreamReceiver(pCommandStreamReceiver);

View File

@ -36,7 +36,7 @@ HWTEST_F(CommandStreamReceiverWithActiveDebuggerTest, givenCsrWithActiveDebugger
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
device->setSourceLevelDebuggerActive(true);
device->allocatePreemptionAllocationIfNotPresent();
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *device->executionEnvironment);
device->resetCommandStreamReceiver(mockCsr);