mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 05:24:02 +08:00
fix xe: add missing wait on fence before unbind
Related-To: NEO-7306 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2d0c61aa33
commit
415d2cb121
@@ -1454,11 +1454,11 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
|
||||
vmBind.extensions = castToUint64(extensions.get());
|
||||
}
|
||||
|
||||
if (bind) {
|
||||
std::unique_lock<std::mutex> lock;
|
||||
std::unique_lock<std::mutex> lock;
|
||||
|
||||
VmBindExtUserFenceT vmBindExtUserFence{};
|
||||
VmBindExtUserFenceT vmBindExtUserFence{};
|
||||
|
||||
if (ioctlHelper->isWaitBeforeBindRequired(bind)) {
|
||||
if (drm->useVMBindImmediate()) {
|
||||
lock = drm->lockBindFenceMutex();
|
||||
|
||||
@@ -1471,7 +1471,8 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
|
||||
vmBind.extensions = castToUint64(vmBindExtUserFence);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (bind) {
|
||||
ret = ioctlHelper->vmBind(vmBind);
|
||||
|
||||
if (ret) {
|
||||
|
||||
@@ -137,6 +137,7 @@ class IoctlHelper {
|
||||
virtual std::string getFileForMaxGpuFrequencyOfSubDevice(int subDeviceId) const;
|
||||
virtual std::string getFileForMaxMemoryFrequencyOfSubDevice(int subDeviceId) const;
|
||||
virtual bool getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) = 0;
|
||||
virtual bool isWaitBeforeBindRequired(bool bind) const = 0;
|
||||
|
||||
uint32_t getFlagsForPrimeHandleToFd() const;
|
||||
|
||||
@@ -194,6 +195,7 @@ class IoctlHelperUpstream : public IoctlHelper {
|
||||
std::string getDrmParamString(DrmParam param) 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;
|
||||
};
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
@@ -261,6 +263,7 @@ class IoctlHelperPrelim20 : public IoctlHelper {
|
||||
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;
|
||||
|
||||
protected:
|
||||
bool queryHwIpVersion(EngineClassInstance &engineInfo, HardwareIpVersion &ipVersion, int &ret);
|
||||
|
||||
@@ -708,6 +708,11 @@ bool IoctlHelperPrelim20::getFabricLatency(uint32_t fabricId, uint32_t &latency,
|
||||
bandwidth = info.bandwidth;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IoctlHelperPrelim20::isWaitBeforeBindRequired(bool bind) const {
|
||||
return bind;
|
||||
}
|
||||
|
||||
bool IoctlHelperPrelim20::queryHwIpVersion(EngineClassInstance &engineInfo, HardwareIpVersion &ipVersion, int &ret) {
|
||||
QueryItem queryItem{};
|
||||
queryItem.queryId = PRELIM_DRM_I915_QUERY_HW_IP_VERSION;
|
||||
|
||||
@@ -239,4 +239,8 @@ std::string IoctlHelperUpstream::getIoctlString(DrmIoctl ioctlRequest) const {
|
||||
bool IoctlHelperUpstream::getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IoctlHelperUpstream::isWaitBeforeBindRequired(bool bind) const {
|
||||
return false;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1177,21 +1177,15 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool bindOp) {
|
||||
}
|
||||
if (found != -1) {
|
||||
uint32_t extraBindFlag = 0;
|
||||
uint64_t waitfence = 0ull;
|
||||
struct drm_xe_sync sync[1] = {};
|
||||
sync[0].flags = DRM_XE_SYNC_USER_FENCE | DRM_XE_SYNC_SIGNAL;
|
||||
extraBindFlag = XE_VM_BIND_FLAG_ASYNC;
|
||||
auto xeBindExtUserFence = reinterpret_cast<xe_fake_ext_user_fence *>(vmBindParams.extensions);
|
||||
UNRECOVERABLE_IF(!xeBindExtUserFence);
|
||||
UNRECOVERABLE_IF(xeBindExtUserFence->tag != VMBIND_FENCE_TAG);
|
||||
sync[0].addr = xeBindExtUserFence->addr;
|
||||
sync[0].timeline_value = xeBindExtUserFence->value;
|
||||
|
||||
if (bindOp) {
|
||||
auto xeBindExtUserFence = reinterpret_cast<xe_fake_ext_user_fence *>(vmBindParams.extensions);
|
||||
UNRECOVERABLE_IF(!xeBindExtUserFence);
|
||||
UNRECOVERABLE_IF(xeBindExtUserFence->tag != VMBIND_FENCE_TAG);
|
||||
sync[0].addr = xeBindExtUserFence->addr;
|
||||
sync[0].timeline_value = xeBindExtUserFence->value;
|
||||
} else {
|
||||
sync[0].addr = castToUint64(&waitfence);
|
||||
sync[0].timeline_value = USER_FENCE_VALUE | vmBindParams.handle;
|
||||
}
|
||||
struct drm_xe_vm_bind bind = {};
|
||||
bind.vm_id = vmBindParams.vmId;
|
||||
bind.num_binds = 1;
|
||||
@@ -1209,7 +1203,6 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool bindOp) {
|
||||
}
|
||||
if (!bindOp) {
|
||||
bind.bind.op = XE_VM_BIND_OP_UNMAP;
|
||||
bind.bind.obj = bindInfo[found].handle;
|
||||
bind.bind.obj = 0;
|
||||
if (bindInfo[found].handle & XE_USERPTR_FAKE_FLAG) {
|
||||
bind.bind.obj_offset = bindInfo[found].userptr;
|
||||
@@ -1370,6 +1363,10 @@ bool IoctlHelperXe::getFabricLatency(uint32_t fabricId, uint32_t &latency, uint3
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IoctlHelperXe::isWaitBeforeBindRequired(bool bind) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint32_t getVectorGetMax(std::vector<uint8_t> *data) {
|
||||
uint32_t ret = 0;
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(data->size()); i++) {
|
||||
|
||||
@@ -92,6 +92,7 @@ class IoctlHelperXe : public IoctlHelper {
|
||||
std::string getFileForMaxGpuFrequencyOfSubDevice(int subDeviceId) const override;
|
||||
std::string getFileForMaxMemoryFrequencyOfSubDevice(int subDeviceId) const override;
|
||||
bool getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) override;
|
||||
bool isWaitBeforeBindRequired(bool bind) const override;
|
||||
|
||||
std::vector<uint8_t> xeRebuildi915Topology(std::vector<uint8_t> *geomDss, std::vector<uint8_t> *computeDss, std::vector<uint8_t> *euDss);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user