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:
Milczarek, Slawomir
2018-01-19 10:00:51 +01:00
parent 6ab39150e0
commit 7c038eb7a4
41 changed files with 889 additions and 144 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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

View 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);
}

View File

@@ -36,6 +36,6 @@ class DeviceCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
}
public:
static CommandStreamReceiver *create(const HardwareInfo &hwInfo);
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, bool withAubDump);
};
}

View File

@@ -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) {

View 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

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"),
@@ -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>>;
}

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"),
@@ -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>>;
}

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"),
@@ -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>>;
}

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"),
@@ -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>>;
}

View File

@@ -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 {

View File

@@ -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);
}
};
}

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);
DrmCommandStreamReceiver(const HardwareInfo &hwInfoIn, Drm *drm, gemCloseWorkerMode mode = gemCloseWorkerMode::gemCloseWorkerInactive);
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency) override;
void makeResident(GraphicsAllocation &gfxAllocation) override;

View 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;

View File

@@ -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);
}
}
}

View 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>

View File

@@ -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

View 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