2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2018-09-18 13:17:55 -07:00
|
|
|
* Copyright (C) 2017-2018 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 13:17:55 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "runtime/gen_common/aub_mapper.h"
|
2018-09-25 13:47:03 -07:00
|
|
|
#include "command_stream_receiver_simulated_hw.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
#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"
|
|
|
|
|
#include "runtime/memory_manager/page_table.h"
|
|
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
|
2018-11-01 22:28:20 -07:00
|
|
|
class TbxStream;
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
class TbxMemoryManager : public OsAgnosticMemoryManager {
|
|
|
|
|
public:
|
2018-10-01 16:10:54 +02:00
|
|
|
TbxMemoryManager(bool enable64kbPages, bool enableLocalMemory, ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(enable64kbPages, enableLocalMemory, executionEnvironment) {}
|
2017-12-21 00:45:38 +01:00
|
|
|
uint64_t getSystemSharedMemory() override {
|
|
|
|
|
return 1 * GB;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2018-09-25 13:47:03 -07:00
|
|
|
class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFamily> {
|
2018-12-03 10:05:36 +01:00
|
|
|
protected:
|
2018-09-25 13:47:03 -07:00
|
|
|
typedef CommandStreamReceiverSimulatedHw<GfxFamily> BaseClass;
|
2018-12-19 13:11:16 +01:00
|
|
|
using AUB = typename AUBFamilyMapper<GfxFamily>::AUB;
|
2018-11-26 14:04:52 +01:00
|
|
|
using BaseClass::osContext;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
public:
|
2018-11-01 22:28:20 -07:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::initAdditionalMMIO;
|
|
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::stream;
|
|
|
|
|
|
2018-11-26 14:04:52 +01:00
|
|
|
FlushStamp flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
2018-04-03 12:23:14 +02:00
|
|
|
void makeCoherent(GraphicsAllocation &gfxAllocation) override;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-11-26 14:04:52 +01:00
|
|
|
void processResidency(ResidencyContainer &allocationsForResidency) override;
|
2018-08-02 15:17:58 +02:00
|
|
|
void waitBeforeMakingNonResidentWhenRequired() override;
|
2018-03-05 22:16:21 +01:00
|
|
|
bool writeMemory(GraphicsAllocation &gfxAllocation);
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
// Family specific version
|
2018-12-07 11:34:51 +01:00
|
|
|
void pollForCompletion(EngineInstanceT engineInstance);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-08-08 13:49:09 +02:00
|
|
|
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-08-30 09:27:47 +02:00
|
|
|
TbxCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment);
|
2017-12-21 00:45:38 +01:00
|
|
|
~TbxCommandStreamReceiverHw() override;
|
|
|
|
|
|
2018-12-07 11:34:51 +01:00
|
|
|
void initializeEngine(EngineInstanceT engineInstance);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
struct EngineInfo {
|
|
|
|
|
void *pLRCA;
|
|
|
|
|
uint32_t ggttLRCA;
|
|
|
|
|
void *pGlobalHWStatusPage;
|
|
|
|
|
uint32_t ggttHWSP;
|
|
|
|
|
void *pRCS;
|
|
|
|
|
uint32_t ggttRCS;
|
|
|
|
|
size_t sizeRCS;
|
|
|
|
|
uint32_t tailRCS;
|
|
|
|
|
} engineInfoTable[EngineType::NUM_ENGINES];
|
|
|
|
|
|
2018-09-06 10:53:35 +02:00
|
|
|
MemoryManager *createMemoryManager(bool enable64kbPages, bool enableLocalMemory) override {
|
2018-10-11 11:19:49 +02:00
|
|
|
return new TbxMemoryManager(enable64kbPages, enableLocalMemory, this->executionEnvironment);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
TbxMemoryManager *getMemoryManager() {
|
|
|
|
|
return (TbxMemoryManager *)CommandStreamReceiver::getMemoryManager();
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-01 22:28:20 -07:00
|
|
|
TbxStream tbxStream;
|
|
|
|
|
|
2018-06-06 17:03:46 +02:00
|
|
|
uint32_t aubDeviceId;
|
2018-07-03 17:56:55 +02:00
|
|
|
bool streamInitialized = false;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-09-20 13:54:19 -07:00
|
|
|
std::unique_ptr<PhysicalAddressAllocator> physicalAddressAllocator;
|
2018-09-27 15:08:57 +02:00
|
|
|
std::unique_ptr<std::conditional<is64bit, PML4, PDPE>::type> ppgtt;
|
2018-09-11 14:45:43 +02:00
|
|
|
std::unique_ptr<PDPE> ggtt;
|
2017-12-21 00:45:38 +01:00
|
|
|
// remap CPU VA -> GGTT VA
|
|
|
|
|
AddressMapper gttRemap;
|
2018-06-06 10:34:51 +02:00
|
|
|
|
|
|
|
|
CommandStreamReceiverType getType() override {
|
|
|
|
|
return CommandStreamReceiverType::CSR_TBX;
|
|
|
|
|
}
|
2017-12-21 00:45:38 +01:00
|
|
|
};
|
|
|
|
|
} // namespace OCLRT
|