2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-04-09 20:43:12 +08:00
|
|
|
* Copyright (C) 2018-2024 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-19 04:17:55 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2021-09-23 06:03:07 +08:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver_simulated_hw.h"
|
2021-05-31 17:28:07 +08:00
|
|
|
#include "shared/source/command_stream/tbx_command_stream_receiver.h"
|
2022-02-22 20:51:29 +08:00
|
|
|
#include "shared/source/command_stream/wait_status.h"
|
2020-10-15 01:22:01 +08:00
|
|
|
#include "shared/source/memory_manager/address_mapper.h"
|
2021-05-13 21:27:50 +08:00
|
|
|
#include "shared/source/memory_manager/page_table.h"
|
2020-10-15 01:22:01 +08:00
|
|
|
|
2019-04-18 18:37:57 +08:00
|
|
|
#include <set>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-10-03 04:42:40 +08:00
|
|
|
class AubSubCaptureManager;
|
2018-11-02 13:28:20 +08:00
|
|
|
class TbxStream;
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
template <typename GfxFamily>
|
2018-09-26 04:47:03 +08:00
|
|
|
class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFamily> {
|
2018-12-03 17:05:36 +08:00
|
|
|
protected:
|
2018-09-26 04:47:03 +08:00
|
|
|
typedef CommandStreamReceiverSimulatedHw<GfxFamily> BaseClass;
|
2018-12-19 20:11:16 +08:00
|
|
|
using AUB = typename AUBFamilyMapper<GfxFamily>::AUB;
|
2022-10-26 19:31:37 +08:00
|
|
|
using BaseClass::forceSkipResourceCleanupRequired;
|
2023-07-27 00:03:49 +08:00
|
|
|
using BaseClass::getParametersForMemory;
|
2018-11-26 21:04:52 +08:00
|
|
|
using BaseClass::osContext;
|
2024-11-20 20:36:45 +08:00
|
|
|
using BaseClass::pollForCompletion;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-02-05 21:53:38 +08:00
|
|
|
uint32_t getMaskAndValueForPollForCompletion() const;
|
|
|
|
bool getpollNotEqualValueForPollForCompletion() const;
|
2024-08-06 20:54:11 +08:00
|
|
|
void flushSubmissionsAndDownloadAllocations(TaskCountType taskCount, bool skipAllocationsDownload);
|
2024-09-09 23:31:32 +08:00
|
|
|
MOCKABLE_VIRTUAL uint64_t getNonBlockingDownloadTimeoutMs() const {
|
|
|
|
return 2000; // 2s
|
|
|
|
}
|
2019-02-05 21:53:38 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
public:
|
2018-11-02 13:28:20 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::initAdditionalMMIO;
|
2019-01-07 21:50:54 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::aubManager;
|
2019-02-07 20:21:58 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::hardwareContextController;
|
2019-03-20 15:55:02 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::engineInfo;
|
2018-11-02 13:28:20 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::stream;
|
2022-04-26 03:34:32 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::peekExecutionEnvironment;
|
2023-10-18 21:54:46 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::writeMemory;
|
2018-11-02 13:28:20 +08:00
|
|
|
|
2022-01-07 22:53:31 +08:00
|
|
|
SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2022-11-22 21:53:59 +08:00
|
|
|
WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) override;
|
|
|
|
WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, TaskCountType taskCountToWait) override;
|
2024-08-28 21:59:25 +08:00
|
|
|
void downloadAllocations(bool blockingWait, TaskCountType taskCount) override;
|
2022-03-29 23:31:51 +08:00
|
|
|
void downloadAllocationTbx(GraphicsAllocation &gfxAllocation);
|
2023-10-31 23:44:14 +08:00
|
|
|
void removeDownloadAllocation(GraphicsAllocation *alloc) override;
|
2019-04-18 18:37:57 +08:00
|
|
|
|
|
|
|
void processEviction() override;
|
2024-08-22 18:25:49 +08:00
|
|
|
SubmissionStatus processResidency(ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
2019-02-15 18:31:47 +08:00
|
|
|
void writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits) override;
|
2023-10-18 21:54:46 +08:00
|
|
|
bool writeMemory(GraphicsAllocation &gfxAllocation, bool isChunkCopy, uint64_t gpuVaChunkOffset, size_t chunkSize) override;
|
2021-02-22 20:02:08 +08:00
|
|
|
void writeMMIO(uint32_t offset, uint32_t value) override;
|
2020-04-02 03:01:39 +08:00
|
|
|
bool expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation) override;
|
2018-03-06 05:16:21 +08:00
|
|
|
|
2021-09-23 03:25:21 +08:00
|
|
|
AubSubCaptureStatus checkAndActivateAubSubCapture(const std::string &kernelName) override;
|
2019-10-03 04:42:40 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
// Family specific version
|
2021-06-21 23:24:14 +08:00
|
|
|
MOCKABLE_VIRTUAL void submitBatchBufferTbx(uint64_t batchBufferGpuAddress, const void *batchBuffer, size_t batchBufferSize, uint32_t memoryBank, uint64_t entryBits, bool overrideRingHead);
|
2024-11-20 20:36:45 +08:00
|
|
|
void pollForCompletion(bool skipTaskCountCheck) override;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-04-15 21:30:29 +08:00
|
|
|
void dumpAllocation(GraphicsAllocation &gfxAllocation) override;
|
|
|
|
|
2020-10-29 22:33:35 +08:00
|
|
|
static CommandStreamReceiver *create(const std::string &baseName,
|
|
|
|
bool withAubDump,
|
|
|
|
ExecutionEnvironment &executionEnvironment,
|
|
|
|
uint32_t rootDeviceIndex,
|
|
|
|
const DeviceBitfield deviceBitfield);
|
|
|
|
|
|
|
|
TbxCommandStreamReceiverHw(ExecutionEnvironment &executionEnvironment,
|
|
|
|
uint32_t rootDeviceIndex,
|
|
|
|
const DeviceBitfield deviceBitfield);
|
2017-12-21 07:45:38 +08:00
|
|
|
~TbxCommandStreamReceiverHw() override;
|
|
|
|
|
2021-10-14 20:49:06 +08:00
|
|
|
void initializeEngine() override;
|
2018-12-19 20:15:14 +08:00
|
|
|
|
2024-12-19 23:09:50 +08:00
|
|
|
MemoryManager *getMemoryManager() {
|
2020-01-21 18:00:03 +08:00
|
|
|
return CommandStreamReceiver::getMemoryManager();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2018-11-02 13:28:20 +08:00
|
|
|
TbxStream tbxStream;
|
2019-10-03 04:42:40 +08:00
|
|
|
std::unique_ptr<AubSubCaptureManager> subCaptureManager;
|
2018-06-06 23:03:46 +08:00
|
|
|
uint32_t aubDeviceId;
|
2018-07-03 23:56:55 +08:00
|
|
|
bool streamInitialized = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-09-21 04:54:19 +08:00
|
|
|
std::unique_ptr<PhysicalAddressAllocator> physicalAddressAllocator;
|
2018-09-27 21:08:57 +08:00
|
|
|
std::unique_ptr<std::conditional<is64bit, PML4, PDPE>::type> ppgtt;
|
2018-09-11 20:45:43 +08:00
|
|
|
std::unique_ptr<PDPE> ggtt;
|
2017-12-21 07:45:38 +08:00
|
|
|
// remap CPU VA -> GGTT VA
|
|
|
|
AddressMapper gttRemap;
|
2018-06-06 16:34:51 +08:00
|
|
|
|
2019-04-18 18:37:57 +08:00
|
|
|
std::set<GraphicsAllocation *> allocationsForDownload = {};
|
|
|
|
|
2022-11-26 00:51:17 +08:00
|
|
|
CommandStreamReceiverType getType() const override {
|
2024-04-09 20:43:12 +08:00
|
|
|
return CommandStreamReceiverType::tbx;
|
2018-06-06 16:34:51 +08:00
|
|
|
}
|
2019-10-03 04:42:40 +08:00
|
|
|
|
|
|
|
bool dumpTbxNonWritable = false;
|
2021-10-14 19:47:16 +08:00
|
|
|
bool isEngineInitialized = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|