diff --git a/level_zero/tools/source/debug/debug_session.h b/level_zero/tools/source/debug/debug_session.h index 686b087e80..b2c85870aa 100644 --- a/level_zero/tools/source/debug/debug_session.h +++ b/level_zero/tools/source/debug/debug_session.h @@ -79,6 +79,7 @@ struct DebugSession : _zet_debug_session_handle_t { virtual bool isBindlessSystemRoutine(); virtual bool readModuleDebugArea() = 0; + virtual ze_result_t readSbaBuffer(EuThread::ThreadId threadId, SbaTrackedAddresses &sbaBuffer) = 0; void fillDevicesFromThread(ze_device_thread_t thread, std::vector &devices); diff --git a/level_zero/tools/test/unit_tests/sources/debug/mock_debug_session.h b/level_zero/tools/test/unit_tests/sources/debug/mock_debug_session.h index d106c33466..a6e329f82b 100644 --- a/level_zero/tools/test/unit_tests/sources/debug/mock_debug_session.h +++ b/level_zero/tools/test/unit_tests/sources/debug/mock_debug_session.h @@ -62,6 +62,9 @@ struct DebugSessionMock : public L0::DebugSession { ze_result_t writeRegisters(ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void *pRegisterValues) override { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } + ze_result_t readSbaBuffer(EuThread::ThreadId threadId, SbaTrackedAddresses &sbaBuffer) override { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } void startAsyncThread() override { asyncThreadStarted = true; } diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index 6c9e36f38a..087c8a8f7f 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -1318,3 +1318,23 @@ HWTEST2_F(HwHelperTest, givenXeHPAndBelowPlatformPlatformWhenCheckingIfEngineTyp const auto &hwHelper = HwHelper::get(renderCoreFamily); EXPECT_FALSE(hwHelper.isEngineTypeRemappingToHwSpecificRequired()); } + +HWTEST2_F(HwHelperTest, givenAtMostGen12lpPlatformiWhenCheckingIfScratchSpaceSurfaceStateAccessibleThenFalseIsReturned, IsAtMostGen12lp) { + const auto &hwHelper = HwHelper::get(renderCoreFamily); + EXPECT_FALSE(hwHelper.isScratchSpaceSurfaceStateAccessible()); +} + +HWTEST2_F(HwHelperTest, givenAtLeastXeHpPlatformWhenCheckingIfScratchSpaceSurfaceStateAccessibleTheniTrueIsReturned, IsAtLeastXeHpCore) { + const auto &hwHelper = HwHelper::get(renderCoreFamily); + EXPECT_TRUE(hwHelper.isScratchSpaceSurfaceStateAccessible()); +} + +HWTEST_F(HwHelperTest, givenGetRenderSurfaceStateBaseAddressCalledThenCorrectValueIsReturned) { + using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; + + RENDER_SURFACE_STATE renderSurfaceState; + uint64_t expectedBaseAddress = 0x1122334455667788; + renderSurfaceState.setSurfaceBaseAddress(expectedBaseAddress); + const auto &hwHelper = HwHelper::get(renderCoreFamily); + EXPECT_EQ(expectedBaseAddress, hwHelper.getRenderSurfaceStateBaseAddress(&renderSurfaceState)); +} diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 5d7017701e..c2b80c12a0 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -146,6 +146,9 @@ class HwHelper { virtual void adjustPreemptionSurfaceSize(size_t &csrSize) const = 0; virtual size_t getSamplerStateSize() const = 0; + virtual bool isScratchSpaceSurfaceStateAccessible() const = 0; + virtual uint64_t getRenderSurfaceStateBaseAddress(void *renderSurfaceState) const = 0; + protected: HwHelper() = default; }; @@ -367,6 +370,9 @@ class HwHelperHw : public HwHelper { void adjustPreemptionSurfaceSize(size_t &csrSize) const override; + bool isScratchSpaceSurfaceStateAccessible() const override; + uint64_t getRenderSurfaceStateBaseAddress(void *renderSurfaceState) const override; + protected: static const AuxTranslationMode defaultAuxTranslationMode; HwHelperHw() = default; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index d29476feb4..11800af6bb 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -626,4 +626,8 @@ template void HwHelperHw::adjustPreemptionSurfaceSize(size_t &csrSize) const { } +template +uint64_t HwHelperHw::getRenderSurfaceStateBaseAddress(void *renderSurfaceState) const { + return reinterpret_cast(renderSurfaceState)->getSurfaceBaseAddress(); +} } // namespace NEO diff --git a/shared/source/helpers/hw_helper_bdw_and_later.inl b/shared/source/helpers/hw_helper_bdw_and_later.inl index 61e004fc90..3e94ae232b 100644 --- a/shared/source/helpers/hw_helper_bdw_and_later.inl +++ b/shared/source/helpers/hw_helper_bdw_and_later.inl @@ -124,4 +124,8 @@ bool HwHelperHw::additionalPipeControlArgsRequired() const { return false; } +template +bool HwHelperHw::isScratchSpaceSurfaceStateAccessible() const { + return false; +} } // namespace NEO diff --git a/shared/source/helpers/hw_helper_xehp_and_later.inl b/shared/source/helpers/hw_helper_xehp_and_later.inl index fe750d737b..21133ba2b4 100644 --- a/shared/source/helpers/hw_helper_xehp_and_later.inl +++ b/shared/source/helpers/hw_helper_xehp_and_later.inl @@ -177,4 +177,9 @@ inline bool HwHelperHw::preferSmallWorkgroupSizeForKernel(const size_ } return true; } + +template +bool HwHelperHw::isScratchSpaceSurfaceStateAccessible() const { + return true; +} } // namespace NEO