diff --git a/CMakeLists.txt b/CMakeLists.txt index b9ef3acf1e..956c476eef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -529,6 +529,7 @@ include_directories(${IGDRCL_SOURCE_DIR}) include_directories(${IGDRCL_BUILD_DIR}) include_directories(${IGDRCL_SOURCE_DIR}/runtime/sku_info/definitions${BRANCH_DIR_SUFFIX}) include_directories(${IGDRCL_SOURCE_DIR}/runtime/os_interface/definitions${BRANCH_DIR_SUFFIX}) +include_directories(${IGDRCL_SOURCE_DIR}/runtime/command_stream/definitions${BRANCH_DIR_SUFFIX}) include_directories(${IGDRCL_SOURCE_DIR}/runtime/gen_common/reg_configs${BRANCH_DIR_SUFFIX}) include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/${BRANCH_DIR_SUFFIX}) include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/client_context${BRANCH_DIR_SUFFIX}) diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.h b/runtime/command_stream/aub_command_stream_receiver_hw.h index b57b780f9b..99ba05035e 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.h +++ b/runtime/command_stream/aub_command_stream_receiver_hw.h @@ -7,7 +7,7 @@ #pragma once #include "runtime/gen_common/aub_mapper.h" -#include "runtime/command_stream/command_stream_receiver_hw.h" +#include "command_stream_receiver_simulated_hw.h" #include "runtime/command_stream/aub_command_stream_receiver.h" #include "runtime/memory_manager/address_mapper.h" #include "runtime/memory_manager/page_table.h" @@ -18,8 +18,8 @@ namespace OCLRT { class AubSubCaptureManager; template -class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw { - typedef CommandStreamReceiverHw BaseClass; +class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw { + typedef CommandStreamReceiverSimulatedHw BaseClass; typedef typename AUBFamilyMapper::AUB AUB; typedef typename AUB::MiContextDescriptorReg MiContextDescriptorReg; using ExternalAllocationsContainer = std::vector; @@ -103,7 +103,6 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw { void getGTTData(void *memory, AubGTTData &data); uint64_t getGTTBits() const; uint32_t getMemoryBankForGtt() const; - uint32_t getMemoryBank(GraphicsAllocation *allocation) const; CommandStreamReceiverType getType() override { return CommandStreamReceiverType::CSR_AUB; diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.inl b/runtime/command_stream/aub_command_stream_receiver_hw.inl index 36539fa669..00a2196ab0 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.inl +++ b/runtime/command_stream/aub_command_stream_receiver_hw.inl @@ -311,7 +311,7 @@ FlushStamp AUBCommandStreamReceiverHw::flush(BatchBuffer &batchBuffer auto physBatchBuffer = ppgtt->map(static_cast(batchBufferGpuAddress), sizeBatchBuffer, getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation), - getMemoryBank(batchBuffer.commandBufferAllocation)); + this->getMemoryBank(batchBuffer.commandBufferAllocation)); AubHelperHw aubHelperHw(this->localMemoryEnabled); AUB::reserveAddressPPGTT(*stream, static_cast(batchBufferGpuAddress), sizeBatchBuffer, physBatchBuffer, getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation), @@ -586,7 +586,7 @@ bool AUBCommandStreamReceiverHw::writeMemory(GraphicsAllocation &gfxA aubHelperHw); }; - ppgtt->pageWalk(static_cast(gpuAddress), size, 0, getPPGTTAdditionalBits(&gfxAllocation), walker, getMemoryBank(&gfxAllocation)); + ppgtt->pageWalk(static_cast(gpuAddress), size, 0, getPPGTTAdditionalBits(&gfxAllocation), walker, this->getMemoryBank(&gfxAllocation)); if (gfxAllocation.isLocked()) { this->getMemoryManager()->unlockResource(&gfxAllocation); @@ -774,11 +774,6 @@ uint32_t AUBCommandStreamReceiverHw::getMemoryBankForGtt() const { return MemoryBanks::getBank(this->deviceIndex); } -template -uint32_t AUBCommandStreamReceiverHw::getMemoryBank(GraphicsAllocation *allocation) const { - return MemoryBanks::getBank(this->deviceIndex); -} - template void AUBCommandStreamReceiverHw::createPhysicalAddressAllocator() { physicalAddressAllocator = std::make_unique(); diff --git a/runtime/command_stream/definitions/command_stream_receiver_simulated_hw.h b/runtime/command_stream/definitions/command_stream_receiver_simulated_hw.h new file mode 100644 index 0000000000..374632d7d1 --- /dev/null +++ b/runtime/command_stream/definitions/command_stream_receiver_simulated_hw.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2018 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once +#include "runtime/command_stream/command_stream_receiver_hw.h" +#include "runtime/memory_manager/memory_banks.h" + +namespace OCLRT { +class GraphicsAllocation; +template +class CommandStreamReceiverSimulatedHw : public CommandStreamReceiverHw { + using CommandStreamReceiverHw::CommandStreamReceiverHw; + + public: + uint32_t getMemoryBank(GraphicsAllocation *allocation) const { + return MemoryBanks::getBank(this->deviceIndex); + } +}; +} // namespace OCLRT diff --git a/runtime/command_stream/tbx_command_stream_receiver_hw.h b/runtime/command_stream/tbx_command_stream_receiver_hw.h index 338fee7160..5d2f445475 100644 --- a/runtime/command_stream/tbx_command_stream_receiver_hw.h +++ b/runtime/command_stream/tbx_command_stream_receiver_hw.h @@ -7,7 +7,7 @@ #pragma once #include "runtime/gen_common/aub_mapper.h" -#include "runtime/command_stream/command_stream_receiver_hw.h" +#include "command_stream_receiver_simulated_hw.h" #include "runtime/command_stream/tbx_command_stream_receiver.h" #include "runtime/memory_manager/address_mapper.h" #include "runtime/memory_manager/os_agnostic_memory_manager.h" @@ -24,9 +24,9 @@ class TbxMemoryManager : public OsAgnosticMemoryManager { }; template -class TbxCommandStreamReceiverHw : public CommandStreamReceiverHw { +class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw { using CommandStreamReceiverHw::memoryManager; - typedef CommandStreamReceiverHw BaseClass; + typedef CommandStreamReceiverSimulatedHw BaseClass; typedef typename OCLRT::AUBFamilyMapper::AUB AUB; typedef typename AUB::MiContextDescriptorReg MiContextDescriptorReg; @@ -75,7 +75,6 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverHw { void getGTTData(void *memory, AubGTTData &data); uint64_t getGTTBits() const; uint32_t getMemoryBankForGtt() const; - uint32_t getMemoryBank(GraphicsAllocation *allocation) const; TbxCommandStreamReceiver::TbxStream stream; uint32_t aubDeviceId; diff --git a/runtime/command_stream/tbx_command_stream_receiver_hw.inl b/runtime/command_stream/tbx_command_stream_receiver_hw.inl index 6fd30cc56b..0cba146968 100644 --- a/runtime/command_stream/tbx_command_stream_receiver_hw.inl +++ b/runtime/command_stream/tbx_command_stream_receiver_hw.inl @@ -203,7 +203,7 @@ FlushStamp TbxCommandStreamReceiverHw::flush(BatchBuffer &batchBuffer { auto physBatchBuffer = ppgtt->map(reinterpret_cast(pBatchBuffer), sizeBatchBuffer, getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation), - getMemoryBank(batchBuffer.commandBufferAllocation)); + this->getMemoryBank(batchBuffer.commandBufferAllocation)); AubHelperHw aubHelperHw(this->localMemoryEnabled); AUB::reserveAddressPPGTT(stream, reinterpret_cast(pBatchBuffer), sizeBatchBuffer, physBatchBuffer, @@ -364,7 +364,7 @@ bool TbxCommandStreamReceiverHw::writeMemory(GraphicsAllocation &gfxA aubHelperHw); }; - ppgtt->pageWalk(static_cast(gpuAddress), size, 0, getPPGTTAdditionalBits(&gfxAllocation), walker, getMemoryBank(&gfxAllocation)); + ppgtt->pageWalk(static_cast(gpuAddress), size, 0, getPPGTTAdditionalBits(&gfxAllocation), walker, this->getMemoryBank(&gfxAllocation)); return true; } @@ -389,7 +389,7 @@ void TbxCommandStreamReceiverHw::makeCoherent(GraphicsAllocation &gfx DEBUG_BREAK_IF(offset > length); stream.readMemory(physAddress, ptrOffset(cpuAddress, offset), size); }; - ppgtt->pageWalk(static_cast(gpuAddress), length, 0, 0, walker, getMemoryBank(&gfxAllocation)); + ppgtt->pageWalk(static_cast(gpuAddress), length, 0, 0, walker, this->getMemoryBank(&gfxAllocation)); } } @@ -429,11 +429,6 @@ uint32_t TbxCommandStreamReceiverHw::getMemoryBankForGtt() const { return MemoryBanks::getBank(this->deviceIndex); } -template -uint32_t TbxCommandStreamReceiverHw::getMemoryBank(GraphicsAllocation *allocation) const { - return MemoryBanks::getBank(this->deviceIndex); -} - template void TbxCommandStreamReceiverHw::createPhysicalAddressAllocator() { physicalAddressAllocator = std::make_unique();