Add additional layer for common AUB & TBX stuff.

- Move one function there.
- This layer will cover common functions that are not branch specific.

Change-Id: Ia8a288f8f51647a333a73f35cf999df9f2d5f5b1
This commit is contained in:
Mrozek, Michal
2018-09-25 16:27:29 -07:00
committed by sys_ocldev
parent f564792895
commit 4912f41759
7 changed files with 40 additions and 27 deletions

View File

@@ -22,6 +22,8 @@ set(RUNTIME_SRCS_COMMAND_STREAM
${CMAKE_CURRENT_SOURCE_DIR}/create_command_stream_impl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/create_command_stream_impl.h
${CMAKE_CURRENT_SOURCE_DIR}/csr_definitions.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/command_stream_receiver_simulated_hw.h
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_common_hw.h
${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream.h
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.h

View File

@@ -101,7 +101,6 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
uint32_t getGUCWorkQueueItemHeader(EngineType engineType);
uint64_t getPPGTTAdditionalBits(GraphicsAllocation *gfxAllocation);
void getGTTData(void *memory, AubGTTData &data);
uint64_t getGTTBits() const;
uint32_t getMemoryBankForGtt() const;
CommandStreamReceiverType getType() override {

View File

@@ -154,7 +154,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::initializeEngine(EngineType engineTy
engineInfo.pGlobalHWStatusPage = alignedMalloc(sizeHWSP, alignHWSP);
engineInfo.ggttHWSP = gttRemap.map(engineInfo.pGlobalHWStatusPage, sizeHWSP);
auto physHWSP = ggtt->map(engineInfo.ggttHWSP, sizeHWSP, getGTTBits(), getMemoryBankForGtt());
auto physHWSP = ggtt->map(engineInfo.ggttHWSP, sizeHWSP, this->getGTTBits(), getMemoryBankForGtt());
// Write our GHWSP
{
@@ -185,7 +185,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::initializeEngine(EngineType engineTy
const size_t alignRingBuffer = 0x1000;
engineInfo.pRingBuffer = alignedMalloc(engineInfo.sizeRingBuffer, alignRingBuffer);
engineInfo.ggttRingBuffer = gttRemap.map(engineInfo.pRingBuffer, engineInfo.sizeRingBuffer);
auto physRingBuffer = ggtt->map(engineInfo.ggttRingBuffer, engineInfo.sizeRingBuffer, getGTTBits(), getMemoryBankForGtt());
auto physRingBuffer = ggtt->map(engineInfo.ggttRingBuffer, engineInfo.sizeRingBuffer, this->getGTTBits(), getMemoryBankForGtt());
{
std::ostringstream str;
@@ -213,7 +213,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::initializeEngine(EngineType engineTy
// Write our LRCA
{
engineInfo.ggttLRCA = gttRemap.map(engineInfo.pLRCA, sizeLRCA);
auto lrcAddressPhys = ggtt->map(engineInfo.ggttLRCA, sizeLRCA, getGTTBits(), getMemoryBankForGtt());
auto lrcAddressPhys = ggtt->map(engineInfo.ggttLRCA, sizeLRCA, this->getGTTBits(), getMemoryBankForGtt());
{
std::ostringstream str;
@@ -365,7 +365,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
memset(pTail, 0, sizeToWrap);
// write remaining ring
auto physDumpStart = ggtt->map(ggttTail, sizeToWrap, getGTTBits(), getMemoryBankForGtt());
auto physDumpStart = ggtt->map(ggttTail, sizeToWrap, this->getGTTBits(), getMemoryBankForGtt());
AUB::addMemoryWrite(
*stream,
physDumpStart,
@@ -415,7 +415,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
stream->addComment(str.str().c_str());
}
auto physDumpStart = ggtt->map(ggttDumpStart, dumpLength, getGTTBits(), getMemoryBankForGtt());
auto physDumpStart = ggtt->map(ggttDumpStart, dumpLength, this->getGTTBits(), getMemoryBankForGtt());
AUB::addMemoryWrite(
*stream,
physDumpStart,
@@ -431,7 +431,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
stream->addComment(str.str().c_str());
}
auto physLRCA = ggtt->map(engineInfo.ggttLRCA, sizeof(engineInfo.tailRingBuffer), getGTTBits(), getMemoryBankForGtt());
auto physLRCA = ggtt->map(engineInfo.ggttLRCA, sizeof(engineInfo.tailRingBuffer), this->getGTTBits(), getMemoryBankForGtt());
AUB::addMemoryWrite(
*stream,
physLRCA + 0x101c,
@@ -764,11 +764,6 @@ int AUBCommandStreamReceiverHw<GfxFamily>::getAddressSpaceFromPTEBits(uint64_t e
return AubMemDump::AddressSpaceValues::TraceNonlocal;
}
template <typename GfxFamily>
uint64_t AUBCommandStreamReceiverHw<GfxFamily>::getGTTBits() const {
return 0;
}
template <typename GfxFamily>
uint32_t AUBCommandStreamReceiverHw<GfxFamily>::getMemoryBankForGtt() const {
return MemoryBanks::getBank(this->deviceIndex);

View File

@@ -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 CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw<GfxFamily> {
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw;
public:
uint64_t getGTTBits() const {
return 0u;
}
};
} // namespace OCLRT

View File

@@ -6,14 +6,14 @@
*/
#pragma once
#include "runtime/command_stream/command_stream_receiver_hw.h"
#include "runtime/command_stream/command_stream_receiver_simulated_common_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;
class CommandStreamReceiverSimulatedHw : public CommandStreamReceiverSimulatedCommonHw<GfxFamily> {
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::CommandStreamReceiverSimulatedCommonHw;
public:
uint32_t getMemoryBank(GraphicsAllocation *allocation) const {

View File

@@ -73,7 +73,6 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
}
uint64_t getPPGTTAdditionalBits(GraphicsAllocation *gfxAllocation);
void getGTTData(void *memory, AubGTTData &data);
uint64_t getGTTBits() const;
uint32_t getMemoryBankForGtt() const;
TbxCommandStreamReceiver::TbxStream stream;

View File

@@ -104,7 +104,7 @@ void TbxCommandStreamReceiverHw<GfxFamily>::initializeEngine(EngineType engineTy
const size_t alignHWSP = 0x1000;
engineInfo.pGlobalHWStatusPage = alignedMalloc(sizeHWSP, alignHWSP);
engineInfo.ggttHWSP = gttRemap.map(engineInfo.pGlobalHWStatusPage, sizeHWSP);
auto physHWSP = ggtt->map(engineInfo.ggttHWSP, sizeHWSP, getGTTBits(), getMemoryBankForGtt());
auto physHWSP = ggtt->map(engineInfo.ggttHWSP, sizeHWSP, this->getGTTBits(), getMemoryBankForGtt());
// Write our GHWSP
AubGTTData data = {0};
@@ -129,7 +129,7 @@ void TbxCommandStreamReceiverHw<GfxFamily>::initializeEngine(EngineType engineTy
const size_t alignRCS = 0x1000;
engineInfo.pRCS = alignedMalloc(engineInfo.sizeRCS, alignRCS);
engineInfo.ggttRCS = gttRemap.map(engineInfo.pRCS, engineInfo.sizeRCS);
auto physRCS = ggtt->map(engineInfo.ggttRCS, engineInfo.sizeRCS, getGTTBits(), getMemoryBankForGtt());
auto physRCS = ggtt->map(engineInfo.ggttRCS, engineInfo.sizeRCS, this->getGTTBits(), getMemoryBankForGtt());
AubGTTData data = {0};
getGTTData(reinterpret_cast<void *>(physRCS), data);
@@ -151,7 +151,7 @@ void TbxCommandStreamReceiverHw<GfxFamily>::initializeEngine(EngineType engineTy
// Write our LRCA
{
engineInfo.ggttLRCA = gttRemap.map(engineInfo.pLRCA, sizeLRCA);
auto lrcAddressPhys = ggtt->map(engineInfo.ggttLRCA, sizeLRCA, getGTTBits(), getMemoryBankForGtt());
auto lrcAddressPhys = ggtt->map(engineInfo.ggttLRCA, sizeLRCA, this->getGTTBits(), getMemoryBankForGtt());
AubGTTData data = {0};
getGTTData(reinterpret_cast<void *>(lrcAddressPhys), data);
@@ -241,7 +241,7 @@ FlushStamp TbxCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
auto sizeToWrap = engineInfo.sizeRCS - engineInfo.tailRCS;
memset(pTail, 0, sizeToWrap);
// write remaining ring
auto physDumpStart = ggtt->map(ggttTail, sizeToWrap, getGTTBits(), getMemoryBankForGtt());
auto physDumpStart = ggtt->map(ggttTail, sizeToWrap, this->getGTTBits(), getMemoryBankForGtt());
AUB::addMemoryWrite(
stream,
physDumpStart,
@@ -281,7 +281,7 @@ FlushStamp TbxCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
auto dumpLength = engineInfo.tailRCS - previousTail;
// write RCS
auto physDumpStart = ggtt->map(ggttDumpStart, dumpLength, getGTTBits(), getMemoryBankForGtt());
auto physDumpStart = ggtt->map(ggttDumpStart, dumpLength, this->getGTTBits(), getMemoryBankForGtt());
AUB::addMemoryWrite(
stream,
physDumpStart,
@@ -291,7 +291,7 @@ FlushStamp TbxCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
AubMemDump::DataTypeHintValues::TraceCommandBuffer);
// update the RCS mmio tail in the LRCA
auto physLRCA = ggtt->map(engineInfo.ggttLRCA, sizeof(engineInfo.tailRCS), getGTTBits(), getMemoryBankForGtt());
auto physLRCA = ggtt->map(engineInfo.ggttLRCA, sizeof(engineInfo.tailRCS), this->getGTTBits(), getMemoryBankForGtt());
AUB::addMemoryWrite(
stream,
physLRCA + 0x101c,
@@ -419,11 +419,6 @@ int TbxCommandStreamReceiverHw<GfxFamily>::getAddressSpace(int hint) {
return AubMemDump::AddressSpaceValues::TraceNonlocal;
}
template <typename GfxFamily>
uint64_t TbxCommandStreamReceiverHw<GfxFamily>::getGTTBits() const {
return 0;
}
template <typename GfxFamily>
uint32_t TbxCommandStreamReceiverHw<GfxFamily>::getMemoryBankForGtt() const {
return MemoryBanks::getBank(this->deviceIndex);