mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Propagate exec buffer error to L0 API level on Xe HPC
This change makes that drm file is opened in nonblocking mode for prelim kernels. In such case when calling exec buffer ioctl and get EAGAIN (aka EWOULDBLOCK) we may return error to API level Related-To: NEO-7144 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
a9ba581d97
commit
9816f815f3
@ -20,6 +20,9 @@ SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchB
|
||||
int ret = this->exec(batchBuffer, 0u, static_cast<const OsContextLinux *>(osContext)->getDrmContextIds()[0], 0);
|
||||
|
||||
if (ret) {
|
||||
if (ret == EWOULDBLOCK) {
|
||||
return SubmissionStatus::OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
return SubmissionStatus::FAILED;
|
||||
}
|
||||
return SubmissionStatus::SUCCESS;
|
||||
|
@ -39,6 +39,9 @@ SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchB
|
||||
|
||||
int ret = this->exec(batchBuffer, tileIterator, drmContextIds[contextIndex], contextIndex);
|
||||
if (ret) {
|
||||
if (ret == EWOULDBLOCK) {
|
||||
return SubmissionStatus::OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
return SubmissionStatus::FAILED;
|
||||
}
|
||||
|
||||
|
@ -370,4 +370,5 @@ std::string IoctlHelper::getFileForMaxMemoryFrequencyOfSubDevice(int subDeviceId
|
||||
bool IoctlHelper::checkIfIoctlReinvokeRequired(int error, DrmIoctl ioctlRequest) const {
|
||||
return (error == EINTR || error == EAGAIN || error == EBUSY || error == -EBUSY);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -210,7 +210,7 @@ class IoctlHelperImpl : public IoctlHelperUpstream {
|
||||
|
||||
class IoctlHelperPrelim20 : public IoctlHelper {
|
||||
public:
|
||||
using IoctlHelper::IoctlHelper;
|
||||
IoctlHelperPrelim20(Drm &drmArg);
|
||||
|
||||
bool initialize() override;
|
||||
bool isSetPairAvailable() override;
|
||||
@ -259,6 +259,9 @@ 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;
|
||||
|
||||
protected:
|
||||
bool handleExecBufferInNonBlockMode = false;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -6,15 +6,19 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/os_interface/linux/cache_info.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/drm_wrappers.h"
|
||||
#include "shared/source/os_interface/linux/i915_prelim.h"
|
||||
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cerrno>
|
||||
@ -25,6 +29,15 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
IoctlHelperPrelim20::IoctlHelperPrelim20(Drm &drmArg) : IoctlHelper(drmArg) {
|
||||
auto hwHelper = HwInfoConfig::get(this->drm.getRootDeviceEnvironment().getHardwareInfo()->platform.eProductFamily);
|
||||
if (hwHelper && hwHelper->isNonBlockingGpuSubmissionSupported()) {
|
||||
handleExecBufferInNonBlockMode = true;
|
||||
auto fileDescriptor = this->drm.getFileDescriptor();
|
||||
SysCalls::fcntl(fileDescriptor, F_SETFL, SysCalls::fcntl(fileDescriptor, F_GETFL) | O_NONBLOCK);
|
||||
}
|
||||
};
|
||||
|
||||
bool IoctlHelperPrelim20::isSetPairAvailable() {
|
||||
int setPairSupported = 0;
|
||||
GetParam getParam{};
|
||||
@ -649,6 +662,12 @@ bool IoctlHelperPrelim20::checkIfIoctlReinvokeRequired(int error, DrmIoctl ioctl
|
||||
switch (ioctlRequest) {
|
||||
case DrmIoctl::DebuggerOpen:
|
||||
return (error == EINTR || error == EAGAIN);
|
||||
case DrmIoctl::GemExecbuffer2:
|
||||
if (handleExecBufferInNonBlockMode) {
|
||||
return (error == EINTR || error == EBUSY || error == -EBUSY);
|
||||
} else {
|
||||
return IoctlHelper::checkIfIoctlReinvokeRequired(error, ioctlRequest);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -29,5 +29,7 @@ ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
|
||||
void *mmap(void *addr, size_t size, int prot, int flags, int fd, off_t off);
|
||||
int munmap(void *addr, size_t size);
|
||||
ssize_t read(int fd, void *buf, size_t count);
|
||||
int fcntl(int fd, int cmd);
|
||||
int fcntl(int fd, int cmd, int arg);
|
||||
} // namespace SysCalls
|
||||
} // namespace NEO
|
||||
|
@ -93,5 +93,12 @@ ssize_t read(int fd, void *buf, size_t count) {
|
||||
return ::read(fd, buf, count);
|
||||
}
|
||||
|
||||
int fcntl(int fd, int cmd) {
|
||||
return ::fcntl(fd, cmd);
|
||||
}
|
||||
int fcntl(int fd, int cmd, int arg) {
|
||||
return ::fcntl(fd, cmd, arg);
|
||||
}
|
||||
|
||||
} // namespace SysCalls
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user