From c3ed6e062aa9ba707e7ed2e32fc582f301ad305b Mon Sep 17 00:00:00 2001 From: Szymon Morek Date: Tue, 10 Dec 2024 09:25:56 +0000 Subject: [PATCH] performance: enable timestamp reuse on linux Related-To: NEO-13456 Signed-off-by: Szymon Morek --- shared/source/os_interface/linux/device_time_drm.cpp | 2 +- shared/source/os_interface/linux/ioctl_helper.h | 2 ++ shared/source/os_interface/linux/xe/ioctl_helper_xe.h | 1 + .../os_interface/linux/xe/ioctl_helper_xe_tests.cpp | 7 +++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/shared/source/os_interface/linux/device_time_drm.cpp b/shared/source/os_interface/linux/device_time_drm.cpp index e107958d1e..cb59f8ada9 100644 --- a/shared/source/os_interface/linux/device_time_drm.cpp +++ b/shared/source/os_interface/linux/device_time_drm.cpp @@ -61,7 +61,7 @@ uint64_t DeviceTimeDrm::getDynamicDeviceTimerClock() const { } bool DeviceTimeDrm::isTimestampsRefreshEnabled() const { - bool timestampsRefreshEnabled = false; + bool timestampsRefreshEnabled = pDrm->getIoctlHelper()->isTimestampsRefreshEnabled(); if (debugManager.flags.EnableReusingGpuTimestamps.get() != -1) { timestampsRefreshEnabled = debugManager.flags.EnableReusingGpuTimestamps.get(); } diff --git a/shared/source/os_interface/linux/ioctl_helper.h b/shared/source/os_interface/linux/ioctl_helper.h index d30df35780..ada6ab4192 100644 --- a/shared/source/os_interface/linux/ioctl_helper.h +++ b/shared/source/os_interface/linux/ioctl_helper.h @@ -234,6 +234,8 @@ class IoctlHelper { virtual bool queryDeviceParams(uint32_t *moduleId, uint16_t *serverType) { return false; } + virtual bool isTimestampsRefreshEnabled() { return false; } + protected: Drm &drm; ExternalCtx *externalCtx = nullptr; diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h index 929238fc3f..ec6cec645f 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h @@ -132,6 +132,7 @@ class IoctlHelperXe : public IoctlHelper { void registerBOBindHandle(Drm *drm, DrmAllocation *drmAllocation) override; bool resourceRegistrationEnabled() override { return true; } bool isPreemptionSupported() override { return true; } + bool isTimestampsRefreshEnabled() override { return true; } protected: static constexpr uint32_t maxContextSetProperties = 4; diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp index a9eb48dc5e..2e2875ff57 100644 --- a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp @@ -2566,3 +2566,10 @@ TEST(IoctlHelperXeTest, givenIoctlFailureWhenCallingSetVmPrefetchThenFalseIsRetu EXPECT_FALSE(xeIoctlHelper->setVmPrefetch(0u, 0u, 0u, 0u)); EXPECT_EQ(0u, drm->vmBindInputs.size()); } + +TEST(IoctlHelperXeTest, givenXeIoctlHelperWhenIsTimestampsRefreshEnabledCalledThenReturnTrue) { + auto executionEnvironment = std::make_unique(); + DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]}; + auto xeIoctlHelper = std::make_unique(drm); + EXPECT_TRUE(xeIoctlHelper->isTimestampsRefreshEnabled()); +} \ No newline at end of file