mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Add AUB generation in parallel to execution on GPU
This commit adds basic for parallel AUB generation and execution on GPU. Change-Id: I3c77557a9578db05c87be6db7a5e3006f7c4b053
This commit is contained in:
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -1,5 +1,5 @@
|
||||
#!groovy
|
||||
neoDependenciesRev='730226-753'
|
||||
strategy='EQUAL'
|
||||
allowedF=49
|
||||
allowedF=47
|
||||
allowedCD=365
|
||||
|
@ -36,7 +36,7 @@ components:
|
||||
internal:
|
||||
branch: master
|
||||
dest_dir: internal
|
||||
revision: a1f0f0789e9520a075392e67bcebcdedc17428e7
|
||||
revision: f58d8927082eb3954867dc02248e7a271239cd71
|
||||
type: git
|
||||
khronos:
|
||||
branch: master
|
||||
|
@ -180,6 +180,10 @@ set (RUNTIME_SRCS_COMMAND_STREAM
|
||||
command_stream/command_stream_receiver.h
|
||||
command_stream/command_stream_receiver_hw.h
|
||||
command_stream/command_stream_receiver_hw.inl
|
||||
command_stream/command_stream_receiver_with_aub_dump.h
|
||||
command_stream/command_stream_receiver_with_aub_dump.inl
|
||||
command_stream/create_command_stream_impl.cpp
|
||||
command_stream/create_command_stream_impl.h
|
||||
command_stream/csr_definitions.h
|
||||
command_stream/device_command_stream.h
|
||||
command_stream/linear_stream.cpp
|
||||
@ -484,8 +488,9 @@ set (RUNTIME_SRCS_SHARINGS
|
||||
|
||||
set (RUNTIME_SRCS_TBX
|
||||
tbx/tbx_proto.h
|
||||
tbx/tbx_sockets.cpp
|
||||
tbx/tbx_sockets.h
|
||||
tbx/tbx_sockets_imp.cpp
|
||||
tbx/tbx_sockets_imp.h
|
||||
)
|
||||
|
||||
set (RUNTIME_SRCS_UTILITIES
|
||||
@ -813,6 +818,7 @@ if(${GENERATE_EXECUTABLE})
|
||||
dll/options.cpp
|
||||
dll/create_command_stream.cpp
|
||||
dll/create_deferred_deleter.cpp
|
||||
dll/create_tbx_sockets.cpp
|
||||
helpers/abort.cpp
|
||||
helpers/debug_helpers.cpp
|
||||
gmm_helper/resource_info.cpp
|
||||
|
@ -33,7 +33,7 @@
|
||||
namespace OCLRT {
|
||||
AubCommandStreamReceiverCreateFunc aubCommandStreamReceiverFactory[IGFX_MAX_CORE] = {};
|
||||
|
||||
CommandStreamReceiver *AUBCommandStreamReceiver::create(const HardwareInfo &hwInfo, const std::string &baseName) {
|
||||
CommandStreamReceiver *AUBCommandStreamReceiver::create(const HardwareInfo &hwInfo, const std::string &baseName, bool standalone) {
|
||||
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) : nullptr;
|
||||
return pCreate ? pCreate(hwInfo, filePath, standalone) : nullptr;
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
||||
|
@ -30,10 +30,10 @@ struct HardwareInfo;
|
||||
class CommandStreamReceiver;
|
||||
|
||||
struct AUBCommandStreamReceiver {
|
||||
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, const std::string &filename);
|
||||
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, const std::string &filename, bool standalone);
|
||||
|
||||
using AubFileStream = AubMemDump::AubFileStream;
|
||||
};
|
||||
|
||||
typedef CommandStreamReceiver *(*AubCommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, const std::string &fileName);
|
||||
typedef CommandStreamReceiver *(*AubCommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone);
|
||||
}
|
||||
|
@ -51,11 +51,14 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
|
||||
void addContextToken();
|
||||
|
||||
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, const std::string &fileName);
|
||||
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone);
|
||||
|
||||
AUBCommandStreamReceiverHw(const HardwareInfo &hwInfoIn);
|
||||
AUBCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, bool standalone);
|
||||
~AUBCommandStreamReceiverHw() override;
|
||||
|
||||
AUBCommandStreamReceiverHw(const AUBCommandStreamReceiverHw &) = delete;
|
||||
AUBCommandStreamReceiverHw &operator=(const AUBCommandStreamReceiverHw &) = delete;
|
||||
|
||||
void initializeEngine(EngineType engineType);
|
||||
|
||||
MemoryManager *createMemoryManager(bool enable64kbPages) override {
|
||||
@ -77,6 +80,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
} engineInfoTable[EngineType::NUM_ENGINES];
|
||||
|
||||
AUBCommandStreamReceiver::AubFileStream stream;
|
||||
bool standalone;
|
||||
|
||||
TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type ppgtt;
|
||||
PDPE ggtt;
|
||||
|
@ -31,8 +31,9 @@
|
||||
namespace OCLRT {
|
||||
|
||||
template <typename GfxFamily>
|
||||
AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const HardwareInfo &hwInfoIn)
|
||||
: BaseClass(hwInfoIn) {
|
||||
AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, bool standalone)
|
||||
: BaseClass(hwInfoIn),
|
||||
standalone(standalone) {
|
||||
this->dispatchMode = CommandStreamReceiver::DispatchMode::BatchedDispatch;
|
||||
if (DebugManager.flags.CsrDispatchMode.get()) {
|
||||
this->dispatchMode = (CommandStreamReceiver::DispatchMode)DebugManager.flags.CsrDispatchMode.get();
|
||||
@ -182,8 +183,8 @@ void AUBCommandStreamReceiverHw<GfxFamily>::initializeEngine(EngineType engineTy
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
CommandStreamReceiver *AUBCommandStreamReceiverHw<GfxFamily>::create(const HardwareInfo &hwInfoIn, const std::string &fileName) {
|
||||
auto csr = new AUBCommandStreamReceiverHw<GfxFamily>(hwInfoIn);
|
||||
CommandStreamReceiver *AUBCommandStreamReceiverHw<GfxFamily>::create(const HardwareInfo &hwInfoIn, const std::string &fileName, bool standalone) {
|
||||
auto csr = new AUBCommandStreamReceiverHw<GfxFamily>(hwInfoIn, standalone);
|
||||
|
||||
// Open our file
|
||||
csr->stream.open(fileName.c_str());
|
||||
@ -210,11 +211,13 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
DEBUG_BREAK_IF(!engineInfo.pLRCA);
|
||||
}
|
||||
|
||||
if (this->dispatchMode == CommandStreamReceiver::DispatchMode::ImmediateDispatch) {
|
||||
makeResident(*batchBuffer.commandBufferAllocation);
|
||||
} else {
|
||||
allocationsForResidency->push_back(batchBuffer.commandBufferAllocation);
|
||||
batchBuffer.commandBufferAllocation->residencyTaskCount = this->taskCount;
|
||||
if (this->standalone) {
|
||||
if (this->dispatchMode == CommandStreamReceiver::DispatchMode::ImmediateDispatch) {
|
||||
makeResident(*batchBuffer.commandBufferAllocation);
|
||||
} else {
|
||||
allocationsForResidency->push_back(batchBuffer.commandBufferAllocation);
|
||||
batchBuffer.commandBufferAllocation->residencyTaskCount = this->taskCount;
|
||||
}
|
||||
}
|
||||
|
||||
processResidency(allocationsForResidency);
|
||||
@ -361,7 +364,9 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
submitLRCA(engineType, contextDescriptor);
|
||||
}
|
||||
|
||||
pollForCompletion(engineType);
|
||||
if (this->standalone) {
|
||||
pollForCompletion(engineType);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -390,10 +395,11 @@ void AUBCommandStreamReceiverHw<GfxFamily>::pollForCompletion(EngineType engineT
|
||||
|
||||
template <typename GfxFamily>
|
||||
void AUBCommandStreamReceiverHw<GfxFamily>::makeResident(GraphicsAllocation &gfxAllocation) {
|
||||
if (gfxAllocation.residencyTaskCount < (int)this->taskCount) {
|
||||
auto submissionTaskCount = this->taskCount + 1;
|
||||
if (gfxAllocation.residencyTaskCount < (int)submissionTaskCount) {
|
||||
this->getMemoryManager()->pushAllocationForResidency(&gfxAllocation);
|
||||
}
|
||||
gfxAllocation.residencyTaskCount = (int)this->taskCount;
|
||||
gfxAllocation.residencyTaskCount = submissionTaskCount;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
@ -441,7 +447,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::processResidency(ResidencyContainer
|
||||
DEBUG_BREAK_IF(!((gfxAllocation->getUnderlyingBufferSize() == 0) ||
|
||||
!!(gfxAllocation->getAllocationType() & GraphicsAllocation::ALLOCATION_TYPE_NON_AUB_WRITABLE)));
|
||||
}
|
||||
gfxAllocation->residencyTaskCount = (int)this->taskCount;
|
||||
gfxAllocation->residencyTaskCount = this->taskCount + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,5 +158,5 @@ class CommandStreamReceiver {
|
||||
uint64_t totalMemoryUsed = 0u;
|
||||
};
|
||||
|
||||
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn);
|
||||
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump);
|
||||
} // namespace OCLRT
|
||||
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template <typename BaseCSR>
|
||||
class CommandStreamReceiverWithAUBDump : public BaseCSR {
|
||||
public:
|
||||
CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn);
|
||||
~CommandStreamReceiverWithAUBDump() override;
|
||||
|
||||
CommandStreamReceiverWithAUBDump(const CommandStreamReceiverWithAUBDump &) = delete;
|
||||
CommandStreamReceiverWithAUBDump &operator=(const CommandStreamReceiverWithAUBDump &) = delete;
|
||||
|
||||
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineOrdinal, ResidencyContainer *allocationsForResidency) override;
|
||||
void processResidency(ResidencyContainer *allocationsForResidency) override;
|
||||
|
||||
MemoryManager *createMemoryManager(bool enable64kbPages) override;
|
||||
|
||||
CommandStreamReceiver *aubCSR = nullptr;
|
||||
};
|
||||
|
||||
} // namespace OCLRT
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver.h"
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
template <typename BaseCSR>
|
||||
CommandStreamReceiverWithAUBDump<BaseCSR>::~CommandStreamReceiverWithAUBDump() {
|
||||
delete aubCSR;
|
||||
}
|
||||
|
||||
template <typename BaseCSR>
|
||||
FlushStamp CommandStreamReceiverWithAUBDump<BaseCSR>::flush(BatchBuffer &batchBuffer, EngineType engineOrdinal, ResidencyContainer *allocationsForResidency) {
|
||||
FlushStamp flushStamp = BaseCSR::flush(batchBuffer, engineOrdinal, allocationsForResidency);
|
||||
if (aubCSR) {
|
||||
aubCSR->flush(batchBuffer, engineOrdinal, allocationsForResidency);
|
||||
}
|
||||
return flushStamp;
|
||||
}
|
||||
|
||||
template <typename BaseCSR>
|
||||
void CommandStreamReceiverWithAUBDump<BaseCSR>::processResidency(ResidencyContainer *allocationsForResidency) {
|
||||
BaseCSR::processResidency(allocationsForResidency);
|
||||
if (aubCSR) {
|
||||
aubCSR->processResidency(allocationsForResidency);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename BaseCSR>
|
||||
MemoryManager *CommandStreamReceiverWithAUBDump<BaseCSR>::createMemoryManager(bool enable64kbPages) {
|
||||
auto memoryManager = BaseCSR::createMemoryManager(enable64kbPages);
|
||||
if (aubCSR) {
|
||||
aubCSR->setMemoryManager(memoryManager);
|
||||
}
|
||||
return memoryManager;
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
70
runtime/command_stream/create_command_stream_impl.cpp
Normal file
70
runtime/command_stream/create_command_stream_impl.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
||||
|
||||
CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo) {
|
||||
auto funcCreate = commandStreamReceiverFactory[pHwInfo->pPlatform->eRenderCoreFamily];
|
||||
if (funcCreate == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
CommandStreamReceiver *commandStreamReceiver = nullptr;
|
||||
int32_t csr = DebugManager.flags.SetCommandStreamReceiver.get();
|
||||
if (csr) {
|
||||
if (csr >= CSR_TYPES_NUM)
|
||||
return nullptr;
|
||||
|
||||
Gmm::initContext(pHwInfo->pPlatform,
|
||||
pHwInfo->pSkuTable,
|
||||
pHwInfo->pWaTable,
|
||||
pHwInfo->pSysInfo);
|
||||
|
||||
switch (csr) {
|
||||
case CSR_AUB:
|
||||
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile", true);
|
||||
initialHardwareTag = -1;
|
||||
break;
|
||||
case CSR_TBX:
|
||||
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo);
|
||||
break;
|
||||
case CSR_HW_WITH_AUB: {
|
||||
commandStreamReceiver = funcCreate(*pHwInfo, true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
commandStreamReceiver = funcCreate(*pHwInfo, false);
|
||||
}
|
||||
return commandStreamReceiver;
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
29
runtime/command_stream/create_command_stream_impl.h
Normal file
29
runtime/command_stream/create_command_stream_impl.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
|
||||
namespace OCLRT {
|
||||
extern CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo);
|
||||
}
|
@ -36,6 +36,6 @@ class DeviceCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
|
||||
}
|
||||
|
||||
public:
|
||||
static CommandStreamReceiver *create(const HardwareInfo &hwInfo);
|
||||
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, bool withAubDump);
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 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"),
|
||||
@ -20,8 +20,10 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/create_command_stream_impl.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||
#include "runtime/command_stream/device_command_stream.h"
|
||||
#include "runtime/helpers/debug_helpers.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
@ -31,33 +33,8 @@
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
||||
|
||||
CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo) {
|
||||
CommandStreamReceiver *commandStreamReceiver = nullptr;
|
||||
int32_t csr = DebugManager.flags.SetCommandStreamReceiver.get();
|
||||
if (csr) {
|
||||
if (csr > CSR_TBX)
|
||||
return nullptr;
|
||||
|
||||
Gmm::initContext(pHwInfo->pPlatform,
|
||||
pHwInfo->pSkuTable,
|
||||
pHwInfo->pWaTable,
|
||||
pHwInfo->pSysInfo);
|
||||
|
||||
if (csr == CSR_AUB) {
|
||||
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile");
|
||||
initialHardwareTag = -1;
|
||||
} else {
|
||||
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo);
|
||||
}
|
||||
} else {
|
||||
DEBUG_BREAK_IF(nullptr == pHwInfo->pPlatform);
|
||||
auto funcCreate = commandStreamReceiverFactory[pHwInfo->pPlatform->eRenderCoreFamily];
|
||||
if (funcCreate)
|
||||
commandStreamReceiver = funcCreate(*pHwInfo);
|
||||
}
|
||||
return commandStreamReceiver;
|
||||
return createCommandStreamImpl(pHwInfo);
|
||||
}
|
||||
|
||||
bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned) {
|
||||
|
31
runtime/dll/create_tbx_sockets.cpp
Normal file
31
runtime/dll/create_tbx_sockets.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/tbx/tbx_sockets_imp.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
namespace OCLRT {
|
||||
TbxSockets *TbxSockets::create() {
|
||||
return new TbxSocketsImp;
|
||||
}
|
||||
} // namespace OCLRT
|
@ -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"),
|
||||
@ -22,9 +22,11 @@
|
||||
|
||||
#include "runtime/os_interface/linux/device_command_stream.inl"
|
||||
#include "runtime/os_interface/linux/drm_command_stream.inl"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template class DeviceCommandStreamReceiver<BDWFamily>;
|
||||
template class DrmCommandStreamReceiver<BDWFamily>;
|
||||
template class CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<BDWFamily>>;
|
||||
}
|
||||
|
@ -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"),
|
||||
@ -22,9 +22,11 @@
|
||||
|
||||
#include "runtime/os_interface/windows/device_command_stream.inl"
|
||||
#include "runtime/os_interface/windows/wddm_device_command_stream.inl"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template class DeviceCommandStreamReceiver<BDWFamily>;
|
||||
template class WddmCommandStreamReceiver<BDWFamily>;
|
||||
template class CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<BDWFamily>>;
|
||||
}
|
||||
|
@ -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"),
|
||||
@ -22,9 +22,11 @@
|
||||
|
||||
#include "runtime/os_interface/linux/device_command_stream.inl"
|
||||
#include "runtime/os_interface/linux/drm_command_stream.inl"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template class DeviceCommandStreamReceiver<SKLFamily>;
|
||||
template class DrmCommandStreamReceiver<SKLFamily>;
|
||||
template class CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<SKLFamily>>;
|
||||
}
|
||||
|
@ -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"),
|
||||
@ -22,9 +22,11 @@
|
||||
|
||||
#include "runtime/os_interface/windows/device_command_stream.inl"
|
||||
#include "runtime/os_interface/windows/wddm_device_command_stream.inl"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template class DeviceCommandStreamReceiver<SKLFamily>;
|
||||
template class WddmCommandStreamReceiver<SKLFamily>;
|
||||
template class CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<SKLFamily>>;
|
||||
}
|
||||
|
@ -36,7 +36,11 @@ enum CommandStreamReceiverType {
|
||||
// Capture an AUB file automatically for all traffic going through Device -> CommandStreamReceiver
|
||||
CSR_AUB,
|
||||
// Capture an AUB and tunnel all commands going through Device -> CommandStreamReceiver to a TBX server
|
||||
CSR_TBX
|
||||
CSR_TBX,
|
||||
// Use receiver for real HW and capture AUB file
|
||||
CSR_HW_WITH_AUB,
|
||||
// Number of CSR types
|
||||
CSR_TYPES_NUM
|
||||
};
|
||||
|
||||
namespace OCLRT {
|
||||
|
@ -21,13 +21,19 @@
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/device_command_stream.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||
#include "runtime/os_interface/linux/drm_command_stream.h"
|
||||
#include "hw_cmds.h"
|
||||
#include "drm_command_stream.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template <typename GfxFamily>
|
||||
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo) {
|
||||
return new DrmCommandStreamReceiver<GfxFamily>(hwInfo, nullptr, gemCloseWorkerMode::gemCloseWorkerInactive);
|
||||
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo, bool withAubDump) {
|
||||
if (withAubDump) {
|
||||
return new CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<GfxFamily>>(hwInfo);
|
||||
} else {
|
||||
return new DrmCommandStreamReceiver<GfxFamily>(hwInfo, nullptr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
DrmCommandStreamReceiver(const HardwareInfo &hwInfoIn, Drm *drm, gemCloseWorkerMode mode = gemCloseWorkerMode::gemCloseWorkerInactive);
|
||||
|
||||
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) override;
|
||||
void makeResident(GraphicsAllocation &gfxAllocation) override;
|
||||
|
24
runtime/os_interface/linux/os_socket.h
Normal file
24
runtime/os_interface/linux/os_socket.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
#include <sys/socket.h>
|
||||
typedef int SOCKET;
|
@ -26,13 +26,18 @@
|
||||
#pragma warning(disable : 4005)
|
||||
#include "hw_cmds.h"
|
||||
#include "runtime/command_stream/device_command_stream.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||
#include "runtime/os_interface/windows/wddm_device_command_stream.h"
|
||||
#pragma warning(pop)
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template <typename GfxFamily>
|
||||
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo) {
|
||||
return new WddmCommandStreamReceiver<GfxFamily>(hwInfo, nullptr);
|
||||
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo, bool withAubDump) {
|
||||
if (withAubDump) {
|
||||
return new CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<GfxFamily>>(hwInfo);
|
||||
} else {
|
||||
return new WddmCommandStreamReceiver<GfxFamily>(hwInfo, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
24
runtime/os_interface/windows/os_socket.h
Normal file
24
runtime/os_interface/windows/os_socket.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <winsock.h>
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 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"),
|
||||
@ -20,7 +20,7 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/tbx/tbx_sockets.h"
|
||||
#include "runtime/tbx/tbx_sockets_imp.h"
|
||||
#include "runtime/helpers/debug_helpers.h"
|
||||
#include "runtime/helpers/string.h"
|
||||
|
||||
@ -28,59 +28,23 @@
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <winsock.h>
|
||||
typedef int socklen_t;
|
||||
#else
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
typedef int SOCKET;
|
||||
typedef struct sockaddr SOCKADDR;
|
||||
#define SOCKET_ERROR -1
|
||||
#define INVALID_SOCKET -1
|
||||
#define WSAECONNRESET -1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include "tbx_proto.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
class TbxSocketsImp : public TbxSockets {
|
||||
public:
|
||||
TbxSocketsImp(std::ostream &err = std::cerr);
|
||||
~TbxSocketsImp() override = default;
|
||||
|
||||
bool init(const std::string &hostNameOrIp, uint16_t port) override;
|
||||
void close() override;
|
||||
|
||||
bool writeGTT(uint32_t gttOffset, uint64_t entry) override;
|
||||
|
||||
bool readMemory(uint64_t offset, void *data, size_t size) override;
|
||||
bool writeMemory(uint64_t offset, const void *data, size_t size) override;
|
||||
|
||||
bool readMMIO(uint32_t offset, uint32_t *data) override;
|
||||
bool writeMMIO(uint32_t offset, uint32_t data) override;
|
||||
|
||||
protected:
|
||||
std::ostream &cerrStream;
|
||||
SOCKET m_socket = 0;
|
||||
|
||||
bool connectToServer(const std::string &hostNameOrIp, uint16_t port);
|
||||
bool sendWriteData(const void *buffer, size_t sizeInBytes);
|
||||
bool getResponseData(void *buffer, size_t sizeInBytes);
|
||||
|
||||
inline uint32_t getNextTransID() { return transID++; }
|
||||
|
||||
void logErrorInfo(const char *tag);
|
||||
|
||||
private:
|
||||
uint32_t transID = 0;
|
||||
};
|
||||
|
||||
TbxSocketsImp::TbxSocketsImp(std::ostream &err)
|
||||
: cerrStream(err) {
|
||||
}
|
||||
@ -365,7 +329,4 @@ bool TbxSocketsImp::getResponseData(void *buffer, size_t sizeInBytes) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TbxSockets *TbxSockets::create() {
|
||||
return new TbxSocketsImp;
|
||||
}
|
||||
} // namespace OCLRT
|
59
runtime/tbx/tbx_sockets_imp.h
Normal file
59
runtime/tbx/tbx_sockets_imp.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
#include "runtime/tbx/tbx_sockets.h"
|
||||
#include "os_socket.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
class TbxSocketsImp : public TbxSockets {
|
||||
public:
|
||||
TbxSocketsImp(std::ostream &err = std::cerr);
|
||||
~TbxSocketsImp() override = default;
|
||||
|
||||
bool init(const std::string &hostNameOrIp, uint16_t port) override;
|
||||
void close() override;
|
||||
|
||||
bool writeGTT(uint32_t gttOffset, uint64_t entry) override;
|
||||
|
||||
bool readMemory(uint64_t offset, void *data, size_t size) override;
|
||||
bool writeMemory(uint64_t offset, const void *data, size_t size) override;
|
||||
|
||||
bool readMMIO(uint32_t offset, uint32_t *data) override;
|
||||
bool writeMMIO(uint32_t offset, uint32_t data) override;
|
||||
|
||||
protected:
|
||||
std::ostream &cerrStream;
|
||||
SOCKET m_socket = 0;
|
||||
|
||||
bool connectToServer(const std::string &hostNameOrIp, uint16_t port);
|
||||
bool sendWriteData(const void *buffer, size_t sizeInBytes);
|
||||
bool getResponseData(void *buffer, size_t sizeInBytes);
|
||||
|
||||
inline uint32_t getNextTransID() { return transID++; }
|
||||
|
||||
void logErrorInfo(const char *tag);
|
||||
|
||||
uint32_t transID = 0;
|
||||
};
|
||||
} // namespace OCLRT
|
@ -41,7 +41,7 @@ void AUBCommandStreamFixture::SetUp(CommandQueue *pCmdQ) {
|
||||
strfilename << testInfo->test_case_name() << "_" << testInfo->name();
|
||||
|
||||
const auto &hwInfo = device.getHardwareInfo();
|
||||
pCommandStreamReceiver = AUBCommandStreamReceiver::create(hwInfo, strfilename.str());
|
||||
pCommandStreamReceiver = AUBCommandStreamReceiver::create(hwInfo, strfilename.str(), true);
|
||||
ASSERT_NE(nullptr, pCommandStreamReceiver);
|
||||
|
||||
device.resetCommandStreamReceiver(pCommandStreamReceiver);
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2017, Intel Corporation
|
||||
# Copyright (c) 2018, Intel Corporation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
@ -24,6 +24,8 @@ set(IGDRCL_SRCS_tests_command_stream
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/command_stream_fixture.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_tests.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_with_aub_dump_tests.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/create_command_stream_receiver_tests.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_tests.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/linear_stream_fixture.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/linear_stream_tests.cpp"
|
||||
|
@ -45,9 +45,9 @@ typedef Test<DeviceFixture> AubCommandStreamReceiverTests;
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
MockAubCsr(const HardwareInfo &hwInfoIn) : AUBCommandStreamReceiverHw<GfxFamily>(hwInfoIn){};
|
||||
MockAubCsr(const HardwareInfo &hwInfoIn, bool standalone) : AUBCommandStreamReceiverHw<GfxFamily>(hwInfoIn, standalone){};
|
||||
|
||||
CommandStreamReceiver::DispatchMode peekDispatchMode() {
|
||||
CommandStreamReceiver::DispatchMode peekDispatchMode() const {
|
||||
return this->dispatchMode;
|
||||
}
|
||||
};
|
||||
@ -58,7 +58,7 @@ TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreat
|
||||
|
||||
const_cast<PLATFORM *>(hwInfo.pPlatform)->eRenderCoreFamily = GFXCORE_FAMILY_FORCE_ULONG; // wrong gfx core family
|
||||
|
||||
CommandStreamReceiver *aubCsr = AUBCommandStreamReceiver::create(hwInfo, "");
|
||||
CommandStreamReceiver *aubCsr = AUBCommandStreamReceiver::create(hwInfo, "", true);
|
||||
EXPECT_EQ(nullptr, aubCsr);
|
||||
|
||||
const_cast<PLATFORM *>(hwInfo.pPlatform)->eRenderCoreFamily = family;
|
||||
@ -66,41 +66,41 @@ TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreat
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenItIsCreatedWithDefaultSettingsThenItHasBatchedDispatchModeEnabled) {
|
||||
DebugManager.flags.CsrDispatchMode.set(0);
|
||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
||||
EXPECT_EQ(CommandStreamReceiver::DispatchMode::BatchedDispatch, aubCsr->peekDispatchMode());
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenItIsCreatedWithDebugSettingsThenItHasProperDispatchModeEnabled) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.CsrDispatchMode.set(CommandStreamReceiver::DispatchMode::ImmediateDispatch);
|
||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
||||
EXPECT_EQ(CommandStreamReceiver::DispatchMode::ImmediateDispatch, aubCsr->peekDispatchMode());
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreatedThenMemoryManagerIsNotNull) {
|
||||
HardwareInfo hwInfo;
|
||||
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(hwInfo));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(hwInfo, true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
EXPECT_NE(nullptr, memoryManager.get());
|
||||
aubCsr->setMemoryManager(nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentCalledMultipleTimesAffectsResidencyOnce) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
|
||||
// First makeResident marks the allocation resident
|
||||
aubCsr->makeResident(*gfxAllocation);
|
||||
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount(), gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ(1u, memoryManager->getResidencyAllocations().size());
|
||||
|
||||
// Second makeResident should have no impact
|
||||
aubCsr->makeResident(*gfxAllocation);
|
||||
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount(), gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ(1u, memoryManager->getResidencyAllocations().size());
|
||||
|
||||
// First makeNonResident marks the allocation as nonresident
|
||||
@ -118,7 +118,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentC
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, flushShouldLeaveProperRingTailAlignment) {
|
||||
auto aubCsr = new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]);
|
||||
auto aubCsr = new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true);
|
||||
auto memoryManager = aubCsr->createMemoryManager(false);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||
@ -146,7 +146,7 @@ HWTEST_F(AubCommandStreamReceiverTests, flushShouldLeaveProperRingTailAlignment)
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnCommandBufferAllocation) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||
@ -162,7 +162,7 @@ HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnCommandBuff
|
||||
aubCsr->flush(batchBuffer, engineType, nullptr);
|
||||
|
||||
EXPECT_NE(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount(), commandBuffer->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, commandBuffer->residencyTaskCount);
|
||||
|
||||
aubCsr->makeSurfacePackNonResident(nullptr);
|
||||
|
||||
@ -173,7 +173,7 @@ HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnCommandBuff
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnResidencyAllocations) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
|
||||
@ -192,10 +192,10 @@ HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnResidencyAl
|
||||
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency);
|
||||
|
||||
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount(), gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount);
|
||||
|
||||
EXPECT_NE(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount(), commandBuffer->residencyTaskCount);
|
||||
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, commandBuffer->residencyTaskCount);
|
||||
|
||||
aubCsr->makeSurfacePackNonResident(&allocationsForResidency);
|
||||
|
||||
@ -208,7 +208,7 @@ HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnResidencyAl
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationIsCreatedThenItDoesntHaveTypeNonAubWritable) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
|
||||
@ -219,7 +219,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcessResidencyIsCalledOnDefaultAllocationThenAllocationTypeShouldNotBeMadeNonAubWritable) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
auto gfxDefaultAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
|
||||
@ -233,7 +233,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcessResidencyIsCalledOnBufferAndImageAllocationsThenAllocationsTypesShouldBeMadeNonAubWritable) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
@ -254,7 +254,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationTypeIsntNonAubWritableThenWriteMemoryIsAllowed) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
|
||||
@ -265,7 +265,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationTypeIsNonAubWritableThenWriteMemoryIsNotAllowed) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
|
||||
@ -277,8 +277,29 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationSizeIsZeroThenWriteMemoryIsNotAllowed) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0]));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
auto gfxAllocation = GraphicsAllocation((void *)0x1234, 0);
|
||||
|
||||
EXPECT_FALSE(aubCsr->writeMemory(gfxAllocation));
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStandaloneModeWhenFlushIsCalledThenItShouldNotCallMakeResidentOnCommandBufferAllocation) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], false));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, false, false, cs.getUsed(), &cs};
|
||||
auto engineType = OCLRT::ENGINE_RCS;
|
||||
|
||||
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
|
||||
aubCsr->flush(batchBuffer, engineType, nullptr);
|
||||
|
||||
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
|
||||
memoryManager->freeGraphicsMemoryImpl(commandBuffer);
|
||||
aubCsr->setMemoryManager(nullptr);
|
||||
}
|
||||
|
@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#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 "test.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
|
||||
MyMockCsr(const HardwareInfo &hwInfoIn, void *ptr) : UltCommandStreamReceiver(hwInfoIn) {
|
||||
}
|
||||
|
||||
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineOrdinal, ResidencyContainer *allocationsForResidency) override {
|
||||
flushParametrization.wasCalled = true;
|
||||
flushParametrization.receivedBatchBuffer = &batchBuffer;
|
||||
flushParametrization.receivedEngine = engineOrdinal;
|
||||
flushParametrization.receivedAllocationsForResidency = allocationsForResidency;
|
||||
return flushParametrization.flushStampToReturn;
|
||||
}
|
||||
|
||||
void makeResident(GraphicsAllocation &gfxAllocation) override {
|
||||
makeResidentParameterization.wasCalled = true;
|
||||
makeResidentParameterization.receivedGfxAllocation = &gfxAllocation;
|
||||
}
|
||||
|
||||
void processResidency(ResidencyContainer *allocationsForResidency) override {
|
||||
processResidencyParameterization.wasCalled = true;
|
||||
processResidencyParameterization.receivedAllocationsForResidency = allocationsForResidency;
|
||||
}
|
||||
|
||||
void makeNonResident(GraphicsAllocation &gfxAllocation) override {
|
||||
makeNonResidentParameterization.wasCalled = true;
|
||||
makeNonResidentParameterization.receivedGfxAllocation = &gfxAllocation;
|
||||
}
|
||||
|
||||
struct FlushParameterization {
|
||||
bool wasCalled = false;
|
||||
FlushStamp flushStampToReturn = 1;
|
||||
BatchBuffer *receivedBatchBuffer = nullptr;
|
||||
EngineType receivedEngine = EngineType::ENGINE_RCS;
|
||||
ResidencyContainer *receivedAllocationsForResidency = nullptr;
|
||||
} flushParametrization;
|
||||
|
||||
struct MakeResidentParameterization {
|
||||
bool wasCalled = false;
|
||||
GraphicsAllocation *receivedGfxAllocation = nullptr;
|
||||
} makeResidentParameterization;
|
||||
|
||||
struct ProcessResidencyParameterization {
|
||||
bool wasCalled = false;
|
||||
ResidencyContainer *receivedAllocationsForResidency = nullptr;
|
||||
} processResidencyParameterization;
|
||||
|
||||
struct MakeNonResidentParameterization {
|
||||
bool wasCalled = false;
|
||||
GraphicsAllocation *receivedGfxAllocation = nullptr;
|
||||
} makeNonResidentParameterization;
|
||||
};
|
||||
|
||||
template <typename BaseCSR>
|
||||
struct MyMockCsrWithAubDump : CommandStreamReceiverWithAUBDump<BaseCSR> {
|
||||
MyMockCsrWithAubDump<BaseCSR>(const HardwareInfo &hwInfoIn, bool createAubCSR) : CommandStreamReceiverWithAUBDump<BaseCSR>(hwInfoIn) {
|
||||
if (this->aubCSR != nullptr) {
|
||||
delete this->aubCSR;
|
||||
this->aubCSR = nullptr;
|
||||
}
|
||||
if (createAubCSR) {
|
||||
// overwrite with mock
|
||||
this->aubCSR = new MyMockCsr(hwInfoIn, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
MyMockCsr &getAubMockCsr() {
|
||||
return static_cast<MyMockCsr &>(*this->aubCSR);
|
||||
}
|
||||
};
|
||||
|
||||
struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParam<bool /*createAubCSR*/> {
|
||||
void SetUp() override {
|
||||
createAubCSR = GetParam();
|
||||
csrWithAubDump = new MyMockCsrWithAubDump<MyMockCsr>(DEFAULT_TEST_PLATFORM::hwInfo, createAubCSR);
|
||||
ASSERT_NE(nullptr, csrWithAubDump);
|
||||
|
||||
memoryManager = csrWithAubDump->createMemoryManager(false);
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
delete csrWithAubDump;
|
||||
delete memoryManager;
|
||||
}
|
||||
|
||||
MyMockCsrWithAubDump<MyMockCsr> *csrWithAubDump;
|
||||
MemoryManager *memoryManager;
|
||||
bool createAubCSR;
|
||||
};
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenCtorIsCalledThenAubCsrIsInitialized) {
|
||||
if (createAubCSR) {
|
||||
EXPECT_NE(nullptr, csrWithAubDump->aubCSR);
|
||||
} else {
|
||||
EXPECT_EQ(nullptr, csrWithAubDump->aubCSR);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenFlushIsCalledThenBaseCsrFlushStampIsReturned) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, false, false, cs.getUsed(), &cs};
|
||||
auto engineType = OCLRT::ENGINE_RCS;
|
||||
|
||||
ResidencyContainer allocationsForResidency;
|
||||
FlushStamp flushStamp = csrWithAubDump->flush(batchBuffer, engineType, &allocationsForResidency);
|
||||
EXPECT_EQ(flushStamp, csrWithAubDump->flushParametrization.flushStampToReturn);
|
||||
|
||||
EXPECT_TRUE(csrWithAubDump->flushParametrization.wasCalled);
|
||||
EXPECT_EQ(&batchBuffer, csrWithAubDump->flushParametrization.receivedBatchBuffer);
|
||||
EXPECT_EQ(engineType, csrWithAubDump->flushParametrization.receivedEngine);
|
||||
EXPECT_EQ(&allocationsForResidency, csrWithAubDump->flushParametrization.receivedAllocationsForResidency);
|
||||
|
||||
if (createAubCSR) {
|
||||
EXPECT_TRUE(csrWithAubDump->getAubMockCsr().flushParametrization.wasCalled);
|
||||
EXPECT_EQ(&batchBuffer, csrWithAubDump->getAubMockCsr().flushParametrization.receivedBatchBuffer);
|
||||
EXPECT_EQ(engineType, csrWithAubDump->getAubMockCsr().flushParametrization.receivedEngine);
|
||||
EXPECT_EQ(&allocationsForResidency, csrWithAubDump->getAubMockCsr().flushParametrization.receivedAllocationsForResidency);
|
||||
}
|
||||
|
||||
memoryManager->freeGraphicsMemoryImpl(commandBuffer);
|
||||
}
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenMakeResidentIsCalledThenBaseCsrMakeResidentIsCalled) {
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
|
||||
csrWithAubDump->makeResident(*gfxAllocation);
|
||||
|
||||
EXPECT_TRUE(csrWithAubDump->makeResidentParameterization.wasCalled);
|
||||
EXPECT_EQ(gfxAllocation, csrWithAubDump->makeResidentParameterization.receivedGfxAllocation);
|
||||
|
||||
if (createAubCSR) {
|
||||
EXPECT_FALSE(csrWithAubDump->getAubMockCsr().makeResidentParameterization.wasCalled);
|
||||
EXPECT_EQ(nullptr, csrWithAubDump->getAubMockCsr().makeResidentParameterization.receivedGfxAllocation);
|
||||
}
|
||||
|
||||
memoryManager->freeGraphicsMemoryImpl(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenProcessResidencyIsCalledThenBothBaseAndAubCsrProcessResidencyIsCalled) {
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
|
||||
ResidencyContainer allocationsForResidency = {gfxAllocation};
|
||||
csrWithAubDump->processResidency(&allocationsForResidency);
|
||||
|
||||
EXPECT_TRUE(csrWithAubDump->processResidencyParameterization.wasCalled);
|
||||
EXPECT_EQ(&allocationsForResidency, csrWithAubDump->processResidencyParameterization.receivedAllocationsForResidency);
|
||||
|
||||
if (createAubCSR) {
|
||||
EXPECT_TRUE(csrWithAubDump->getAubMockCsr().processResidencyParameterization.wasCalled);
|
||||
EXPECT_EQ(&allocationsForResidency, csrWithAubDump->getAubMockCsr().processResidencyParameterization.receivedAllocationsForResidency);
|
||||
}
|
||||
|
||||
memoryManager->freeGraphicsMemoryImpl(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenMakeNonResidentIsCalledThenBaseCsrMakeNonResidentIsCalled) {
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
|
||||
csrWithAubDump->makeNonResident(*gfxAllocation);
|
||||
|
||||
EXPECT_TRUE(csrWithAubDump->makeNonResidentParameterization.wasCalled);
|
||||
EXPECT_EQ(gfxAllocation, csrWithAubDump->makeNonResidentParameterization.receivedGfxAllocation);
|
||||
|
||||
if (createAubCSR) {
|
||||
EXPECT_FALSE(csrWithAubDump->getAubMockCsr().makeNonResidentParameterization.wasCalled);
|
||||
EXPECT_EQ(nullptr, csrWithAubDump->getAubMockCsr().makeNonResidentParameterization.receivedGfxAllocation);
|
||||
}
|
||||
|
||||
memoryManager->freeGraphicsMemoryImpl(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenCreateMemoryManagerIsCalledThenItIsUsedByBothBaseAndAubCsr) {
|
||||
EXPECT_EQ(memoryManager, csrWithAubDump->getMemoryManager());
|
||||
if (createAubCSR) {
|
||||
EXPECT_EQ(memoryManager, csrWithAubDump->aubCSR->getMemoryManager());
|
||||
}
|
||||
}
|
||||
|
||||
static bool createAubCSR[] = {
|
||||
false,
|
||||
true};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
CommandStreamReceiverWithAubDumpTest_Create,
|
||||
CommandStreamReceiverWithAubDumpTest,
|
||||
testing::ValuesIn(createAubCSR));
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
namespace OCLRT {
|
||||
CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo);
|
||||
}
|
||||
|
||||
struct CreateCommandStreamReceiverTest : public ::testing::TestWithParam<CommandStreamReceiverType> {
|
||||
void SetUp() override {
|
||||
storeInitHWTag = initialHardwareTag;
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
initialHardwareTag = storeInitHWTag;
|
||||
}
|
||||
|
||||
protected:
|
||||
int storeInitHWTag;
|
||||
};
|
||||
|
||||
HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetToValidTypeThenTheFuntionReturnsCommandStreamReceiver) {
|
||||
DebugManagerStateRestore stateRestorer;
|
||||
const HardwareInfo hwInfo = *platformDevices[0];
|
||||
CommandStreamReceiverType csrType = GetParam();
|
||||
MemoryManager *memoryManager = nullptr;
|
||||
|
||||
overrideCommandStreamReceiverCreation = true;
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(csrType);
|
||||
auto csr = createCommandStream(&hwInfo);
|
||||
if (csrType < CommandStreamReceiverType::CSR_TYPES_NUM) {
|
||||
EXPECT_NE(nullptr, csr);
|
||||
memoryManager = csr->createMemoryManager(false);
|
||||
EXPECT_NE(nullptr, memoryManager);
|
||||
} else {
|
||||
EXPECT_EQ(nullptr, csr);
|
||||
EXPECT_EQ(nullptr, memoryManager);
|
||||
}
|
||||
delete csr;
|
||||
delete memoryManager;
|
||||
}
|
||||
|
||||
static CommandStreamReceiverType commandStreamReceiverTypes[] = {
|
||||
CSR_HW,
|
||||
CSR_AUB,
|
||||
CSR_TBX,
|
||||
CSR_HW_WITH_AUB,
|
||||
CSR_TYPES_NUM};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
CreateCommandStreamReceiverTest_Create,
|
||||
CreateCommandStreamReceiverTest,
|
||||
testing::ValuesIn(commandStreamReceiverTypes));
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2017, Intel Corporation
|
||||
# Copyright (c) 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"),
|
||||
@ -57,6 +57,7 @@ list (APPEND IGDRCL_SRCS_LIB_ULT
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/mocks/mock_device.h
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/mocks/mock_memory_manager.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/mocks/mock_memory_manager.h
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/libult/create_tbx_sockets.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/libult/ult_command_stream_receiver.h
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/helpers/debug_helpers.cpp
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 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"),
|
||||
@ -20,6 +20,7 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/create_command_stream_impl.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
||||
@ -36,9 +37,13 @@ CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo) {
|
||||
assert(nullptr != pHwInfo->pPlatform);
|
||||
auto offset = !overrideCommandStreamReceiverCreation ? IGFX_MAX_CORE : 0;
|
||||
overrideCommandStreamReceiverCreation = false;
|
||||
auto funcCreate = commandStreamReceiverFactory[offset + pHwInfo->pPlatform->eRenderCoreFamily];
|
||||
if (funcCreate) {
|
||||
commandStreamReceiver = funcCreate(*pHwInfo);
|
||||
if (offset != 0) {
|
||||
auto funcCreate = commandStreamReceiverFactory[offset + pHwInfo->pPlatform->eRenderCoreFamily];
|
||||
if (funcCreate) {
|
||||
commandStreamReceiver = funcCreate(*pHwInfo, false);
|
||||
}
|
||||
} else {
|
||||
commandStreamReceiver = createCommandStreamImpl(pHwInfo);
|
||||
}
|
||||
return commandStreamReceiver;
|
||||
}
|
||||
|
29
unit_tests/libult/create_tbx_sockets.cpp
Normal file
29
unit_tests/libult/create_tbx_sockets.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "unit_tests/mocks/mock_tbx_sockets.h"
|
||||
|
||||
namespace OCLRT {
|
||||
TbxSockets *TbxSockets::create() {
|
||||
return new MockTbxSockets;
|
||||
}
|
||||
} // namespace OCLRT
|
@ -57,7 +57,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
|
||||
UltCommandStreamReceiver(const UltCommandStreamReceiver &) = delete;
|
||||
UltCommandStreamReceiver &operator=(const UltCommandStreamReceiver &) = delete;
|
||||
|
||||
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn) {
|
||||
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, bool withAubDump) {
|
||||
return new UltCommandStreamReceiver<GfxFamily>(hwInfoIn);
|
||||
}
|
||||
|
||||
|
44
unit_tests/mocks/mock_tbx_sockets.h
Normal file
44
unit_tests/mocks/mock_tbx_sockets.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/tbx/tbx_sockets.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
class MockTbxSockets : public TbxSockets {
|
||||
public:
|
||||
MockTbxSockets(){};
|
||||
~MockTbxSockets() override = default;
|
||||
|
||||
bool init(const std::string &hostNameOrIp, uint16_t port) override { return true; };
|
||||
void close() override{};
|
||||
|
||||
bool writeGTT(uint32_t gttOffset, uint64_t entry) override { return true; };
|
||||
|
||||
bool readMemory(uint64_t offset, void *data, size_t size) override { return true; };
|
||||
bool writeMemory(uint64_t offset, const void *data, size_t size) override { return true; };
|
||||
|
||||
bool readMMIO(uint32_t offset, uint32_t *data) override { return true; };
|
||||
bool writeMMIO(uint32_t offset, uint32_t data) override { return true; };
|
||||
};
|
||||
} // namespace OCLRT
|
@ -54,13 +54,21 @@ class DeviceCommandStreamLeaksFixture : public DeviceFixture,
|
||||
typedef Test<DeviceCommandStreamLeaksFixture> DeviceCommandStreamLeaksTest;
|
||||
|
||||
HWTEST_F(DeviceCommandStreamLeaksTest, Create) {
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0]));
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false));
|
||||
DrmMockSuccess mockDrm;
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
}
|
||||
|
||||
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenItIsCreateThenGemCloseWorkerInactiveModeIsSelected) {
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0]));
|
||||
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false));
|
||||
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
|
||||
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerInactive);
|
||||
}
|
||||
|
||||
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWithAubDumWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], true));
|
||||
auto drmCsrWithAubDump = (CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *)ptr.get();
|
||||
EXPECT_EQ(drmCsrWithAubDump->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerInactive);
|
||||
auto aubCSR = static_cast<CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *>(ptr.get())->aubCSR;
|
||||
EXPECT_NE(nullptr, aubCSR);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4005)
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
||||
#include "runtime/command_stream/device_command_stream.h"
|
||||
#include "runtime/command_stream/linear_stream.h"
|
||||
@ -133,14 +134,20 @@ typedef ::Test<WddmCommandStreamFixture> WddmCommandStreamTest;
|
||||
typedef ::Test<WddmCommandStreamWithMockGdiFixture> WddmCommandStreamMockGdiTest;
|
||||
typedef ::Test<WddmCommandStreamFixture> WddmDefaultTest;
|
||||
|
||||
TEST(DeviceCommandStreamTest, Create) {
|
||||
auto ptr = DeviceCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>::create(DEFAULT_TEST_PLATFORM::hwInfo);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto wddm = static_cast<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(ptr)->peekWddm();
|
||||
TEST(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)));
|
||||
EXPECT_NE(nullptr, csr);
|
||||
std::unique_ptr<Wddm> wddm(static_cast<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(csr.get())->peekWddm());
|
||||
EXPECT_NE(nullptr, wddm);
|
||||
delete ptr;
|
||||
//wddm still valid
|
||||
delete wddm;
|
||||
}
|
||||
|
||||
TEST(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)));
|
||||
EXPECT_NE(nullptr, csr);
|
||||
std::unique_ptr<Wddm> wddm(static_cast<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(csr.get())->peekWddm());
|
||||
EXPECT_NE(nullptr, wddm);
|
||||
auto aubCSR = static_cast<CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>> *>(csr.get())->aubCSR;
|
||||
EXPECT_NE(nullptr, aubCSR);
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenFlushStampWhenWaitCalledThenWaitForSpecifiedMonitoredFence) {
|
||||
|
@ -34,7 +34,7 @@ namespace OCLRT {
|
||||
|
||||
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
||||
|
||||
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn);
|
||||
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn, bool withAubDump);
|
||||
|
||||
class DriverInfoDeviceTest : public ::testing::Test {
|
||||
public:
|
||||
@ -55,7 +55,7 @@ class DriverInfoDeviceTest : public ::testing::Test {
|
||||
const HardwareInfo *hwInfo;
|
||||
};
|
||||
|
||||
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn) {
|
||||
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn, bool withAubDump) {
|
||||
auto csr = new MockCommandStreamReceiver();
|
||||
OSInterface *osInterface = new OSInterface();
|
||||
DriverInfoDeviceTest::wddmMock = new WddmMock();
|
||||
|
@ -122,7 +122,7 @@ namespace OCLRT {
|
||||
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
||||
}
|
||||
|
||||
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn) {
|
||||
CommandStreamReceiver *createMockCommandStreamReceiver(const HardwareInfo &hwInfoIn, bool withAubDump) {
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user