Add PCI barrier implementation

Resolves: NEO-7850

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2023-04-24 09:02:15 +00:00
committed by Compute-Runtime-Automation
parent 6c6cf9dd0c
commit 853a65aae9
12 changed files with 132 additions and 0 deletions

View File

@@ -211,6 +211,7 @@ class DirectSubmissionHw {
void *semaphorePtr = nullptr;
volatile RingSemaphoreData *semaphoreData = nullptr;
volatile void *workloadModeOneStoreAddress = nullptr;
uint32_t *pciBarrierPtr = nullptr;
uint32_t currentQueueWorkCount = 1u;
uint32_t workloadMode = 0;

View File

@@ -408,6 +408,10 @@ inline void DirectSubmissionHw<GfxFamily, Dispatcher>::unblockGpu() {
CpuIntrinsics::sfence();
}
if (this->pciBarrierPtr) {
*this->pciBarrierPtr = 0u;
}
semaphoreData->QueueWorkCount = currentQueueWorkCount;
if (sfenceMode == DirectSubmissionSfenceMode::BeforeAndAfterSemaphore) {

View File

@@ -16,6 +16,7 @@
#include "shared/source/os_interface/linux/drm_wrappers.h"
#include "shared/source/os_interface/linux/ioctl_helper.h"
#include "shared/source/os_interface/linux/os_context_linux.h"
#include "shared/source/os_interface/linux/sys_calls.h"
#include "shared/source/utilities/wait_util.h"
#include <iostream>
@@ -50,6 +51,23 @@ DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(const DirectSubm
auto &drm = osContextLinux->getDrm();
drm.setDirectSubmissionActive(true);
auto usePciBarrier = true;
if (DebugManager.flags.DirectSubmissionPCIBarrier.get() != -1) {
usePciBarrier = DebugManager.flags.DirectSubmissionPCIBarrier.get();
}
if (usePciBarrier) {
auto ptr = static_cast<uint32_t *>(drm.getIoctlHelper()->pciBarrierMmap());
if (ptr != MAP_FAILED) {
this->pciBarrierPtr = ptr;
}
}
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "Using PCI barrier ptr: %p\n", this->pciBarrierPtr);
if (this->pciBarrierPtr) {
this->miMemFenceRequired = false;
this->sfenceMode = DirectSubmissionSfenceMode::Disabled;
}
if (this->partitionedMode) {
this->workPartitionAllocation = inputParams.workPartitionAllocation;
UNRECOVERABLE_IF(this->workPartitionAllocation == nullptr);
@@ -86,6 +104,9 @@ inline DrmDirectSubmission<GfxFamily, Dispatcher>::~DrmDirectSubmission() {
drm.waitOnUserFences(*osContextLinux, completionFenceCpuAddress, this->completionFenceValue, this->activeTiles, this->postSyncOffset);
}
this->deallocateResources();
if (this->pciBarrierPtr) {
SysCalls::munmap(this->pciBarrierPtr, MemoryConstants::pageSize);
}
}
template <typename GfxFamily, typename Dispatcher>