Adapt command stream receiver to multiple active partitions

Related-To: NEO-6244

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2021-09-17 13:05:26 +00:00
committed by Compute-Runtime-Automation
parent 3bb2985462
commit 3b35ba504f
40 changed files with 214 additions and 208 deletions

View File

@@ -47,7 +47,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
MOCKABLE_VIRTUAL void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
void makeNonResident(GraphicsAllocation &gfxAllocation) override;
bool waitForFlushStamp(FlushStamp &flushStampToWait, uint32_t partitionCount, uint32_t offsetSize) override;
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
bool isKmdWaitModeActive() override;
DrmMemoryManager *getMemoryManager() const;
@@ -66,7 +66,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
protected:
MOCKABLE_VIRTUAL void flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency);
MOCKABLE_VIRTUAL void exec(const BatchBuffer &batchBuffer, uint32_t vmHandleId, uint32_t drmContextId);
MOCKABLE_VIRTUAL int waitUserFence(uint32_t waitValue, uint32_t partitionCount, uint32_t offsetSize);
MOCKABLE_VIRTUAL int waitUserFence(uint32_t waitValue);
bool isUserFenceWaitActive();
std::vector<BufferObject *> residency;

View File

@@ -228,10 +228,10 @@ GmmPageTableMngr *DrmCommandStreamReceiver<GfxFamily>::createPageTableManager()
}
template <typename GfxFamily>
bool DrmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushStamp, uint32_t partitionCount, uint32_t offsetSize) {
bool DrmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushStamp) {
auto waitValue = static_cast<uint32_t>(flushStamp);
if (isUserFenceWaitActive()) {
waitUserFence(waitValue, partitionCount, offsetSize);
waitUserFence(waitValue);
} else {
this->drm->waitHandle(waitValue, kmdWaitTimeout);
}

View File

@@ -17,7 +17,7 @@ void DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchBuffer &batch
}
template <typename GfxFamily>
int DrmCommandStreamReceiver<GfxFamily>::waitUserFence(uint32_t waitValue, uint32_t partitionCount, uint32_t offsetSize) {
int DrmCommandStreamReceiver<GfxFamily>::waitUserFence(uint32_t waitValue) {
uint32_t ctxId = 0u;
uint64_t tagAddress = castToUint64(const_cast<uint32_t *>(getTagAddress()));
if (useContextForUserFenceWait) {

View File

@@ -50,7 +50,7 @@ void DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchBuffer &batch
}
template <typename GfxFamily>
int DrmCommandStreamReceiver<GfxFamily>::waitUserFence(uint32_t waitValue, uint32_t partitionCount, uint32_t offsetSize) {
int DrmCommandStreamReceiver<GfxFamily>::waitUserFence(uint32_t waitValue) {
int ret = 0;
StackVec<uint32_t, 32> ctxIds;
uint64_t tagAddress = castToUint64(const_cast<uint32_t *>(getTagAddress()));
@@ -62,15 +62,15 @@ int DrmCommandStreamReceiver<GfxFamily>::waitUserFence(uint32_t waitValue, uint3
ctxIds.push_back(ctxId);
}
}
UNRECOVERABLE_IF(ctxIds.size() != partitionCount);
for (uint32_t i = 0; i < partitionCount; i++) {
UNRECOVERABLE_IF(ctxIds.size() != this->activePartitions);
for (uint32_t i = 0; i < this->activePartitions; i++) {
ret |= this->drm->waitUserFence(ctxIds[i], tagAddress, waitValue, Drm::ValueWidth::U32, kmdWaitTimeout, 0u);
tagAddress += offsetSize;
tagAddress += CommonConstants::partitionAddressOffset;
}
} else {
for (uint32_t i = 0; i < partitionCount; i++) {
for (uint32_t i = 0; i < this->activePartitions; i++) {
ret |= this->drm->waitUserFence(0u, tagAddress, waitValue, Drm::ValueWidth::U32, kmdWaitTimeout, 0u);
tagAddress += offsetSize;
tagAddress += CommonConstants::partitionAddressOffset;
}
}

View File

@@ -27,7 +27,7 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
void processEviction() override;
bool waitForFlushStamp(FlushStamp &flushStampToWait, uint32_t partitionCount, uint32_t offsetSize) override;
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
WddmMemoryManager *getMemoryManager() const;
Wddm *peekWddm() const {

View File

@@ -131,7 +131,7 @@ WddmMemoryManager *WddmCommandStreamReceiver<GfxFamily>::getMemoryManager() cons
}
template <typename GfxFamily>
bool WddmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushStampToWait, uint32_t partitionCount, uint32_t offsetSize) {
bool WddmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushStampToWait) {
return wddm->waitFromCpu(flushStampToWait, static_cast<OsContextWin *>(this->osContext)->getResidencyController().getMonitoredFence());
}