mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Move hwHelper ownership to RootDeviceEnvironment 2/n
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com> UseRootDeviceEnvironment getHelper<CoreHelper> for: - getMaxBarrierRegisterPerSlice - getPaddingForISAAllocation
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
10c12bb3a7
commit
002a90c717
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -117,8 +117,8 @@ void KernelDataTest::buildAndDecode() {
|
||||
auto kernelAllocation = pKernelInfo->getGraphicsAllocation();
|
||||
UNRECOVERABLE_IF(kernelAllocation == nullptr);
|
||||
auto &device = pContext->getDevice(0)->getDevice();
|
||||
auto &hwHelper = NEO::HwHelper::get(device.getHardwareInfo().platform.eRenderCoreFamily);
|
||||
size_t isaPadding = hwHelper.getPaddingForISAAllocation();
|
||||
auto &helper = device.getRootDeviceEnvironment().getHelper<CoreHelper>();
|
||||
size_t isaPadding = helper.getPaddingForISAAllocation();
|
||||
EXPECT_EQ(kernelAllocation->getUnderlyingBufferSize(), kernelHeapSize + isaPadding);
|
||||
auto kernelIsa = kernelAllocation->getUnderlyingBuffer();
|
||||
EXPECT_EQ(0, memcmp(kernelIsa, pKernelInfo->heapInfo.pKernelHeap, kernelHeapSize));
|
||||
|
@ -35,7 +35,7 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, givenTglLpThenAuxTranslationIsRequired) {
|
||||
}
|
||||
|
||||
GEN12LPTEST_F(HwHelperTestGen12Lp, WhenGettingMaxBarriersPerSliceThenCorrectSizeIsReturned) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
auto &helper = getHelper<CoreHelper>();
|
||||
EXPECT_EQ(32u, helper.getMaxBarrierRegisterPerSlice());
|
||||
}
|
||||
|
||||
@ -359,9 +359,9 @@ HWTEST2_F(HwHelperTestGen12Lp, givenRevisionEnumThenProperValueForIsWorkaroundRe
|
||||
std::vector<unsigned short> steppings;
|
||||
HardwareInfo hardwareInfo = *defaultHwInfo;
|
||||
|
||||
steppings.push_back(0x0); //A0
|
||||
steppings.push_back(0x4); //B0
|
||||
steppings.push_back(0x5); //undefined
|
||||
steppings.push_back(0x0); // A0
|
||||
steppings.push_back(0x4); // B0
|
||||
steppings.push_back(0x5); // undefined
|
||||
|
||||
for (auto stepping : steppings) {
|
||||
hardwareInfo.platform.usRevId = stepping;
|
||||
@ -380,9 +380,9 @@ HWTEST2_F(HwHelperTestGen12Lp, givenRevisionEnumThenProperValueForIsWorkaroundRe
|
||||
std::vector<unsigned short> steppings;
|
||||
HardwareInfo hardwareInfo = *defaultHwInfo;
|
||||
|
||||
steppings.push_back(0x0); //A0
|
||||
steppings.push_back(0x4); //B0
|
||||
steppings.push_back(0x5); //undefined
|
||||
steppings.push_back(0x0); // A0
|
||||
steppings.push_back(0x4); // B0
|
||||
steppings.push_back(0x5); // undefined
|
||||
|
||||
for (auto stepping : steppings) {
|
||||
hardwareInfo.platform.usRevId = stepping;
|
||||
|
@ -2334,18 +2334,18 @@ TEST(KernelInfoTest, GivenArgNameWhenGettingArgNumberByNameThenCorrectValueIsRet
|
||||
|
||||
TEST(KernelInfoTest, givenHwHelperWhenCreatingKernelAllocationThenCorrectPaddingIsAdded) {
|
||||
|
||||
std::unique_ptr<MockClDevice> clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get(), mockRootDeviceIndex));
|
||||
std::unique_ptr<MockContext> context = std::make_unique<MockContext>(clDevice.get());
|
||||
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get(), mockRootDeviceIndex));
|
||||
auto context = std::make_unique<MockContext>(clDevice.get());
|
||||
|
||||
std::unique_ptr<MockKernelWithInternals> mockKernel = std::make_unique<MockKernelWithInternals>(*clDevice, context.get());
|
||||
auto mockKernel = std::make_unique<MockKernelWithInternals>(*clDevice, context.get());
|
||||
uint32_t kernelHeap = 0;
|
||||
mockKernel->kernelInfo.heapInfo.KernelHeapSize = 1;
|
||||
mockKernel->kernelInfo.heapInfo.pKernelHeap = &kernelHeap;
|
||||
mockKernel->kernelInfo.createKernelAllocation(clDevice->getDevice(), false);
|
||||
|
||||
auto graphicsAllocation = mockKernel->kernelInfo.getGraphicsAllocation();
|
||||
auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
|
||||
size_t isaPadding = hwHelper.getPaddingForISAAllocation();
|
||||
auto &helper = clDevice->getRootDeviceEnvironment().getHelper<CoreHelper>();
|
||||
size_t isaPadding = helper.getPaddingForISAAllocation();
|
||||
EXPECT_EQ(graphicsAllocation->getUnderlyingBufferSize(), mockKernel->kernelInfo.heapInfo.KernelHeapSize + isaPadding);
|
||||
clDevice->getMemoryManager()->freeGraphicsMemory(mockKernel->kernelInfo.getGraphicsAllocation());
|
||||
}
|
||||
|
@ -27,7 +27,8 @@ TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithGreaterSizeT
|
||||
auto firstAllocation = kernel.kernelInfo.kernelAllocation;
|
||||
EXPECT_NE(nullptr, firstAllocation);
|
||||
auto firstAllocationSize = firstAllocation->getUnderlyingBufferSize();
|
||||
size_t isaPadding = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getPaddingForISAAllocation();
|
||||
auto &helper = pClDevice->getRootDeviceEnvironment().getHelper<CoreHelper>();
|
||||
size_t isaPadding = helper.getPaddingForISAAllocation();
|
||||
EXPECT_EQ(firstAllocationSize, initialHeapSize + isaPadding);
|
||||
|
||||
auto firstAllocationId = static_cast<MemoryAllocation *>(firstAllocation)->id;
|
||||
@ -58,7 +59,8 @@ TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithSameSizeThen
|
||||
auto firstAllocation = kernel.kernelInfo.kernelAllocation;
|
||||
EXPECT_NE(nullptr, firstAllocation);
|
||||
auto firstAllocationSize = firstAllocation->getUnderlyingBufferSize();
|
||||
size_t isaPadding = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getPaddingForISAAllocation();
|
||||
auto &helper = pClDevice->getRootDeviceEnvironment().getHelper<CoreHelper>();
|
||||
size_t isaPadding = helper.getPaddingForISAAllocation();
|
||||
EXPECT_EQ(firstAllocationSize, initialHeapSize + isaPadding);
|
||||
|
||||
auto firstAllocationId = static_cast<MemoryAllocation *>(firstAllocation)->id;
|
||||
@ -88,7 +90,8 @@ TEST_F(KernelSubstituteTest, givenKernelWhenSubstituteKernelHeapWithSmallerSizeT
|
||||
auto firstAllocation = kernel.kernelInfo.kernelAllocation;
|
||||
EXPECT_NE(nullptr, firstAllocation);
|
||||
auto firstAllocationSize = firstAllocation->getUnderlyingBufferSize();
|
||||
size_t isaPadding = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getPaddingForISAAllocation();
|
||||
auto &helper = pClDevice->getRootDeviceEnvironment().getHelper<CoreHelper>();
|
||||
size_t isaPadding = helper.getPaddingForISAAllocation();
|
||||
EXPECT_EQ(firstAllocationSize, initialHeapSize + isaPadding);
|
||||
|
||||
auto firstAllocationId = static_cast<MemoryAllocation *>(firstAllocation)->id;
|
||||
|
@ -45,7 +45,8 @@ TEST(KernelInfoTest, givenKernelInfoWhenCreateKernelAllocationThenCopyWholeKerne
|
||||
EXPECT_TRUE(retVal);
|
||||
auto allocation = kernelInfo.kernelAllocation;
|
||||
EXPECT_EQ(0, memcmp(allocation->getUnderlyingBuffer(), heap, heapSize));
|
||||
size_t isaPadding = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getPaddingForISAAllocation();
|
||||
auto &helper = device->getRootDeviceEnvironment().getHelper<CoreHelper>();
|
||||
size_t isaPadding = helper.getPaddingForISAAllocation();
|
||||
EXPECT_EQ(allocation->getUnderlyingBufferSize(), heapSize + isaPadding);
|
||||
device->getMemoryManager()->checkGpuUsageAndDestroyGraphicsAllocations(allocation);
|
||||
}
|
||||
|
@ -493,8 +493,8 @@ TEST_F(ProgramFromBinaryTest, givenProgramWhenItIsBeingBuildThenItContainsGraphi
|
||||
auto graphicsAllocation = kernelInfo->getGraphicsAllocation();
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
EXPECT_TRUE(graphicsAllocation->is32BitAllocation());
|
||||
auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
|
||||
size_t isaPadding = hwHelper.getPaddingForISAAllocation();
|
||||
auto &helper = pDevice->getRootDeviceEnvironment().getHelper<CoreHelper>();
|
||||
size_t isaPadding = helper.getPaddingForISAAllocation();
|
||||
EXPECT_EQ(graphicsAllocation->getUnderlyingBufferSize(), kernelInfo->heapInfo.KernelHeapSize + isaPadding);
|
||||
|
||||
auto kernelIsa = graphicsAllocation->getUnderlyingBuffer();
|
||||
|
Reference in New Issue
Block a user