/* * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "core/execution_environment/execution_environment.h" #include "core/execution_environment/root_device_environment.h" #include "runtime/aub/aub_center.h" #include "runtime/command_stream/aub_command_stream_receiver.h" #include "runtime/command_stream/command_stream_receiver_with_aub_dump.h" namespace NEO { extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[IGFX_MAX_CORE]; template CommandStreamReceiverWithAUBDump::CommandStreamReceiverWithAUBDump(const std::string &baseName, ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex) : BaseCSR(executionEnvironment, rootDeviceIndex) { bool isAubManager = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter && executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter->getAubManager(); bool isTbxMode = CommandStreamReceiverType::CSR_TBX == BaseCSR::getType(); bool createAubCsr = (isAubManager && isTbxMode) ? false : true; if (createAubCsr) { aubCSR.reset(AUBCommandStreamReceiver::create(baseName, false, executionEnvironment, rootDeviceIndex)); UNRECOVERABLE_IF(!aubCSR->initializeTagAllocation()); *aubCSR->getTagAddress() = std::numeric_limits::max(); } } template bool CommandStreamReceiverWithAUBDump::flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) { if (aubCSR) { aubCSR->flush(batchBuffer, allocationsForResidency); aubCSR->setLatestSentTaskCount(BaseCSR::peekLatestSentTaskCount()); } return BaseCSR::flush(batchBuffer, allocationsForResidency); } template void CommandStreamReceiverWithAUBDump::makeNonResident(GraphicsAllocation &gfxAllocation) { auto residencyTaskCount = gfxAllocation.getResidencyTaskCount(this->osContext->getContextId()); BaseCSR::makeNonResident(gfxAllocation); if (aubCSR) { gfxAllocation.updateResidencyTaskCount(residencyTaskCount, this->osContext->getContextId()); aubCSR->makeNonResident(gfxAllocation); } } template AubSubCaptureStatus CommandStreamReceiverWithAUBDump::checkAndActivateAubSubCapture(const MultiDispatchInfo &dispatchInfo) { auto status = BaseCSR::checkAndActivateAubSubCapture(dispatchInfo); if (aubCSR) { status = aubCSR->checkAndActivateAubSubCapture(dispatchInfo); } BaseCSR::programForAubSubCapture(status.wasActiveInPreviousEnqueue, status.isActive); return status; } template void CommandStreamReceiverWithAUBDump::setupContext(OsContext &osContext) { BaseCSR::setupContext(osContext); if (aubCSR) { aubCSR->setupContext(osContext); } } template void CommandStreamReceiverWithAUBDump::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) { if (aubCSR) { aubCSR->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, forcePowerSavingMode); } BaseCSR::waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, forcePowerSavingMode); } template void CommandStreamReceiverWithAUBDump::addAubComment(const char *comment) { if (aubCSR) { aubCSR->addAubComment(comment); } BaseCSR::addAubComment(comment); } } // namespace NEO