mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
refactor: Refactor user fence setup logic
Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b7d1c32edd
commit
4573511966
@@ -1628,8 +1628,7 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
|
||||
VmBindExtUserFenceT vmBindExtUserFence{};
|
||||
bool incrementFenceValue = false;
|
||||
|
||||
if ((ioctlHelper->isWaitBeforeBindRequired(bind) && drm->useVMBindImmediate()) || guaranteePagingFence) {
|
||||
|
||||
if ((ioctlHelper->requiresUserFenceSetup(bind) && drm->useVMBindImmediate()) || guaranteePagingFence) {
|
||||
lock = drm->lockBindFenceMutex();
|
||||
auto nextExtension = vmBind.extensions;
|
||||
incrementFenceValue = true;
|
||||
@@ -1653,7 +1652,6 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
|
||||
}
|
||||
|
||||
if (incrementFenceValue) {
|
||||
|
||||
auto osContextLinux = static_cast<OsContextLinux *>(osContext);
|
||||
std::pair<uint64_t, uint64_t> fenceAddressAndValToWait = osContextLinux->getFenceAddressAndValToWait(vmHandleId, true);
|
||||
if (drm->isPerContextVMRequired()) {
|
||||
@@ -1668,14 +1666,12 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
|
||||
const auto fenceValToWait = fenceAddressAndValToWait.second;
|
||||
|
||||
if (fenceAddressToWait != 0u) {
|
||||
|
||||
bool waitOnUserFenceAfterBindAndUnbind = false;
|
||||
if (debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.get() != -1) {
|
||||
waitOnUserFenceAfterBindAndUnbind = !!debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.get();
|
||||
}
|
||||
|
||||
if ((ioctlHelper->isWaitBeforeBindRequired(bind) && waitOnUserFenceAfterBindAndUnbind && drm->useVMBindImmediate()) || guaranteePagingFence) {
|
||||
|
||||
if ((waitOnUserFenceAfterBindAndUnbind && drm->useVMBindImmediate()) || guaranteePagingFence) {
|
||||
drm->waitUserFence(0u, fenceAddressToWait, fenceValToWait, Drm::ValueWidth::u64, -1, ioctlHelper->getWaitUserFenceSoftFlag(), false, NEO::InterruptId::notUsed, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ class IoctlHelper {
|
||||
virtual std::string getFileForMaxGpuFrequencyOfSubDevice(int tileId) const = 0;
|
||||
virtual std::string getFileForMaxMemoryFrequencyOfSubDevice(int tileId) const = 0;
|
||||
virtual bool getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) = 0;
|
||||
virtual bool isWaitBeforeBindRequired(bool bind) const = 0;
|
||||
virtual bool requiresUserFenceSetup(bool bind) const = 0;
|
||||
virtual void *pciBarrierMmap() { return nullptr; };
|
||||
virtual void setupIpVersion();
|
||||
virtual bool isImmediateVmBindRequired() const { return false; }
|
||||
@@ -366,7 +366,7 @@ class IoctlHelperUpstream : public IoctlHelperI915 {
|
||||
int getDrmParamValue(DrmParam drmParam) const override;
|
||||
std::string getIoctlString(DrmIoctl ioctlRequest) const override;
|
||||
bool getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) override;
|
||||
bool isWaitBeforeBindRequired(bool bind) const override;
|
||||
bool requiresUserFenceSetup(bool bind) const override;
|
||||
|
||||
protected:
|
||||
MOCKABLE_VIRTUAL void detectExtSetPatSupport();
|
||||
@@ -444,7 +444,7 @@ class IoctlHelperPrelim20 : public IoctlHelperI915 {
|
||||
std::string getIoctlString(DrmIoctl ioctlRequest) const override;
|
||||
bool checkIfIoctlReinvokeRequired(int error, DrmIoctl ioctlRequest) const override;
|
||||
bool getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) override;
|
||||
bool isWaitBeforeBindRequired(bool bind) const override;
|
||||
bool requiresUserFenceSetup(bool bind) const override;
|
||||
void *pciBarrierMmap() override;
|
||||
void setupIpVersion() override;
|
||||
bool getTopologyDataAndMap(HardwareInfo &hwInfo, DrmQueryTopologyData &topologyData, TopologyMap &topologyMap) override;
|
||||
|
||||
@@ -1037,12 +1037,11 @@ bool IoctlHelperPrelim20::getFabricLatency(uint32_t fabricId, uint32_t &latency,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IoctlHelperPrelim20::isWaitBeforeBindRequired(bool bind) const {
|
||||
bool IoctlHelperPrelim20::requiresUserFenceSetup(bool bind) const {
|
||||
bool userFenceOnUnbind = false;
|
||||
if (debugManager.flags.EnableUserFenceUponUnbind.get() != -1) {
|
||||
userFenceOnUnbind = !!debugManager.flags.EnableUserFenceUponUnbind.get();
|
||||
}
|
||||
|
||||
return (bind || userFenceOnUnbind);
|
||||
}
|
||||
|
||||
|
||||
@@ -311,11 +311,8 @@ bool IoctlHelperUpstream::getFabricLatency(uint32_t fabricId, uint32_t &latency,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IoctlHelperUpstream::isWaitBeforeBindRequired(bool bind) const {
|
||||
bool userFenceOnUnbind = false;
|
||||
if (debugManager.flags.EnableUserFenceUponUnbind.get() != -1) {
|
||||
userFenceOnUnbind = !!debugManager.flags.EnableUserFenceUponUnbind.get();
|
||||
}
|
||||
return userFenceOnUnbind;
|
||||
bool IoctlHelperUpstream::requiresUserFenceSetup(bool bind) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1799,7 +1799,7 @@ bool IoctlHelperXe::getFabricLatency(uint32_t fabricId, uint32_t &latency, uint3
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IoctlHelperXe::isWaitBeforeBindRequired(bool bind) const {
|
||||
bool IoctlHelperXe::requiresUserFenceSetup(bool bind) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ class IoctlHelperXe : public IoctlHelper {
|
||||
void configureCcsMode(std::vector<std::string> &files, const std::string expectedPrefix, uint32_t ccsMode,
|
||||
std::vector<std::tuple<std::string, uint32_t>> &deviceCcsModeVec) override;
|
||||
bool getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) override;
|
||||
bool isWaitBeforeBindRequired(bool bind) const override;
|
||||
bool requiresUserFenceSetup(bool bind) const override;
|
||||
std::unique_ptr<EngineInfo> createEngineInfo(bool isSysmanEnabled) override;
|
||||
std::unique_ptr<MemoryInfo> createMemoryInfo() override;
|
||||
size_t getLocalMemoryRegionsSize(const MemoryInfo *memoryInfo, uint32_t subDevicesCount, uint32_t deviceBitfield) const override;
|
||||
|
||||
Reference in New Issue
Block a user