feature: add new product helper for scratch space base pointer

Related-To: NEO-16700

Signed-off-by: Wesley Waugh <wesley.waugh@intel.com>
This commit is contained in:
Wesley Waugh
2025-11-17 23:53:25 +00:00
committed by Compute-Runtime-Automation
parent 5e126ebd5e
commit fce9aa1cb2
9 changed files with 56 additions and 2 deletions

View File

@@ -142,6 +142,9 @@ struct DebugSessionImp : DebugSession {
ze_result_t readSbaRegisters(EuThread::ThreadId thread, uint32_t start, uint32_t count, void *pRegisterValues);
ze_result_t readModeFlags(uint32_t start, uint32_t count, void *pRegisterValues);
ze_result_t readDebugScratchRegisters(uint32_t start, uint32_t count, void *pRegisterValues);
ze_result_t getScratchRenderSurfaceStateAddress(EuThread::ThreadId thread, uint64_t *result);
ze_result_t getScratchRenderSurfaceStateAddressV1(EuThread::ThreadId thread, uint64_t *result);
MOCKABLE_VIRTUAL ze_result_t getScratchRenderSurfaceStateAddressV2(EuThread::ThreadId thread, uint64_t *result);
MOCKABLE_VIRTUAL ze_result_t readThreadScratchRegisters(EuThread::ThreadId thread, uint32_t start, uint32_t count, void *pRegisterValues);
MOCKABLE_VIRTUAL bool isForceExceptionOrForceExternalHaltOnlyExceptionReason(uint32_t *cr0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,6 +9,18 @@
namespace L0 {
ze_result_t DebugSessionImp::getScratchRenderSurfaceStateAddressV1(EuThread::ThreadId threadId, uint64_t *result) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t DebugSessionImp::getScratchRenderSurfaceStateAddressV2(EuThread::ThreadId threadId, uint64_t *result) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t DebugSessionImp::getScratchRenderSurfaceStateAddress(EuThread::ThreadId threadId, uint64_t *result) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t DebugSessionImp::readThreadScratchRegisters(EuThread::ThreadId threadId, uint32_t start, uint32_t count, void *pRegisterValues) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

View File

@@ -8,6 +8,7 @@
#include "level_zero/tools/test/unit_tests/sources/debug/debug_session_registers_access.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_product_helper.h"
#include "level_zero/core/test/unit_tests/mocks/mock_device.h"
#include "level_zero/tools/test/unit_tests/sources/debug/mock_debug_session.h"
@@ -30,6 +31,17 @@ void DebugSessionRegistersAccessV3::setUp() {
session->allThreads[stoppedThreadId]->reportAsStopped();
}
void setIsScratchInGrf(NEO::MockDevice *neoDevice, bool value) {
auto mockProductHelper = std::make_unique<NEO::MockProductHelper>();
mockProductHelper->isScratchSpaceBasePointerInGrfResult = value;
neoDevice->getRootDeviceEnvironmentRef().productHelper = std::move(mockProductHelper);
}
void DebugSessionRegistersAccessScratchV3::setUp() {
DebugSessionRegistersAccessV3::setUp();
setIsScratchInGrf(neoDevice, true);
}
void DebugSessionRegistersAccess::setUp() {
zet_debug_config_t config = {};
config.pid = 0x1234;
@@ -44,6 +56,11 @@ void DebugSessionRegistersAccess::setUp() {
session->allThreads[stoppedThreadId]->reportAsStopped();
}
void DebugSessionRegistersAccessScratch::setUp() {
DebugSessionRegistersAccess::setUp();
setIsScratchInGrf(neoDevice, true);
}
void DebugSessionRegistersAccess::tearDown() {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -37,5 +37,15 @@ struct DebugSessionRegistersAccessV3 : public DebugSessionRegistersAccess {
void setUp() override;
};
struct DebugSessionRegistersAccessScratch : public DebugSessionRegistersAccess {
void setUp() override;
};
struct DebugSessionRegistersAccessScratchV3 : public DebugSessionRegistersAccessV3 {
void setUp() override;
};
void setIsScratchInGrf(NEO::MockDevice *neoDevice, bool value);
} // namespace ult
} // namespace L0

View File

@@ -282,6 +282,7 @@ class ProductHelper {
virtual bool isDeviceCapsReaderSupported() const = 0;
virtual bool isMediaContextSupported() const = 0;
virtual bool sipUsesSubslicePools() const = 0;
virtual bool isScratchSpaceBasePointerInGrf() const = 0;
virtual uint32_t getActualHwSlmSize(const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;

View File

@@ -1121,4 +1121,9 @@ bool ProductHelperHw<gfxProduct>::sipUsesSubslicePools() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isScratchSpaceBasePointerInGrf() const {
return true;
}
} // namespace NEO

View File

@@ -220,6 +220,7 @@ class ProductHelperHw : public ProductHelper {
bool isDeviceCapsReaderSupported() const override;
bool isMediaContextSupported() const override;
bool sipUsesSubslicePools() const override;
bool isScratchSpaceBasePointerInGrf() const override;
~ProductHelperHw() override = default;

View File

@@ -35,5 +35,6 @@ struct MockProductHelper : ProductHelperHw<IGFX_UNKNOWN> {
ADDMETHOD_CONST_NOBASE(isDeviceCapsReaderSupported, bool, false, ());
ADDMETHOD_CONST_NOBASE(initializeInternalEngineImmediately, bool, true, ());
ADDMETHOD_CONST_NOBASE(sipUsesSubslicePools, bool, false, ());
ADDMETHOD_CONST_NOBASE(isScratchSpaceBasePointerInGrf, bool, true, ());
};
} // namespace NEO

View File

@@ -1319,4 +1319,8 @@ HWTEST_F(ProductHelperTest, givenProductHelperWhenAskingIsMediaContextSupportedT
HWTEST_F(ProductHelperTest, givenProductHelperWhenSipDoesNotSupportSubslicePoolsThenFalseReturned) {
EXPECT_FALSE(productHelper->sipUsesSubslicePools());
}
HWTEST_F(ProductHelperTest, givenProductHelperWhenScratchSpacePointerIsInGrfThenTrueIsReturned) {
EXPECT_TRUE(productHelper->isScratchSpaceBasePointerInGrf());
}