2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2022-01-07 14:53:31 +00:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-19 20:54:29 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/aub_subcapture_status.h"
|
|
|
|
|
#include "shared/source/command_stream/csr_definitions.h"
|
2021-05-31 12:04:57 +00:00
|
|
|
#include "shared/source/command_stream/csr_properties_flags.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
2021-08-27 15:23:29 +00:00
|
|
|
#include "shared/source/command_stream/stream_properties.h"
|
2022-01-07 14:53:31 +00:00
|
|
|
#include "shared/source/command_stream/submission_status.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/submissions_aggregator.h"
|
|
|
|
|
#include "shared/source/command_stream/thread_arbitration_policy.h"
|
|
|
|
|
#include "shared/source/helpers/aligned_memory.h"
|
|
|
|
|
#include "shared/source/helpers/blit_commands_helper.h"
|
2020-10-28 16:08:37 +01:00
|
|
|
#include "shared/source/helpers/common_types.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/completion_stamp.h"
|
|
|
|
|
#include "shared/source/helpers/flat_batch_buffer_helper.h"
|
|
|
|
|
#include "shared/source/helpers/options.h"
|
2021-12-22 14:11:05 +00:00
|
|
|
#include "shared/source/helpers/pipe_control_args.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/indirect_heap/indirect_heap.h"
|
|
|
|
|
#include "shared/source/kernel/grf_config.h"
|
2020-06-17 11:31:08 +02:00
|
|
|
#include "shared/source/os_interface/os_thread.h"
|
2020-11-06 13:01:29 +01:00
|
|
|
#include "shared/source/utilities/spinlock.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2022-01-20 16:56:19 +00:00
|
|
|
#include <chrono>
|
2017-12-21 00:45:38 +01:00
|
|
|
#include <cstddef>
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2018-10-29 12:26:58 +00:00
|
|
|
class AllocationsList;
|
2017-12-21 00:45:38 +01:00
|
|
|
class Device;
|
2018-10-22 15:17:32 +02:00
|
|
|
class ExecutionEnvironment;
|
2018-07-05 11:23:28 +02:00
|
|
|
class ExperimentalCommandBuffer;
|
2018-10-22 15:17:32 +02:00
|
|
|
class GmmPageTableMngr;
|
2018-07-05 11:23:28 +02:00
|
|
|
class GraphicsAllocation;
|
2018-10-29 10:38:53 +01:00
|
|
|
class HostPtrSurface;
|
2018-04-17 13:50:50 +02:00
|
|
|
class IndirectHeap;
|
2018-10-22 15:17:32 +02:00
|
|
|
class InternalAllocationStorage;
|
2018-07-05 11:23:28 +02:00
|
|
|
class LinearStream;
|
2017-12-21 00:45:38 +01:00
|
|
|
class MemoryManager;
|
2021-02-25 09:38:48 +01:00
|
|
|
class MultiGraphicsAllocation;
|
2018-08-27 15:48:29 +02:00
|
|
|
class OsContext;
|
2018-10-22 15:17:32 +02:00
|
|
|
class OSInterface;
|
2018-11-22 15:16:20 +01:00
|
|
|
class ScratchSpaceController;
|
2021-03-24 18:21:13 +00:00
|
|
|
class HwPerfCounter;
|
|
|
|
|
class HwTimeStamps;
|
|
|
|
|
class TagAllocatorBase;
|
2020-09-15 09:33:12 +02:00
|
|
|
|
|
|
|
|
template <typename TSize>
|
2021-03-22 15:14:49 +00:00
|
|
|
class TimestampPackets;
|
2018-11-27 13:07:41 +01:00
|
|
|
|
|
|
|
|
template <typename T1>
|
|
|
|
|
class TagAllocator;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-04-04 11:34:46 +02:00
|
|
|
enum class DispatchMode {
|
|
|
|
|
DeviceDefault = 0, //default for given device
|
|
|
|
|
ImmediateDispatch, //everything is submitted to the HW immediately
|
|
|
|
|
AdaptiveDispatch, //dispatching is handled to async thread, which combines batch buffers basing on load (not implemented)
|
|
|
|
|
BatchedDispatchWithCounter, //dispatching is batched, after n commands there is implicit flush (not implemented)
|
|
|
|
|
BatchedDispatch // dispatching is batched, explicit clFlush is required
|
|
|
|
|
};
|
|
|
|
|
|
2022-01-20 16:56:19 +00:00
|
|
|
enum class WaitStatus {
|
|
|
|
|
NotReady = 0,
|
|
|
|
|
Ready = 1,
|
|
|
|
|
GpuHang = 2,
|
|
|
|
|
};
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
class CommandStreamReceiver {
|
|
|
|
|
public:
|
2018-01-10 14:05:34 +01:00
|
|
|
enum class SamplerCacheFlushState {
|
|
|
|
|
samplerCacheFlushNotRequired,
|
|
|
|
|
samplerCacheFlushBefore, //add sampler cache flush before Walker with redescribed image
|
|
|
|
|
samplerCacheFlushAfter //add sampler cache flush after Walker with redescribed image
|
|
|
|
|
};
|
2020-04-30 17:12:01 +02:00
|
|
|
|
2018-08-06 14:55:04 +02:00
|
|
|
using MutexType = std::recursive_mutex;
|
2020-10-29 15:33:35 +01:00
|
|
|
CommandStreamReceiver(ExecutionEnvironment &executionEnvironment,
|
|
|
|
|
uint32_t rootDeviceIndex,
|
|
|
|
|
const DeviceBitfield deviceBitfield);
|
2017-12-21 00:45:38 +01:00
|
|
|
virtual ~CommandStreamReceiver();
|
|
|
|
|
|
2022-01-07 14:53:31 +00:00
|
|
|
virtual SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) = 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
virtual CompletionStamp flushTask(LinearStream &commandStream, size_t commandStreamStart,
|
2018-04-17 13:50:50 +02:00
|
|
|
const IndirectHeap &dsh, const IndirectHeap &ioh, const IndirectHeap &ssh,
|
2018-08-01 10:01:41 +02:00
|
|
|
uint32_t taskLevel, DispatchFlags &dispatchFlags, Device &device) = 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-11-24 14:50:41 +01:00
|
|
|
virtual bool flushBatchedSubmissions() = 0;
|
2022-01-07 14:53:31 +00:00
|
|
|
MOCKABLE_VIRTUAL SubmissionStatus submitBatchBuffer(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency);
|
2021-10-01 18:19:37 +00:00
|
|
|
virtual void pollForCompletion() {}
|
2020-05-22 18:11:28 +02:00
|
|
|
virtual void programHardwareContext(LinearStream &cmdStream) = 0;
|
2020-05-27 15:30:31 +02:00
|
|
|
virtual size_t getCmdsSizeForHardwareContext() const = 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-05-14 16:46:50 +00:00
|
|
|
void makeResident(MultiGraphicsAllocation &gfxAllocation);
|
2019-12-03 18:22:29 +01:00
|
|
|
MOCKABLE_VIRTUAL void makeResident(GraphicsAllocation &gfxAllocation);
|
2017-12-21 00:45:38 +01:00
|
|
|
virtual void makeNonResident(GraphicsAllocation &gfxAllocation);
|
2019-04-15 08:54:38 +02:00
|
|
|
MOCKABLE_VIRTUAL void makeSurfacePackNonResident(ResidencyContainer &allocationsForResidency);
|
2020-02-03 17:50:53 +01:00
|
|
|
virtual void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {}
|
2018-11-26 14:04:52 +01:00
|
|
|
virtual void processEviction();
|
2018-02-08 22:52:58 +01:00
|
|
|
void makeResidentHostPtrAllocation(GraphicsAllocation *gfxAllocation);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2020-09-30 16:58:20 +02:00
|
|
|
MOCKABLE_VIRTUAL void ensureCommandBufferAllocation(LinearStream &commandStream, size_t minimumRequiredSize, size_t additionalAllocationSize);
|
2019-02-20 10:31:32 +01:00
|
|
|
|
2018-10-11 11:19:49 +02:00
|
|
|
MemoryManager *getMemoryManager() const;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-09-11 11:19:21 +02:00
|
|
|
ResidencyContainer &getResidencyAllocations();
|
2018-09-12 10:44:35 +02:00
|
|
|
ResidencyContainer &getEvictionAllocations();
|
2018-09-11 11:19:21 +02:00
|
|
|
|
2018-08-17 13:38:09 +02:00
|
|
|
virtual GmmPageTableMngr *createPageTableManager() { return nullptr; }
|
2021-10-06 12:42:30 +00:00
|
|
|
bool needsPageTableManager() const;
|
2018-08-17 13:38:09 +02:00
|
|
|
|
2021-10-21 01:29:53 +02:00
|
|
|
MOCKABLE_VIRTUAL void waitForTaskCount(uint32_t requiredTaskCount);
|
2019-12-17 10:35:25 +01:00
|
|
|
void waitForTaskCountAndCleanAllocationList(uint32_t requiredTaskCount, uint32_t allocationUsage);
|
|
|
|
|
MOCKABLE_VIRTUAL void waitForTaskCountAndCleanTemporaryAllocationList(uint32_t requiredTaskCount);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
LinearStream &getCS(size_t minRequiredSize = 1024u);
|
2020-02-03 13:24:53 +01:00
|
|
|
OSInterface *getOSInterface() const;
|
2019-08-19 10:55:35 +02:00
|
|
|
ExecutionEnvironment &peekExecutionEnvironment() const { return executionEnvironment; };
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL void setTagAllocation(GraphicsAllocation *allocation);
|
2018-04-03 12:23:14 +02:00
|
|
|
GraphicsAllocation *getTagAllocation() const {
|
|
|
|
|
return tagAllocation;
|
|
|
|
|
}
|
2021-02-25 09:38:48 +01:00
|
|
|
MultiGraphicsAllocation *getTagsMultiAllocation() const {
|
|
|
|
|
return tagsMultiAllocation;
|
|
|
|
|
}
|
2021-03-11 14:23:53 +00:00
|
|
|
MultiGraphicsAllocation &createTagsMultiAllocation();
|
2021-10-19 19:28:05 +00:00
|
|
|
volatile uint32_t *getTagAddress() const { return tagAddress; }
|
2020-04-30 17:12:01 +02:00
|
|
|
uint64_t getDebugPauseStateGPUAddress() const { return tagAllocation->getGpuAddress() + debugPauseStateAddressOffset; }
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-09-17 13:05:26 +00:00
|
|
|
virtual bool waitForFlushStamp(FlushStamp &flushStampToWait) { return true; };
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
uint32_t peekTaskCount() const { return taskCount; }
|
|
|
|
|
|
|
|
|
|
uint32_t peekTaskLevel() const { return taskLevel; }
|
2019-07-10 07:57:54 +02:00
|
|
|
FlushStamp obtainCurrentFlushStamp() const;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
uint32_t peekLatestSentTaskCount() const { return latestSentTaskCount; }
|
|
|
|
|
|
|
|
|
|
uint32_t peekLatestFlushedTaskCount() const { return latestFlushedTaskCount; }
|
|
|
|
|
|
2018-04-26 11:43:47 +02:00
|
|
|
void enableNTo1SubmissionModel() { this->nTo1SubmissionModelEnabled = true; }
|
|
|
|
|
bool isNTo1SubmissionModelEnabled() const { return this->nTo1SubmissionModelEnabled; }
|
2018-04-04 11:34:46 +02:00
|
|
|
void overrideDispatchPolicy(DispatchMode overrideValue) { this->dispatchMode = overrideValue; }
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-12-13 11:06:28 +01:00
|
|
|
void setMediaVFEStateDirty(bool dirty) { mediaVfeStateDirty = dirty; }
|
2021-01-15 20:18:38 +05:30
|
|
|
bool getMediaVFEStateDirty() { return mediaVfeStateDirty; }
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-02-04 22:02:23 +05:30
|
|
|
void setGSBAStateDirty(bool dirty) { GSBAStateDirty = dirty; }
|
|
|
|
|
bool getGSBAStateDirty() { return GSBAStateDirty; }
|
|
|
|
|
|
2019-06-28 09:37:04 +02:00
|
|
|
void setRequiredScratchSizes(uint32_t newRequiredScratchSize, uint32_t newRequiredPrivateScratchSize);
|
2018-11-22 15:16:20 +01:00
|
|
|
GraphicsAllocation *getScratchAllocation();
|
2018-11-27 13:07:41 +01:00
|
|
|
GraphicsAllocation *getDebugSurfaceAllocation() const { return debugSurface; }
|
2018-03-21 12:58:30 +01:00
|
|
|
GraphicsAllocation *allocateDebugSurface(size_t size);
|
2019-06-27 21:33:05 +02:00
|
|
|
GraphicsAllocation *getPreemptionAllocation() const { return preemptionAllocation; }
|
2020-05-22 18:11:28 +02:00
|
|
|
GraphicsAllocation *getGlobalFenceAllocation() const { return globalFenceAllocation; }
|
2021-02-16 17:04:00 +00:00
|
|
|
GraphicsAllocation *getWorkPartitionAllocation() const { return workPartitionAllocation; }
|
2019-11-12 13:59:37 +01:00
|
|
|
|
2021-11-06 01:42:54 +00:00
|
|
|
void requestStallingCommandsOnNextFlush() { stallingCommandsOnNextFlushRequired = true; }
|
|
|
|
|
bool isStallingCommandsOnNextFlushRequired() const { return stallingCommandsOnNextFlushRequired; }
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2022-01-20 16:56:19 +00:00
|
|
|
virtual WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) = 0;
|
|
|
|
|
virtual WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait);
|
|
|
|
|
WaitStatus baseWaitFunction(volatile uint32_t *pollAddress, bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait);
|
2022-02-16 10:22:03 +00:00
|
|
|
MOCKABLE_VIRTUAL bool testTaskCountReady(volatile uint32_t *pollAddress, uint32_t taskCountToWait);
|
2020-05-13 11:25:29 +02:00
|
|
|
virtual void downloadAllocations(){};
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-01-10 14:05:34 +01:00
|
|
|
void setSamplerCacheFlushRequired(SamplerCacheFlushState value) { this->samplerCacheFlushRequired = value; }
|
|
|
|
|
|
2018-11-27 13:07:41 +01:00
|
|
|
FlatBatchBufferHelper &getFlatBatchBufferHelper() const { return *flatBatchBufferHelper; }
|
2018-04-04 11:34:46 +02:00
|
|
|
void overwriteFlatBatchBufferHelper(FlatBatchBufferHelper *newHelper) { flatBatchBufferHelper.reset(newHelper); }
|
2018-03-14 11:07:51 +01:00
|
|
|
|
2018-06-12 20:33:03 +02:00
|
|
|
MOCKABLE_VIRTUAL void initProgrammingFlags();
|
2021-09-22 19:25:21 +00:00
|
|
|
virtual AubSubCaptureStatus checkAndActivateAubSubCapture(const std::string &kernelName);
|
2019-06-03 09:57:27 +02:00
|
|
|
void programForAubSubCapture(bool wasActiveInPreviousEnqueue, bool isActive);
|
2019-04-01 09:33:19 +02:00
|
|
|
virtual void addAubComment(const char *comment);
|
2018-06-12 20:33:03 +02:00
|
|
|
|
2018-04-26 10:01:01 +02:00
|
|
|
IndirectHeap &getIndirectHeap(IndirectHeap::Type heapType, size_t minRequiredSize);
|
|
|
|
|
void allocateHeapMemory(IndirectHeap::Type heapType, size_t minRequiredSize, IndirectHeap *&indirectHeap);
|
|
|
|
|
void releaseIndirectHeap(IndirectHeap::Type heapType);
|
|
|
|
|
|
2018-06-06 10:34:51 +02:00
|
|
|
virtual enum CommandStreamReceiverType getType() = 0;
|
2018-07-05 11:23:28 +02:00
|
|
|
void setExperimentalCmdBuffer(std::unique_ptr<ExperimentalCommandBuffer> &&cmdBuffer);
|
2018-06-06 10:34:51 +02:00
|
|
|
|
2018-07-16 17:11:43 +02:00
|
|
|
bool initializeTagAllocation();
|
2021-02-16 17:04:00 +00:00
|
|
|
MOCKABLE_VIRTUAL bool createWorkPartitionAllocation(const Device &device);
|
2020-02-05 20:00:08 +01:00
|
|
|
MOCKABLE_VIRTUAL bool createGlobalFenceAllocation();
|
2019-06-27 21:33:05 +02:00
|
|
|
MOCKABLE_VIRTUAL bool createPreemptionAllocation();
|
2019-09-04 16:44:27 +02:00
|
|
|
MOCKABLE_VIRTUAL bool createPerDssBackedBuffer(Device &device);
|
2019-02-13 08:27:05 +01:00
|
|
|
MOCKABLE_VIRTUAL std::unique_lock<MutexType> obtainUniqueOwnership();
|
2018-07-16 17:11:43 +02:00
|
|
|
|
2018-09-06 09:03:07 +02:00
|
|
|
bool peekTimestampPacketWriteEnabled() const { return timestampPacketWriteEnabled; }
|
|
|
|
|
|
2022-01-12 15:32:07 +00:00
|
|
|
size_t defaultSshSize = 0u;
|
2021-03-31 20:21:59 +00:00
|
|
|
bool canUse4GbHeaps = true;
|
2018-08-29 13:39:27 +02:00
|
|
|
|
2018-10-29 12:26:58 +00:00
|
|
|
AllocationsList &getTemporaryAllocations();
|
|
|
|
|
AllocationsList &getAllocationsForReuse();
|
2018-10-22 15:17:32 +02:00
|
|
|
InternalAllocationStorage *getInternalAllocationStorage() const { return internalAllocationStorage.get(); }
|
2019-05-06 10:50:25 +02:00
|
|
|
MOCKABLE_VIRTUAL bool createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush);
|
2020-02-03 10:52:12 +01:00
|
|
|
virtual size_t getPreferredTagPoolSize() const;
|
2019-01-10 09:37:56 +01:00
|
|
|
virtual void setupContext(OsContext &osContext) { this->osContext = &osContext; }
|
2018-11-26 14:04:52 +01:00
|
|
|
OsContext &getOsContext() const { return *osContext; }
|
2018-09-19 20:54:29 -07:00
|
|
|
|
2021-03-24 18:21:13 +00:00
|
|
|
TagAllocatorBase *getEventTsAllocator();
|
|
|
|
|
TagAllocatorBase *getEventPerfCountAllocator(const uint32_t tagSize);
|
2021-03-29 14:46:41 +00:00
|
|
|
virtual TagAllocatorBase *getTimestampPacketAllocator() = 0;
|
2018-11-27 13:07:41 +01:00
|
|
|
|
2020-03-19 13:48:13 +01:00
|
|
|
virtual bool expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation);
|
2018-11-28 15:32:13 +01:00
|
|
|
|
2019-09-12 17:30:13 +02:00
|
|
|
virtual bool isMultiOsContextCapable() const = 0;
|
2018-02-08 22:52:58 +01:00
|
|
|
|
2021-08-02 10:44:48 +00:00
|
|
|
virtual MemoryCompressionState getMemoryCompressionState(bool auxTranslationRequired, const HardwareInfo &hwInfo) const = 0;
|
2020-12-17 00:36:45 +00:00
|
|
|
|
2019-03-18 15:23:18 +01:00
|
|
|
void setLatestSentTaskCount(uint32_t latestSentTaskCount) {
|
|
|
|
|
this->latestSentTaskCount = latestSentTaskCount;
|
|
|
|
|
}
|
2021-11-12 10:38:26 +00:00
|
|
|
void setLatestFlushedTaskCount(uint32_t latestFlushedTaskCount) {
|
|
|
|
|
this->latestFlushedTaskCount = latestFlushedTaskCount;
|
|
|
|
|
}
|
2019-03-18 15:23:18 +01:00
|
|
|
|
2022-02-03 13:29:48 +00:00
|
|
|
virtual uint32_t flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) = 0;
|
2019-04-03 15:59:31 +02:00
|
|
|
|
2021-02-23 08:48:08 +00:00
|
|
|
virtual void flushTagUpdate() = 0;
|
2021-04-13 01:49:19 +05:30
|
|
|
virtual void flushNonKernelTask(GraphicsAllocation *eventAlloc, uint64_t immediateGpuAddress, uint64_t immediateData, PipeControlArgs &args, bool isWaitOnEvents, bool isStartOfDispatch, bool isEndOfDispatch) = 0;
|
2021-02-23 08:48:08 +00:00
|
|
|
virtual void updateTagFromWait() = 0;
|
2021-10-28 09:21:44 +00:00
|
|
|
virtual bool isUpdateTagFromWaitEnabled() = 0;
|
2021-02-23 08:48:08 +00:00
|
|
|
|
2019-05-21 17:25:05 +02:00
|
|
|
ScratchSpaceController *getScratchSpaceController() const {
|
|
|
|
|
return scratchSpaceController.get();
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-27 10:43:20 +00:00
|
|
|
virtual void downloadAllocation(GraphicsAllocation &gfxAllocation){};
|
|
|
|
|
|
2019-08-27 19:14:24 +02:00
|
|
|
void registerInstructionCacheFlush() {
|
|
|
|
|
auto mutex = obtainUniqueOwnership();
|
|
|
|
|
requiresInstructionCacheFlush = true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-19 21:09:44 +02:00
|
|
|
bool isLocalMemoryEnabled() const { return localMemoryEnabled; }
|
|
|
|
|
|
2019-11-07 14:15:04 +01:00
|
|
|
uint32_t getRootDeviceIndex() { return rootDeviceIndex; }
|
|
|
|
|
|
2021-10-29 11:54:52 +00:00
|
|
|
void startControllingDirectSubmissions();
|
|
|
|
|
|
2021-11-16 13:26:36 +00:00
|
|
|
bool isAnyDirectSubmissionEnabled() {
|
|
|
|
|
return this->isDirectSubmissionEnabled() || isBlitterDirectSubmissionEnabled();
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-15 17:02:47 +01:00
|
|
|
virtual bool initDirectSubmission(Device &device, OsContext &osContext) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual bool isDirectSubmissionEnabled() const {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-26 20:13:10 +01:00
|
|
|
virtual bool isBlitterDirectSubmissionEnabled() const {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-30 09:56:58 +00:00
|
|
|
virtual void stopDirectSubmission() {}
|
|
|
|
|
|
2021-02-19 10:37:39 +00:00
|
|
|
bool isStaticWorkPartitioningEnabled() const {
|
|
|
|
|
return staticWorkPartitioningEnabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint64_t getWorkPartitionAllocationGpuAddress() const;
|
|
|
|
|
|
2022-01-12 16:57:42 +00:00
|
|
|
MOCKABLE_VIRTUAL bool isRcs() const;
|
2020-03-19 15:15:51 +01:00
|
|
|
|
2020-09-04 16:18:12 -07:00
|
|
|
virtual void initializeDefaultsForInternalEngine(){};
|
|
|
|
|
|
2020-11-18 23:58:42 +00:00
|
|
|
virtual GraphicsAllocation *getClearColorAllocation() = 0;
|
|
|
|
|
|
2021-05-19 21:41:59 +00:00
|
|
|
virtual void postInitFlagsSetup() = 0;
|
|
|
|
|
|
2021-06-17 11:55:28 +00:00
|
|
|
bool isUsedNotifyEnableForPostSync() const {
|
|
|
|
|
return useNotifyEnableForPostSync;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-27 15:23:29 +00:00
|
|
|
NEO::StreamProperties &getStreamProperties() {
|
|
|
|
|
return this->streamProperties;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-17 13:05:26 +00:00
|
|
|
inline void setActivePartitions(uint32_t newPartitionCount) {
|
|
|
|
|
activePartitions = newPartitionCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline uint32_t getActivePartitions() const {
|
|
|
|
|
return activePartitions;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-19 22:58:46 +01:00
|
|
|
bool skipResourceCleanup() const;
|
|
|
|
|
|
2021-11-17 19:51:43 +00:00
|
|
|
inline bool isProgramActivePartitionConfigRequired() const {
|
|
|
|
|
return this->isDirectSubmissionEnabled() ? false : this->activePartitionsConfig != this->activePartitions;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-29 15:59:41 +00:00
|
|
|
std::unique_ptr<GmmPageTableMngr> pageTableManager;
|
|
|
|
|
|
2021-11-30 14:41:26 +00:00
|
|
|
inline uint32_t getPostSyncWriteOffset() const {
|
|
|
|
|
return postSyncWriteOffset;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-10 21:31:34 +00:00
|
|
|
inline bool isMultiTileOperationEnabled() const {
|
|
|
|
|
return (activePartitions > 1) && staticWorkPartitioningEnabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void programComputeBarrierCommand(LinearStream &cmdStream) = 0;
|
|
|
|
|
virtual size_t getCmdsSizeForComputeBarrierCommand() const = 0;
|
|
|
|
|
|
2022-01-11 19:41:57 +00:00
|
|
|
const HardwareInfo &peekHwInfo() const;
|
|
|
|
|
|
2022-02-16 10:22:03 +00:00
|
|
|
MOCKABLE_VIRTUAL bool isGpuHangDetected() const;
|
|
|
|
|
|
2019-01-30 10:57:42 +01:00
|
|
|
protected:
|
|
|
|
|
void cleanupResources();
|
2020-04-30 13:24:34 +02:00
|
|
|
void printDeviceIndex();
|
2020-09-22 16:29:34 +02:00
|
|
|
void checkForNewResources(uint32_t submittedTaskCount, uint32_t allocationTaskCount, GraphicsAllocation &gfxAllocation);
|
|
|
|
|
bool checkImplicitFlushForGpuIdle();
|
2021-10-06 19:34:44 +02:00
|
|
|
MOCKABLE_VIRTUAL std::unique_lock<MutexType> obtainHostPtrSurfaceCreationLock();
|
2019-01-30 10:57:42 +01:00
|
|
|
|
2018-11-05 11:52:19 +01:00
|
|
|
std::unique_ptr<FlushStampTracker> flushStamp;
|
|
|
|
|
std::unique_ptr<SubmissionAggregator> submissionAggregator;
|
|
|
|
|
std::unique_ptr<FlatBatchBufferHelper> flatBatchBufferHelper;
|
|
|
|
|
std::unique_ptr<ExperimentalCommandBuffer> experimentalCmdBuffer;
|
|
|
|
|
std::unique_ptr<InternalAllocationStorage> internalAllocationStorage;
|
|
|
|
|
std::unique_ptr<KmdNotifyHelper> kmdNotifyHelper;
|
2018-11-22 15:16:20 +01:00
|
|
|
std::unique_ptr<ScratchSpaceController> scratchSpaceController;
|
2021-03-24 18:21:13 +00:00
|
|
|
std::unique_ptr<TagAllocatorBase> profilingTimeStampAllocator;
|
|
|
|
|
std::unique_ptr<TagAllocatorBase> perfCounterAllocator;
|
|
|
|
|
std::unique_ptr<TagAllocatorBase> timestampPacketAllocator;
|
2020-10-28 16:08:37 +01:00
|
|
|
std::unique_ptr<Thread> userPauseConfirmation;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-11-05 11:52:19 +01:00
|
|
|
ResidencyContainer residencyAllocations;
|
|
|
|
|
ResidencyContainer evictionAllocations;
|
|
|
|
|
MutexType ownershipMutex;
|
2021-10-06 19:34:44 +02:00
|
|
|
MutexType hostPtrSurfaceCreationMutex;
|
2018-11-05 11:52:19 +01:00
|
|
|
ExecutionEnvironment &executionEnvironment;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-11-05 11:52:19 +01:00
|
|
|
LinearStream commandStream;
|
2021-09-17 13:05:26 +00:00
|
|
|
StreamProperties streamProperties{};
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-11-30 14:41:26 +00:00
|
|
|
// offset for debug state is 1kbyte, tag writes can use multiple offsets for multiple partitions and each offset can vary per platform
|
|
|
|
|
const uint64_t debugPauseStateAddressOffset = MemoryConstants::kiloByte;
|
2020-10-28 16:08:37 +01:00
|
|
|
uint64_t totalMemoryUsed = 0u;
|
2020-04-30 17:12:01 +02:00
|
|
|
|
2020-10-28 16:08:37 +01:00
|
|
|
volatile uint32_t *tagAddress = nullptr;
|
2021-08-31 11:37:13 +00:00
|
|
|
volatile DebugPauseState *debugPauseStateAddress = nullptr;
|
2020-11-06 13:01:29 +01:00
|
|
|
SpinLock debugPauseStateLock;
|
2020-06-17 11:31:08 +02:00
|
|
|
static void *asyncDebugBreakConfirmation(void *arg);
|
2020-04-30 17:12:01 +02:00
|
|
|
std::function<void()> debugConfirmationFunction = []() { std::cin.get(); };
|
2018-11-05 11:52:19 +01:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
GraphicsAllocation *tagAllocation = nullptr;
|
2020-02-05 20:00:08 +01:00
|
|
|
GraphicsAllocation *globalFenceAllocation = nullptr;
|
2019-06-27 21:33:05 +02:00
|
|
|
GraphicsAllocation *preemptionAllocation = nullptr;
|
2018-11-05 11:52:19 +01:00
|
|
|
GraphicsAllocation *debugSurface = nullptr;
|
2019-09-04 16:44:27 +02:00
|
|
|
GraphicsAllocation *perDssBackedBuffer = nullptr;
|
2020-11-18 23:58:42 +00:00
|
|
|
GraphicsAllocation *clearColorAllocation = nullptr;
|
2021-02-16 17:04:00 +00:00
|
|
|
GraphicsAllocation *workPartitionAllocation = nullptr;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-02-25 09:38:48 +01:00
|
|
|
MultiGraphicsAllocation *tagsMultiAllocation = nullptr;
|
|
|
|
|
|
2022-01-26 10:59:30 +00:00
|
|
|
IndirectHeap *indirectHeap[IndirectHeap::Type::NUM_TYPES];
|
2020-10-28 16:08:37 +01:00
|
|
|
OsContext *osContext = nullptr;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-11-05 11:52:19 +01:00
|
|
|
// current taskLevel. Used for determining if a PIPE_CONTROL is needed.
|
|
|
|
|
std::atomic<uint32_t> taskLevel{0};
|
|
|
|
|
std::atomic<uint32_t> latestSentTaskCount{0};
|
|
|
|
|
std::atomic<uint32_t> latestFlushedTaskCount{0};
|
2020-10-28 16:08:37 +01:00
|
|
|
// taskCount - # of tasks submitted
|
|
|
|
|
std::atomic<uint32_t> taskCount{0};
|
2018-11-05 11:52:19 +01:00
|
|
|
|
|
|
|
|
DispatchMode dispatchMode = DispatchMode::ImmediateDispatch;
|
|
|
|
|
SamplerCacheFlushState samplerCacheFlushRequired = SamplerCacheFlushState::samplerCacheFlushNotRequired;
|
2018-02-08 13:41:02 +01:00
|
|
|
PreemptionMode lastPreemptionMode = PreemptionMode::Initial;
|
2020-04-30 17:12:01 +02:00
|
|
|
|
2022-01-20 16:56:19 +00:00
|
|
|
std::chrono::microseconds gpuHangCheckPeriod{500'000};
|
2018-11-05 11:52:19 +01:00
|
|
|
uint32_t lastSentL3Config = 0;
|
2018-06-12 20:33:03 +02:00
|
|
|
uint32_t latestSentStatelessMocsConfig = 0;
|
2018-09-21 14:06:35 +02:00
|
|
|
uint32_t lastSentNumGrfRequired = GrfConfig::DefaultGrfNumber;
|
2019-08-21 03:50:47 -07:00
|
|
|
uint64_t lastSentSliceCount = QueueSliceCount::defaultSliceCount;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-11-05 11:52:19 +01:00
|
|
|
uint32_t requiredScratchSize = 0;
|
2019-06-28 09:37:04 +02:00
|
|
|
uint32_t requiredPrivateScratchSize = 0;
|
2020-10-28 16:08:37 +01:00
|
|
|
uint32_t lastAdditionalKernelExecInfo = AdditionalKernelExecInfo::NotSet;
|
2020-11-17 11:42:29 +01:00
|
|
|
KernelExecutionType lastKernelExecutionType = KernelExecutionType::Default;
|
2020-12-17 00:36:45 +00:00
|
|
|
MemoryCompressionState lastMemoryCompressionState = MemoryCompressionState::NotApplicable;
|
2021-09-17 13:05:26 +00:00
|
|
|
uint32_t activePartitions = 1;
|
2021-09-23 18:13:37 +00:00
|
|
|
uint32_t activePartitionsConfig = 1;
|
2021-11-30 14:41:26 +00:00
|
|
|
uint32_t postSyncWriteOffset = 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-10-29 08:01:53 +01:00
|
|
|
const uint32_t rootDeviceIndex;
|
2020-10-29 15:33:35 +01:00
|
|
|
const DeviceBitfield deviceBitfield;
|
2019-10-29 08:01:53 +01:00
|
|
|
|
2018-11-05 11:52:19 +01:00
|
|
|
int8_t lastMediaSamplerConfig = -1;
|
2018-09-13 15:49:38 +02:00
|
|
|
|
2018-11-05 11:52:19 +01:00
|
|
|
bool isPreambleSent = false;
|
|
|
|
|
bool isStateSipSent = false;
|
2020-02-03 10:24:43 +01:00
|
|
|
bool isEnginePrologueSent = false;
|
2020-11-26 19:02:18 +00:00
|
|
|
bool isPerDssBackedBufferSent = false;
|
2018-11-05 11:52:19 +01:00
|
|
|
bool GSBAFor32BitProgrammed = false;
|
2021-02-04 22:02:23 +05:30
|
|
|
bool GSBAStateDirty = true;
|
2019-04-26 17:04:03 +02:00
|
|
|
bool bindingTableBaseAddressRequired = false;
|
2018-11-05 11:52:19 +01:00
|
|
|
bool mediaVfeStateDirty = true;
|
|
|
|
|
bool lastVmeSubslicesConfig = false;
|
2021-11-06 01:42:54 +00:00
|
|
|
bool stallingCommandsOnNextFlushRequired = false;
|
2018-11-05 11:52:19 +01:00
|
|
|
bool timestampPacketWriteEnabled = false;
|
2021-02-16 17:04:00 +00:00
|
|
|
bool staticWorkPartitioningEnabled = false;
|
2018-11-05 11:52:19 +01:00
|
|
|
bool nTo1SubmissionModelEnabled = false;
|
2018-11-14 08:40:37 +01:00
|
|
|
bool lastSpecialPipelineSelectMode = false;
|
2019-08-27 19:14:24 +02:00
|
|
|
bool requiresInstructionCacheFlush = false;
|
2019-09-19 21:09:44 +02:00
|
|
|
|
|
|
|
|
bool localMemoryEnabled = false;
|
2019-12-31 10:45:14 +01:00
|
|
|
bool pageTableManagerInitialized = false;
|
2020-09-22 16:29:34 +02:00
|
|
|
|
|
|
|
|
bool useNewResourceImplicitFlush = false;
|
|
|
|
|
bool newResources = false;
|
|
|
|
|
bool useGpuIdleImplicitFlush = false;
|
2021-03-03 12:25:26 +00:00
|
|
|
bool lastSentUseGlobalAtomics = false;
|
2021-06-17 11:55:28 +00:00
|
|
|
bool useNotifyEnableForPostSync = false;
|
2017-12-21 00:45:38 +01:00
|
|
|
};
|
|
|
|
|
|
2020-10-29 15:33:35 +01:00
|
|
|
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(bool withAubDump,
|
|
|
|
|
ExecutionEnvironment &executionEnvironment,
|
|
|
|
|
uint32_t rootDeviceIndex,
|
|
|
|
|
const DeviceBitfield deviceBitfield);
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|