2018-01-19 17:00:51 +08:00
|
|
|
/*
|
2019-01-10 16:37:56 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-01-19 17:00:51 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-01-19 17:00:51 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-02-06 00:38:57 +08:00
|
|
|
#include "runtime/aub/aub_center.h"
|
2018-01-19 17:00:51 +08:00
|
|
|
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
|
|
|
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
|
|
|
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
|
|
|
|
|
|
|
template <typename BaseCSR>
|
2019-02-06 00:38:57 +08:00
|
|
|
CommandStreamReceiverWithAUBDump<BaseCSR>::CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn, const std::string &baseName, ExecutionEnvironment &executionEnvironment)
|
2018-08-30 15:27:47 +08:00
|
|
|
: BaseCSR(hwInfoIn, executionEnvironment) {
|
2019-02-06 00:38:57 +08:00
|
|
|
bool createAubCsr = !executionEnvironment.aubCenter || executionEnvironment.aubCenter->getAubManager() == nullptr;
|
|
|
|
|
|
|
|
if (createAubCsr) {
|
2019-02-11 23:49:23 +08:00
|
|
|
aubCSR.reset(AUBCommandStreamReceiver::create(hwInfoIn, baseName, false, executionEnvironment));
|
2019-02-06 00:38:57 +08:00
|
|
|
}
|
2018-01-19 17:00:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename BaseCSR>
|
2018-11-26 21:04:52 +08:00
|
|
|
FlushStamp CommandStreamReceiverWithAUBDump<BaseCSR>::flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) {
|
2018-01-19 17:00:51 +08:00
|
|
|
if (aubCSR) {
|
2018-11-26 21:04:52 +08:00
|
|
|
aubCSR->flush(batchBuffer, allocationsForResidency);
|
2018-01-19 17:00:51 +08:00
|
|
|
}
|
2018-11-26 21:04:52 +08:00
|
|
|
FlushStamp flushStamp = BaseCSR::flush(batchBuffer, allocationsForResidency);
|
2018-01-19 17:00:51 +08:00
|
|
|
return flushStamp;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename BaseCSR>
|
2018-09-28 01:55:09 +08:00
|
|
|
void CommandStreamReceiverWithAUBDump<BaseCSR>::makeNonResident(GraphicsAllocation &gfxAllocation) {
|
2018-12-18 21:02:08 +08:00
|
|
|
auto residencyTaskCount = gfxAllocation.getResidencyTaskCount(this->osContext->getContextId());
|
2018-09-28 01:55:09 +08:00
|
|
|
BaseCSR::makeNonResident(gfxAllocation);
|
2018-12-03 17:05:36 +08:00
|
|
|
gfxAllocation.updateResidencyTaskCount(residencyTaskCount, this->osContext->getContextId());
|
2018-09-28 01:55:09 +08:00
|
|
|
if (aubCSR) {
|
|
|
|
aubCSR->makeNonResident(gfxAllocation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-13 02:33:03 +08:00
|
|
|
template <typename BaseCSR>
|
|
|
|
void CommandStreamReceiverWithAUBDump<BaseCSR>::activateAubSubCapture(const MultiDispatchInfo &dispatchInfo) {
|
|
|
|
BaseCSR::activateAubSubCapture(dispatchInfo);
|
|
|
|
if (aubCSR) {
|
|
|
|
aubCSR->activateAubSubCapture(dispatchInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-28 20:00:53 +08:00
|
|
|
template <typename BaseCSR>
|
2019-01-10 16:37:56 +08:00
|
|
|
void CommandStreamReceiverWithAUBDump<BaseCSR>::setupContext(OsContext &osContext) {
|
|
|
|
BaseCSR::setupContext(osContext);
|
2018-11-28 20:00:53 +08:00
|
|
|
if (aubCSR) {
|
2019-01-10 16:37:56 +08:00
|
|
|
aubCSR->setupContext(osContext);
|
2018-11-28 20:00:53 +08:00
|
|
|
}
|
|
|
|
}
|
2018-01-19 17:00:51 +08:00
|
|
|
} // namespace OCLRT
|