mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Create common class for TBX & AUB.
- Move one method there. Change-Id: I96cc0a64e24e4931a8d71a552f5cbf22bf99bfc2
This commit is contained in:

committed by
sys_ocldev

parent
55574fc812
commit
f564792895
@ -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})
|
||||
|
@ -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 <typename GfxFamily>
|
||||
class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
typedef CommandStreamReceiverHw<GfxFamily> BaseClass;
|
||||
class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFamily> {
|
||||
typedef CommandStreamReceiverSimulatedHw<GfxFamily> BaseClass;
|
||||
typedef typename AUBFamilyMapper<GfxFamily>::AUB AUB;
|
||||
typedef typename AUB::MiContextDescriptorReg MiContextDescriptorReg;
|
||||
using ExternalAllocationsContainer = std::vector<AllocationView>;
|
||||
@ -103,7 +103,6 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
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;
|
||||
|
@ -311,7 +311,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
|
||||
auto physBatchBuffer = ppgtt->map(static_cast<uintptr_t>(batchBufferGpuAddress), sizeBatchBuffer,
|
||||
getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation),
|
||||
getMemoryBank(batchBuffer.commandBufferAllocation));
|
||||
this->getMemoryBank(batchBuffer.commandBufferAllocation));
|
||||
AubHelperHw<GfxFamily> aubHelperHw(this->localMemoryEnabled);
|
||||
AUB::reserveAddressPPGTT(*stream, static_cast<uintptr_t>(batchBufferGpuAddress), sizeBatchBuffer, physBatchBuffer,
|
||||
getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation),
|
||||
@ -586,7 +586,7 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
|
||||
aubHelperHw);
|
||||
};
|
||||
|
||||
ppgtt->pageWalk(static_cast<uintptr_t>(gpuAddress), size, 0, getPPGTTAdditionalBits(&gfxAllocation), walker, getMemoryBank(&gfxAllocation));
|
||||
ppgtt->pageWalk(static_cast<uintptr_t>(gpuAddress), size, 0, getPPGTTAdditionalBits(&gfxAllocation), walker, this->getMemoryBank(&gfxAllocation));
|
||||
|
||||
if (gfxAllocation.isLocked()) {
|
||||
this->getMemoryManager()->unlockResource(&gfxAllocation);
|
||||
@ -774,11 +774,6 @@ uint32_t AUBCommandStreamReceiverHw<GfxFamily>::getMemoryBankForGtt() const {
|
||||
return MemoryBanks::getBank(this->deviceIndex);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t AUBCommandStreamReceiverHw<GfxFamily>::getMemoryBank(GraphicsAllocation *allocation) const {
|
||||
return MemoryBanks::getBank(this->deviceIndex);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void AUBCommandStreamReceiverHw<GfxFamily>::createPhysicalAddressAllocator() {
|
||||
physicalAddressAllocator = std::make_unique<PhysicalAddressAllocator>();
|
||||
|
@ -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 <typename GfxFamily>
|
||||
class CommandStreamReceiverSimulatedHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw;
|
||||
|
||||
public:
|
||||
uint32_t getMemoryBank(GraphicsAllocation *allocation) const {
|
||||
return MemoryBanks::getBank(this->deviceIndex);
|
||||
}
|
||||
};
|
||||
} // namespace OCLRT
|
@ -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 <typename GfxFamily>
|
||||
class TbxCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFamily> {
|
||||
using CommandStreamReceiverHw<GfxFamily>::memoryManager;
|
||||
typedef CommandStreamReceiverHw<GfxFamily> BaseClass;
|
||||
typedef CommandStreamReceiverSimulatedHw<GfxFamily> BaseClass;
|
||||
typedef typename OCLRT::AUBFamilyMapper<GfxFamily>::AUB AUB;
|
||||
typedef typename AUB::MiContextDescriptorReg MiContextDescriptorReg;
|
||||
|
||||
@ -75,7 +75,6 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
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;
|
||||
|
@ -203,7 +203,7 @@ FlushStamp TbxCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
{
|
||||
auto physBatchBuffer = ppgtt->map(reinterpret_cast<uintptr_t>(pBatchBuffer), sizeBatchBuffer,
|
||||
getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation),
|
||||
getMemoryBank(batchBuffer.commandBufferAllocation));
|
||||
this->getMemoryBank(batchBuffer.commandBufferAllocation));
|
||||
|
||||
AubHelperHw<GfxFamily> aubHelperHw(this->localMemoryEnabled);
|
||||
AUB::reserveAddressPPGTT(stream, reinterpret_cast<uintptr_t>(pBatchBuffer), sizeBatchBuffer, physBatchBuffer,
|
||||
@ -364,7 +364,7 @@ bool TbxCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
|
||||
aubHelperHw);
|
||||
};
|
||||
|
||||
ppgtt->pageWalk(static_cast<uintptr_t>(gpuAddress), size, 0, getPPGTTAdditionalBits(&gfxAllocation), walker, getMemoryBank(&gfxAllocation));
|
||||
ppgtt->pageWalk(static_cast<uintptr_t>(gpuAddress), size, 0, getPPGTTAdditionalBits(&gfxAllocation), walker, this->getMemoryBank(&gfxAllocation));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ void TbxCommandStreamReceiverHw<GfxFamily>::makeCoherent(GraphicsAllocation &gfx
|
||||
DEBUG_BREAK_IF(offset > length);
|
||||
stream.readMemory(physAddress, ptrOffset(cpuAddress, offset), size);
|
||||
};
|
||||
ppgtt->pageWalk(static_cast<uintptr_t>(gpuAddress), length, 0, 0, walker, getMemoryBank(&gfxAllocation));
|
||||
ppgtt->pageWalk(static_cast<uintptr_t>(gpuAddress), length, 0, 0, walker, this->getMemoryBank(&gfxAllocation));
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,11 +429,6 @@ uint32_t TbxCommandStreamReceiverHw<GfxFamily>::getMemoryBankForGtt() const {
|
||||
return MemoryBanks::getBank(this->deviceIndex);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t TbxCommandStreamReceiverHw<GfxFamily>::getMemoryBank(GraphicsAllocation *allocation) const {
|
||||
return MemoryBanks::getBank(this->deviceIndex);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void TbxCommandStreamReceiverHw<GfxFamily>::createPhysicalAddressAllocator() {
|
||||
physicalAddressAllocator = std::make_unique<PhysicalAddressAllocator>();
|
||||
|
Reference in New Issue
Block a user