2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2024-04-09 12:43:12 +00:00
|
|
|
* Copyright (C) 2018-2024 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
|
2021-09-22 22:03:07 +00:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver_simulated_hw.h"
|
2022-11-18 14:38:56 +00:00
|
|
|
#include "shared/source/memory_manager/residency_container.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2023-01-24 12:14:14 +00:00
|
|
|
class PDPE;
|
|
|
|
|
class PML4;
|
2018-06-12 20:33:03 +02:00
|
|
|
|
|
|
|
|
class AubSubCaptureManager;
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
template <typename GfxFamily>
|
2018-09-25 13:47:03 -07:00
|
|
|
class AUBCommandStreamReceiverHw : 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-08-17 13:38:09 +02:00
|
|
|
using ExternalAllocationsContainer = std::vector<AllocationView>;
|
2023-07-26 16:03:49 +00:00
|
|
|
using BaseClass::getParametersForMemory;
|
2018-11-26 14:04:52 +01:00
|
|
|
using BaseClass::osContext;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
public:
|
2022-04-25 19:34:32 +00:00
|
|
|
using BaseClass::peekExecutionEnvironment;
|
2018-11-01 22:28:20 -07:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::initAdditionalMMIO;
|
2019-01-07 14:50:54 +01:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::aubManager;
|
2019-02-07 13:21:58 +01:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::hardwareContextController;
|
2019-03-20 08:55:02 +01:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::engineInfo;
|
2018-11-01 22:28:20 -07:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::stream;
|
2023-10-18 13:54:46 +00:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::writeMemory;
|
2018-11-01 22:28:20 -07:00
|
|
|
|
2022-01-07 14:53:31 +00:00
|
|
|
SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2024-08-22 10:25:49 +00:00
|
|
|
SubmissionStatus processResidency(ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
2018-06-12 20:33:03 +02:00
|
|
|
|
2018-08-17 13:38:09 +02:00
|
|
|
void makeResidentExternal(AllocationView &allocationView);
|
|
|
|
|
void makeNonResidentExternal(uint64_t gpuAddress);
|
|
|
|
|
|
2018-11-01 22:28:20 -07:00
|
|
|
AubMemDump::AubFileStream *getAubStream() const {
|
|
|
|
|
return static_cast<AubMemDump::AubFileStream *>(this->stream);
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-15 11:31:47 +01:00
|
|
|
void writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits) override;
|
2023-10-18 13:54:46 +00:00
|
|
|
bool writeMemory(GraphicsAllocation &gfxAllocation, bool isChunkCopy, uint64_t gpuVaChunkOffset, size_t chunkSize) override;
|
2018-08-17 13:38:09 +02:00
|
|
|
MOCKABLE_VIRTUAL bool writeMemory(AllocationView &allocationView);
|
2021-02-22 12:02:08 +00:00
|
|
|
void writeMMIO(uint32_t offset, uint32_t value) override;
|
2018-09-23 21:42:07 -07:00
|
|
|
void expectMMIO(uint32_t mmioRegister, uint32_t expectedValue);
|
2020-03-19 13:48:13 +01:00
|
|
|
bool expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation) override;
|
2018-01-10 22:03:23 +01:00
|
|
|
|
2021-09-22 19:25:21 +00:00
|
|
|
AubSubCaptureStatus checkAndActivateAubSubCapture(const std::string &kernelName) override;
|
2019-04-01 09:33:19 +02:00
|
|
|
void addAubComment(const char *message) override;
|
2018-06-12 20:33:03 +02:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
// Family specific version
|
2021-06-21 15:24:14 +00:00
|
|
|
MOCKABLE_VIRTUAL void submitBatchBufferAub(uint64_t batchBufferGpuAddress, const void *batchBuffer, size_t batchBufferSize, uint32_t memoryBank, uint64_t entryBits);
|
2019-02-11 09:04:16 +01:00
|
|
|
void pollForCompletion() override;
|
|
|
|
|
void pollForCompletionImpl() override;
|
2022-11-22 13:53:59 +00:00
|
|
|
WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) override;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-10-30 11:08:09 -07:00
|
|
|
uint32_t getDumpHandle();
|
2018-10-19 11:32:05 -07:00
|
|
|
MOCKABLE_VIRTUAL void addContextToken(uint32_t dumpHandle);
|
2020-04-15 15:30:29 +02:00
|
|
|
void dumpAllocation(GraphicsAllocation &gfxAllocation) override;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2020-10-28 16:08:37 +01:00
|
|
|
static CommandStreamReceiver *create(const std::string &fileName,
|
|
|
|
|
bool standalone,
|
|
|
|
|
ExecutionEnvironment &executionEnvironment,
|
|
|
|
|
uint32_t rootDeviceIndex,
|
2020-10-29 15:33:35 +01:00
|
|
|
const DeviceBitfield deviceBitfield);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2020-10-29 15:33:35 +01:00
|
|
|
AUBCommandStreamReceiverHw(const std::string &fileName,
|
|
|
|
|
bool standalone,
|
|
|
|
|
ExecutionEnvironment &executionEnvironment,
|
|
|
|
|
uint32_t rootDeviceIndex,
|
|
|
|
|
const DeviceBitfield deviceBitfield);
|
2017-12-21 00:45:38 +01:00
|
|
|
~AUBCommandStreamReceiverHw() override;
|
|
|
|
|
|
2018-01-19 10:00:51 +01:00
|
|
|
AUBCommandStreamReceiverHw(const AUBCommandStreamReceiverHw &) = delete;
|
|
|
|
|
AUBCommandStreamReceiverHw &operator=(const AUBCommandStreamReceiverHw &) = delete;
|
|
|
|
|
|
2018-09-20 00:36:44 +02:00
|
|
|
MOCKABLE_VIRTUAL void openFile(const std::string &fileName);
|
|
|
|
|
MOCKABLE_VIRTUAL bool reopenFile(const std::string &fileName);
|
2018-07-09 11:31:36 +02:00
|
|
|
MOCKABLE_VIRTUAL void initFile(const std::string &fileName);
|
|
|
|
|
MOCKABLE_VIRTUAL void closeFile();
|
2018-10-02 10:37:17 +02:00
|
|
|
MOCKABLE_VIRTUAL bool isFileOpen() const;
|
2019-02-19 22:50:52 +01:00
|
|
|
MOCKABLE_VIRTUAL const std::string getFileName();
|
2018-07-09 11:31:36 +02:00
|
|
|
|
2022-05-09 17:40:30 +00:00
|
|
|
void initializeEngine() override;
|
2019-06-03 09:57:27 +02:00
|
|
|
std::unique_ptr<AubSubCaptureManager> subCaptureManager;
|
2018-06-06 17:03:46 +02:00
|
|
|
uint32_t aubDeviceId;
|
2018-01-19 10:00:51 +01:00
|
|
|
bool standalone;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
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
|
2018-10-02 10:37:17 +02:00
|
|
|
AddressMapper *gttRemap;
|
2018-02-28 22:50:41 +01:00
|
|
|
|
2018-03-14 11:07:51 +01:00
|
|
|
MOCKABLE_VIRTUAL bool addPatchInfoComments();
|
2019-01-29 11:48:54 +01:00
|
|
|
void addGUCStartMessage(uint64_t batchBufferAddress);
|
|
|
|
|
uint32_t getGUCWorkQueueItemHeader();
|
2018-06-06 10:34:51 +02:00
|
|
|
|
2022-11-25 16:51:17 +00:00
|
|
|
CommandStreamReceiverType getType() const override {
|
2024-04-09 12:43:12 +00:00
|
|
|
return CommandStreamReceiverType::aub;
|
2018-06-06 10:34:51 +02:00
|
|
|
}
|
2018-07-09 11:31:36 +02:00
|
|
|
|
2018-09-20 19:33:21 -07:00
|
|
|
int getAddressSpaceFromPTEBits(uint64_t entryBits) const;
|
|
|
|
|
|
2018-07-09 11:31:36 +02:00
|
|
|
protected:
|
2019-01-25 09:27:11 +01:00
|
|
|
constexpr static uint32_t getMaskAndValueForPollForCompletion();
|
|
|
|
|
|
2018-07-09 11:31:36 +02:00
|
|
|
bool dumpAubNonWritable = false;
|
2021-10-14 11:47:16 +00:00
|
|
|
bool isEngineInitialized = false;
|
2018-08-17 13:38:09 +02:00
|
|
|
ExternalAllocationsContainer externalAllocations;
|
2019-01-29 10:39:34 +01:00
|
|
|
|
2022-11-22 13:53:59 +00:00
|
|
|
TaskCountType pollForCompletionTaskCount = 0u;
|
2019-01-29 10:39:34 +01:00
|
|
|
SpinLock pollForCompletionLock;
|
2017-12-21 00:45:38 +01:00
|
|
|
};
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|