mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-18 22:08:53 +08:00
performance: don't wait immediately after VmBind
Related-To: NEO-13456 Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
bc671249bd
commit
09118d2011
@@ -1432,17 +1432,20 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool isBind) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
constexpr auto oneSecTimeout = 1000000000ll;
|
||||
constexpr auto infiniteTimeout = -1;
|
||||
bool debuggingEnabled = drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled();
|
||||
uint64_t timeout = debuggingEnabled ? infiniteTimeout : oneSecTimeout;
|
||||
if (debugManager.flags.VmBindWaitUserFenceTimeout.get() != -1) {
|
||||
timeout = debugManager.flags.VmBindWaitUserFenceTimeout.get();
|
||||
if (!isBind) {
|
||||
constexpr auto oneSecTimeout = 1000000000ll;
|
||||
constexpr auto infiniteTimeout = -1;
|
||||
bool debuggingEnabled = drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled();
|
||||
uint64_t timeout = debuggingEnabled ? infiniteTimeout : oneSecTimeout;
|
||||
if (debugManager.flags.VmBindWaitUserFenceTimeout.get() != -1) {
|
||||
timeout = debugManager.flags.VmBindWaitUserFenceTimeout.get();
|
||||
}
|
||||
ret = xeWaitUserFence(bind.exec_queue_id, DRM_XE_UFENCE_WAIT_OP_EQ,
|
||||
sync[0].addr,
|
||||
sync[0].timeline_value, timeout,
|
||||
false, NEO::InterruptId::notUsed, nullptr);
|
||||
}
|
||||
return xeWaitUserFence(bind.exec_queue_id, DRM_XE_UFENCE_WAIT_OP_EQ,
|
||||
sync[0].addr,
|
||||
sync[0].timeline_value, timeout,
|
||||
false, NEO::InterruptId::notUsed, nullptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string IoctlHelperXe::getDrmParamString(DrmParam drmParam) const {
|
||||
|
||||
@@ -414,10 +414,9 @@ TEST_F(IoctlHelperXeTest, givenDebuggingEnabledWhenCallingVmBindThenWaitUserFenc
|
||||
xeIoctlHelper->setVmBindUserFence(vmBindParams, vmBindExtUserFence);
|
||||
|
||||
EXPECT_EQ(0, xeIoctlHelper->vmBind(vmBindParams));
|
||||
auto &waitUserFence = drm->waitUserFenceInputs[0];
|
||||
EXPECT_EQ(expectedTimeout, waitUserFence.timeout);
|
||||
EXPECT_EQ(0u, drm->waitUserFenceInputs.size());
|
||||
drm->waitUserFenceInputs.clear();
|
||||
EXPECT_EQ(0, xeIoctlHelper->vmUnbind(vmBindParams));
|
||||
waitUserFence = drm->waitUserFenceInputs[0];
|
||||
auto waitUserFence = drm->waitUserFenceInputs[0];
|
||||
EXPECT_EQ(expectedTimeout, waitUserFence.timeout);
|
||||
}
|
||||
|
||||
@@ -1512,7 +1512,7 @@ TEST_F(IoctlHelperXeTest, givenDisabledFtrMultiTileArchWhenCreatingEngineInfoThe
|
||||
|
||||
using IoctlHelperXeFenceWaitTest = ::testing::Test;
|
||||
|
||||
TEST_F(IoctlHelperXeFenceWaitTest, whenCallingVmBindThenWaitUserFenceIsCalled) {
|
||||
TEST_F(IoctlHelperXeFenceWaitTest, whenCallingVmBindThenWaitUserFenceIsCalledOnlyDuringUnbind) {
|
||||
DebugManagerStateRestore restorer;
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
@@ -1539,7 +1539,7 @@ TEST_F(IoctlHelperXeFenceWaitTest, whenCallingVmBindThenWaitUserFenceIsCalled) {
|
||||
EXPECT_EQ(0, xeIoctlHelper->vmBind(vmBindParams));
|
||||
EXPECT_EQ(1u, drm->vmBindInputs.size());
|
||||
EXPECT_EQ(1u, drm->syncInputs.size());
|
||||
EXPECT_EQ(1u, drm->waitUserFenceInputs.size());
|
||||
EXPECT_EQ(0u, drm->waitUserFenceInputs.size());
|
||||
auto expectedMask = std::numeric_limits<uint64_t>::max();
|
||||
auto expectedTimeout = 1000000000ll;
|
||||
{
|
||||
@@ -1547,17 +1547,6 @@ TEST_F(IoctlHelperXeFenceWaitTest, whenCallingVmBindThenWaitUserFenceIsCalled) {
|
||||
|
||||
EXPECT_EQ(fenceAddress, sync.addr);
|
||||
EXPECT_EQ(fenceValue, sync.timeline_value);
|
||||
|
||||
auto &waitUserFence = drm->waitUserFenceInputs[0];
|
||||
|
||||
EXPECT_EQ(fenceAddress, waitUserFence.addr);
|
||||
EXPECT_EQ(static_cast<uint16_t>(DRM_XE_UFENCE_WAIT_OP_EQ), waitUserFence.op);
|
||||
EXPECT_EQ(0u, waitUserFence.flags);
|
||||
EXPECT_EQ(fenceValue, waitUserFence.value);
|
||||
EXPECT_EQ(expectedMask, waitUserFence.mask);
|
||||
EXPECT_EQ(expectedTimeout, waitUserFence.timeout);
|
||||
EXPECT_EQ(0u, waitUserFence.exec_queue_id);
|
||||
|
||||
EXPECT_EQ(expectedFlags, drm->vmBindInputs[0].bind.flags);
|
||||
}
|
||||
drm->vmBindInputs.clear();
|
||||
@@ -1587,7 +1576,7 @@ TEST_F(IoctlHelperXeFenceWaitTest, whenCallingVmBindThenWaitUserFenceIsCalled) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(IoctlHelperXeTest, givenVmBindWaitUserFenceTimeoutWhenCallingVmBindThenWaitUserFenceIsCalledWithSpecificTimeout) {
|
||||
TEST_F(IoctlHelperXeTest, givenVmBindWaitUserFenceTimeoutWhenCallingVmUnBindThenWaitUserFenceIsCalledWithSpecificTimeout) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.VmBindWaitUserFenceTimeout.set(5000000000ll);
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
@@ -1613,7 +1602,7 @@ TEST_F(IoctlHelperXeTest, givenVmBindWaitUserFenceTimeoutWhenCallingVmBindThenWa
|
||||
EXPECT_EQ(0u, vmBindParams.flags);
|
||||
vmBindParams.flags = 0x12345; // set non-zero to check if flags are passed
|
||||
auto expectedFlags = vmBindParams.flags;
|
||||
EXPECT_EQ(0, xeIoctlHelper->vmBind(vmBindParams));
|
||||
EXPECT_EQ(0, xeIoctlHelper->vmUnbind(vmBindParams));
|
||||
EXPECT_EQ(1u, drm->vmBindInputs.size());
|
||||
EXPECT_EQ(1u, drm->syncInputs.size());
|
||||
EXPECT_EQ(1u, drm->waitUserFenceInputs.size());
|
||||
@@ -1689,7 +1678,6 @@ TEST_F(IoctlHelperXeTest, whenUserFenceFailsThenErrorIsPropagated) {
|
||||
int errorValue = -1;
|
||||
drm->waitUserFenceReturn = errorValue;
|
||||
|
||||
EXPECT_EQ(errorValue, xeIoctlHelper->vmBind(vmBindParams));
|
||||
EXPECT_EQ(errorValue, xeIoctlHelper->vmUnbind(vmBindParams));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user