refactor: modify sip kernel helpers

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska 2024-01-08 16:22:40 +00:00 committed by Compute-Runtime-Automation
parent 8df4dab1a3
commit 5d2d3ed899
8 changed files with 24 additions and 22 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -216,11 +216,12 @@ TEST_F(DeviceFactoryTest, WhenOverridingEngineTypeThenDebugEngineIsReported) {
TEST_F(DeviceFactoryTest, givenPointerToHwInfoWhenGetDevicedCalledThenRequiedSurfaceSizeIsSettedProperly) {
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
ASSERT_TRUE(success);
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
auto &rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0];
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
const auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
const auto &gfxCoreHelper = rootDeviceEnvironment->getHelper<GfxCoreHelper>();
auto expextedSize = static_cast<size_t>(hwInfo->gtSystemInfo.CsrSizeInMb * MemoryConstants::megaByte);
gfxCoreHelper.adjustPreemptionSurfaceSize(expextedSize);
gfxCoreHelper.adjustPreemptionSurfaceSize(expextedSize, *rootDeviceEnvironment);
EXPECT_EQ(expextedSize, hwInfo->capabilityTable.requiredPreemptionSurfaceSize);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -208,7 +208,7 @@ bool SipKernel::initHexadecimalArraySipKernel(SipKernelType type, Device &device
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
auto &gfxCoreHelper = device.getGfxCoreHelper();
gfxCoreHelper.setSipKernelData(sipKernelBinary, kernelBinarySize);
gfxCoreHelper.setSipKernelData(sipKernelBinary, kernelBinarySize, rootDeviceEnvironment);
const auto allocType = AllocationType::kernelIsaInternal;
AllocationProperties properties = {rootDeviceIndex, kernelBinarySize, allocType, device.getDeviceBitfield()};
properties.flags.use32BitFrontWindow = false;

View File

@ -143,8 +143,8 @@ class GfxCoreHelper {
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
virtual bool isSipKernelAsHexadecimalArrayPreferred() const = 0;
virtual void setSipKernelData(uint32_t *&sipKernelBinary, size_t &kernelBinarySize) const = 0;
virtual void adjustPreemptionSurfaceSize(size_t &csrSize) const = 0;
virtual void setSipKernelData(uint32_t *&sipKernelBinary, size_t &kernelBinarySize, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
virtual void adjustPreemptionSurfaceSize(size_t &csrSize, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
virtual size_t getSamplerStateSize() const = 0;
virtual bool preferInternalBcsEngine() const = 0;
virtual bool isScratchSpaceSurfaceStateAccessible() const = 0;
@ -363,9 +363,9 @@ class GfxCoreHelperHw : public GfxCoreHelper {
bool isSipKernelAsHexadecimalArrayPreferred() const override;
void setSipKernelData(uint32_t *&sipKernelBinary, size_t &kernelBinarySize) const override;
void setSipKernelData(uint32_t *&sipKernelBinary, size_t &kernelBinarySize, const RootDeviceEnvironment &rootDeviceEnvironment) const override;
void adjustPreemptionSurfaceSize(size_t &csrSize) const override;
void adjustPreemptionSurfaceSize(size_t &csrSize, const RootDeviceEnvironment &rootDeviceEnvironment) const override;
bool isScratchSpaceSurfaceStateAccessible() const override;
uint32_t getMaxScratchSize() const override;
bool preferInternalBcsEngine() const override;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2023 Intel Corporation
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -595,7 +595,7 @@ bool GfxCoreHelperHw<GfxFamily>::isSipKernelAsHexadecimalArrayPreferred() const
}
template <typename GfxFamily>
void GfxCoreHelperHw<GfxFamily>::setSipKernelData(uint32_t *&sipKernelBinary, size_t &kernelBinarySize) const {
void GfxCoreHelperHw<GfxFamily>::setSipKernelData(uint32_t *&sipKernelBinary, size_t &kernelBinarySize, const RootDeviceEnvironment &rootDeviceEnvironment) const {
}
template <typename GfxFamily>
@ -604,7 +604,7 @@ size_t GfxCoreHelperHw<GfxFamily>::getSipKernelMaxDbgSurfaceSize(const HardwareI
}
template <typename GfxFamily>
void GfxCoreHelperHw<GfxFamily>::adjustPreemptionSurfaceSize(size_t &csrSize) const {
void GfxCoreHelperHw<GfxFamily>::adjustPreemptionSurfaceSize(size_t &csrSize, const RootDeviceEnvironment &rootDeviceEnvironment) const {
}
template <typename GfxFamily>

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -164,7 +164,7 @@ int ProductHelper::configureHwInfoDrm(const HardwareInfo *inHwInfo, HardwareInfo
static_cast<bool>(outHwInfo->featureTable.flags.ftrGpGpuMidBatchPreempt) && preemption);
outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->gtSystemInfo.CsrSizeInMb * MemoryConstants::megaByte;
gfxCoreHelper.adjustPreemptionSurfaceSize(outHwInfo->capabilityTable.requiredPreemptionSurfaceSize);
gfxCoreHelper.adjustPreemptionSurfaceSize(outHwInfo->capabilityTable.requiredPreemptionSurfaceSize, rootDeviceEnvironment);
auto &kmdNotifyProperties = outHwInfo->capabilityTable.kmdNotifyProperties;
KmdNotifyHelper::overrideFromDebugVariable(debugManager.flags.OverrideEnableKmdNotify.get(), kmdNotifyProperties.enableKmdNotify);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -38,7 +38,7 @@ int ProductHelper::configureHwInfoWddm(const HardwareInfo *inHwInfo, HardwareInf
outHwInfo->gtSystemInfo.CsrSizeInMb = static_cast<uint32_t>(debugManager.flags.OverridePreemptionSurfaceSizeInMb.get());
}
outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->gtSystemInfo.CsrSizeInMb * MemoryConstants::megaByte;
gfxCoreHelper.adjustPreemptionSurfaceSize(outHwInfo->capabilityTable.requiredPreemptionSurfaceSize);
gfxCoreHelper.adjustPreemptionSurfaceSize(outHwInfo->capabilityTable.requiredPreemptionSurfaceSize, rootDeviceEnvironment);
auto &kmdNotifyProperties = outHwInfo->capabilityTable.kmdNotifyProperties;
KmdNotifyHelper::overrideFromDebugVariable(debugManager.flags.OverrideEnableKmdNotify.get(), kmdNotifyProperties.enableKmdNotify);

View File

@ -1193,7 +1193,7 @@ HWTEST_F(GfxCoreHelperTest, whenAdjustPreemptionSurfaceSizeIsCalledThenCsrSizeDo
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
size_t csrSize = 1024;
size_t oldCsrSize = csrSize;
gfxCoreHelper.adjustPreemptionSurfaceSize(csrSize);
gfxCoreHelper.adjustPreemptionSurfaceSize(csrSize, pDevice->getRootDeviceEnvironment());
EXPECT_EQ(oldCsrSize, csrSize);
}
@ -1203,7 +1203,7 @@ HWTEST_F(GfxCoreHelperTest, whenSetSipKernelDataIsCalledThenSipKernelDataDoesntC
uint32_t *oldSipKernelBinary = sipKernelBinary;
size_t kernelBinarySize = 1024;
size_t oldKernelBinarySize = kernelBinarySize;
gfxCoreHelper.setSipKernelData(sipKernelBinary, kernelBinarySize);
gfxCoreHelper.setSipKernelData(sipKernelBinary, kernelBinarySize, pDevice->getRootDeviceEnvironment());
EXPECT_EQ(oldKernelBinarySize, kernelBinarySize);
EXPECT_EQ(oldSipKernelBinary, sipKernelBinary);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -311,8 +311,9 @@ TEST_F(MockProductHelperTestLinux, givenPointerToHwInfoWhenConfigureHwInfoCalled
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
EXPECT_EQ(0, ret);
auto expectedSize = static_cast<size_t>(outHwInfo.gtSystemInfo.CsrSizeInMb * MemoryConstants::megaByte);
auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
gfxCoreHelper.adjustPreemptionSurfaceSize(expectedSize);
auto &rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0];
auto &gfxCoreHelper = rootDeviceEnvironment->getHelper<GfxCoreHelper>();
gfxCoreHelper.adjustPreemptionSurfaceSize(expectedSize, *rootDeviceEnvironment);
EXPECT_EQ(expectedSize, outHwInfo.capabilityTable.requiredPreemptionSurfaceSize);
}