mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
Revert "refactor: create new members for storing spill and private memory in ...
This reverts commit 87eb5f554a.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b34e8646ac
commit
f9f9035b95
@@ -74,14 +74,16 @@ TEST_F(ClGetKernelWorkGroupInfoTest, GivenNullDeviceWhenGettingWorkGroupInfoFrom
|
||||
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
}
|
||||
TEST_F(ClGetKernelWorkGroupInfoTests, GivenKernelRequiringScratchSpaceForSpillWhenGettingKernelWorkGroupInfoThenCorrectSpillMemSizeIsReturned) {
|
||||
TEST_F(ClGetKernelWorkGroupInfoTests, GivenKernelRequiringScratchSpaceWhenGettingKernelWorkGroupInfoThenCorrectSpillMemSizeIsReturned) {
|
||||
size_t paramValueSizeRet;
|
||||
cl_ulong paramValue;
|
||||
auto pDevice = castToObject<ClDevice>(testedClDevice);
|
||||
|
||||
MockKernelWithInternals mockKernel(*pDevice);
|
||||
auto spillMemorySize = 1024u;
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.spillFillScratchMemorySize = spillMemorySize;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(1024, 0);
|
||||
|
||||
cl_ulong scratchSpaceSize = static_cast<cl_ulong>(mockKernel.mockKernel->getScratchSize());
|
||||
EXPECT_EQ(scratchSpaceSize, 1024u);
|
||||
|
||||
retVal = clGetKernelWorkGroupInfo(
|
||||
mockKernel.mockMultiDeviceKernel,
|
||||
@@ -93,7 +95,7 @@ TEST_F(ClGetKernelWorkGroupInfoTests, GivenKernelRequiringScratchSpaceForSpillWh
|
||||
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
EXPECT_EQ(paramValueSizeRet, sizeof(cl_ulong));
|
||||
EXPECT_EQ(paramValue, spillMemorySize);
|
||||
EXPECT_EQ(paramValue, scratchSpaceSize);
|
||||
}
|
||||
|
||||
using matcher = IsWithinProducts<IGFX_SKYLAKE, IGFX_DG1>;
|
||||
|
||||
@@ -657,7 +657,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueKernelTest, givenSecondEnqueueWithTheSameScra
|
||||
uint32_t scratchSize = 4096u;
|
||||
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSize;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
auto sizeToProgram = PreambleHelper<FamilyType>::getScratchSizeValueToProgramMediaVfeState(scratchSize);
|
||||
|
||||
@@ -691,14 +691,14 @@ HWTEST_F(EnqueueKernelTest, whenEnqueueingKernelThatRequirePrivateScratchThenPri
|
||||
csr.getMemoryManager()->setForce32BitAllocations(false);
|
||||
size_t off[3] = {0, 0, 0};
|
||||
size_t gws[3] = {1, 1, 1};
|
||||
uint32_t scratchSizeSlot1 = 4096u;
|
||||
uint32_t privateScratchSize = 4096u;
|
||||
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[1] = scratchSizeSlot1;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(privateScratchSize, 1);
|
||||
|
||||
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr);
|
||||
|
||||
EXPECT_EQ(scratchSizeSlot1, csr.requiredScratchSlot1Size);
|
||||
EXPECT_EQ(privateScratchSize, csr.requiredPrivateScratchSize);
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueKernelTest, whenEnqueueKernelWithNoStatelessWriteWhenSbaIsBeingProgrammedThenConstPolicyIsChoosen) {
|
||||
|
||||
@@ -318,7 +318,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueScratchSpaceTests, GivenKernelRequiringScratc
|
||||
auto scratchSize = GetParam().scratchSize;
|
||||
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSize;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
uint32_t sizeToProgram = (scratchSize / static_cast<uint32_t>(MemoryConstants::kiloByte));
|
||||
uint32_t bitValue = 0u;
|
||||
@@ -373,7 +373,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueScratchSpaceTests, GivenKernelRequiringScratc
|
||||
}
|
||||
|
||||
scratchSize *= 2;
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSize;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
auto itorfirstBBEnd = find<typename FamilyType::MI_BATCH_BUFFER_END *>(itorWalker, cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), itorfirstBBEnd);
|
||||
@@ -447,18 +447,18 @@ HWTEST_P(EnqueueKernelWithScratch, GivenKernelRequiringScratchWhenItIsEnqueuedWi
|
||||
auto mockCsr = new MockCsrHw<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
pDevice->resetCommandStreamReceiver(mockCsr);
|
||||
|
||||
uint32_t scratchSizeSlot0 = 1024u;
|
||||
uint32_t scratchSize = 1024u;
|
||||
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSizeSlot0;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
uint32_t sizeToProgram = (scratchSizeSlot0 / static_cast<uint32_t>(MemoryConstants::kiloByte));
|
||||
uint32_t sizeToProgram = (scratchSize / static_cast<uint32_t>(MemoryConstants::kiloByte));
|
||||
uint32_t bitValue = 0u;
|
||||
while (sizeToProgram >>= 1) {
|
||||
bitValue++;
|
||||
}
|
||||
|
||||
auto valueToProgram = PreambleHelper<FamilyType>::getScratchSizeValueToProgramMediaVfeState(scratchSizeSlot0);
|
||||
auto valueToProgram = PreambleHelper<FamilyType>::getScratchSizeValueToProgramMediaVfeState(scratchSize);
|
||||
EXPECT_EQ(bitValue, valueToProgram);
|
||||
|
||||
enqueueKernel<FamilyType, false>(mockKernel);
|
||||
@@ -468,8 +468,8 @@ HWTEST_P(EnqueueKernelWithScratch, GivenKernelRequiringScratchWhenItIsEnqueuedWi
|
||||
EXPECT_TRUE(mockCsr->isMadeResident(graphicsAllocation));
|
||||
|
||||
// Enqueue With ScratchSize bigger than previous
|
||||
scratchSizeSlot0 = 8192;
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSizeSlot0;
|
||||
scratchSize = 8192;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
enqueueKernel<FamilyType, false>(mockKernel);
|
||||
|
||||
@@ -490,7 +490,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueKernelWithScratch, givenDeviceForcing32bitAll
|
||||
auto scratchSize = 1024;
|
||||
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSize;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
enqueueKernel<FamilyType>(mockKernel);
|
||||
auto graphicsAllocation = csr->getScratchAllocation();
|
||||
@@ -519,7 +519,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueKernelWithScratch, givenDeviceForcing32bitAll
|
||||
// now re-try to see if SBA is not programmed
|
||||
|
||||
scratchSize *= 2;
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSize;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
enqueueKernel<FamilyType>(mockKernel);
|
||||
|
||||
|
||||
@@ -26,5 +26,5 @@ TEST_F(MultiDispatchInfoTest, GivenNullKernelWhenCreatingMultiDispatchInfoThenEx
|
||||
|
||||
EXPECT_FALSE(multiDispatchInfo.begin()->usesSlm());
|
||||
EXPECT_FALSE(multiDispatchInfo.begin()->usesStatelessPrintfSurface());
|
||||
EXPECT_EQ(0u, multiDispatchInfo.begin()->getRequiredScratchSize(0u));
|
||||
EXPECT_EQ(0u, multiDispatchInfo.begin()->getRequiredScratchSize());
|
||||
}
|
||||
@@ -587,40 +587,40 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenc
|
||||
}
|
||||
|
||||
struct MockScratchController : public ScratchSpaceController {
|
||||
using ScratchSpaceController::scratchSlot0Allocation;
|
||||
using ScratchSpaceController::scratchSlot1Allocation;
|
||||
using ScratchSpaceController::privateScratchAllocation;
|
||||
using ScratchSpaceController::scratchAllocation;
|
||||
using ScratchSpaceController::ScratchSpaceController;
|
||||
void setRequiredScratchSpace(void *sshBaseAddress,
|
||||
uint32_t scratchSlot,
|
||||
uint32_t requiredPerThreadScratchSizeSlot0,
|
||||
uint32_t requiredPerThreadScratchSizeSlot1,
|
||||
uint32_t requiredPerThreadScratchSize,
|
||||
uint32_t requiredPerThreadPrivateScratchSize,
|
||||
TaskCountType currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) override {
|
||||
if (requiredPerThreadScratchSizeSlot0 > scratchSlot0SizeInBytes) {
|
||||
scratchSlot0SizeInBytes = requiredPerThreadScratchSizeSlot0;
|
||||
scratchSlot0Allocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, requiredPerThreadScratchSizeSlot0});
|
||||
if (requiredPerThreadScratchSize > scratchSizeBytes) {
|
||||
scratchSizeBytes = requiredPerThreadScratchSize;
|
||||
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, requiredPerThreadScratchSize});
|
||||
}
|
||||
if (requiredPerThreadScratchSizeSlot1 > scratchSlot1SizeInBytes) {
|
||||
scratchSlot1SizeInBytes = requiredPerThreadScratchSizeSlot1;
|
||||
scratchSlot1Allocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, requiredPerThreadScratchSizeSlot1});
|
||||
if (requiredPerThreadPrivateScratchSize > privateScratchSizeBytes) {
|
||||
privateScratchSizeBytes = requiredPerThreadPrivateScratchSize;
|
||||
privateScratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, requiredPerThreadPrivateScratchSize});
|
||||
}
|
||||
}
|
||||
uint64_t calculateNewGSH() override { return 0u; };
|
||||
uint64_t getScratchPatchAddress() override { return 0u; };
|
||||
void programHeaps(HeapContainer &heapContainer,
|
||||
uint32_t scratchSlot,
|
||||
uint32_t requiredPerThreadScratchSizeSlot0,
|
||||
uint32_t requiredPerThreadScratchSizeSlot1,
|
||||
uint32_t requiredPerThreadScratchSize,
|
||||
uint32_t requiredPerThreadPrivateScratchSize,
|
||||
TaskCountType currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) override {
|
||||
}
|
||||
void programBindlessSurfaceStateForScratch(BindlessHeapsHelper *heapsHelper,
|
||||
uint32_t requiredPerThreadScratchSizeSlot0,
|
||||
uint32_t requiredPerThreadScratchSizeSlot1,
|
||||
uint32_t requiredPerThreadScratchSize,
|
||||
uint32_t requiredPerThreadPrivateScratchSize,
|
||||
TaskCountType currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
@@ -640,10 +640,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, whenScratchIsRequiredForFirstFlush
|
||||
|
||||
flushTask(*commandStreamReceiver);
|
||||
|
||||
EXPECT_NE(nullptr, scratchController->scratchSlot0Allocation);
|
||||
EXPECT_EQ(nullptr, scratchController->scratchSlot1Allocation);
|
||||
EXPECT_NE(nullptr, scratchController->scratchAllocation);
|
||||
EXPECT_EQ(nullptr, scratchController->privateScratchAllocation);
|
||||
|
||||
auto scratchAllocation = scratchController->scratchSlot0Allocation;
|
||||
auto scratchAllocation = scratchController->scratchAllocation;
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeResident(scratchAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(scratchAllocation));
|
||||
@@ -654,15 +654,15 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, whenScratchIsRequiredForFirstFlush
|
||||
|
||||
flushTask(*commandStreamReceiver); // 2nd flush
|
||||
|
||||
EXPECT_NE(nullptr, scratchController->scratchSlot0Allocation);
|
||||
EXPECT_NE(nullptr, scratchController->scratchSlot1Allocation);
|
||||
EXPECT_NE(nullptr, scratchController->scratchAllocation);
|
||||
EXPECT_NE(nullptr, scratchController->privateScratchAllocation);
|
||||
|
||||
auto scratch1Allocation = scratchController->scratchSlot1Allocation;
|
||||
auto privateScratchAllocation = scratchController->privateScratchAllocation;
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeResident(scratchAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(scratchAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeResident(scratch1Allocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(scratch1Allocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeResident(privateScratchAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(privateScratchAllocation));
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, whenPrivateScratchIsRequiredForFirstFlushAndCommonScratchForSecondFlushThenHandleResidencyProperly) {
|
||||
@@ -675,13 +675,13 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, whenPrivateScratchIsRequiredForFir
|
||||
|
||||
flushTask(*commandStreamReceiver);
|
||||
|
||||
EXPECT_EQ(nullptr, scratchController->scratchSlot0Allocation);
|
||||
EXPECT_NE(nullptr, scratchController->scratchSlot1Allocation);
|
||||
EXPECT_EQ(nullptr, scratchController->scratchAllocation);
|
||||
EXPECT_NE(nullptr, scratchController->privateScratchAllocation);
|
||||
|
||||
auto scratch1Allocation = scratchController->scratchSlot1Allocation;
|
||||
auto privateScratchAllocation = scratchController->privateScratchAllocation;
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeResident(scratch1Allocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(scratch1Allocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeResident(privateScratchAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(privateScratchAllocation));
|
||||
|
||||
commandStreamReceiver->madeResidentGfxAllocations.clear(); // this is only history - we can clean this
|
||||
commandStreamReceiver->madeNonResidentGfxAllocations.clear();
|
||||
@@ -689,15 +689,15 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, whenPrivateScratchIsRequiredForFir
|
||||
|
||||
flushTask(*commandStreamReceiver); // 2nd flush
|
||||
|
||||
EXPECT_NE(nullptr, scratchController->scratchSlot0Allocation);
|
||||
EXPECT_NE(nullptr, scratchController->scratchSlot1Allocation);
|
||||
EXPECT_NE(nullptr, scratchController->scratchAllocation);
|
||||
EXPECT_NE(nullptr, scratchController->privateScratchAllocation);
|
||||
|
||||
auto scratchAllocation = scratchController->scratchSlot0Allocation;
|
||||
auto scratchAllocation = scratchController->scratchAllocation;
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeResident(scratchAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(scratchAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeResident(scratch1Allocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(scratch1Allocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeResident(privateScratchAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(privateScratchAllocation));
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenTwoConsecutiveNdRangeKernelsThenStateBaseAddressIsProgrammedOnceAndScratchAddressInMediaVfeStateIsProgrammedTwiceBothWithCorrectAddress) {
|
||||
@@ -713,7 +713,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenTwoConsecu
|
||||
|
||||
size_t gws = 1;
|
||||
uint32_t scratchSize = 1024;
|
||||
kernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSize;
|
||||
kernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
EXPECT_EQ(false, kernel.mockKernel->isBuiltIn);
|
||||
|
||||
@@ -786,7 +786,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenTwoConsecu
|
||||
|
||||
// now re-try to see if SBA is not programmed
|
||||
scratchSize *= 2;
|
||||
kernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSize;
|
||||
kernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
commandQueue.enqueueKernel(kernel, 1, nullptr, &gws, nullptr, 0, nullptr, nullptr);
|
||||
|
||||
@@ -827,7 +827,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenNdRangeKer
|
||||
|
||||
size_t gws = 1;
|
||||
uint32_t scratchSize = 1024;
|
||||
kernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = scratchSize;
|
||||
kernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
EXPECT_EQ(false, kernel.mockKernel->isBuiltIn);
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch
|
||||
mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 0u, 10u, 0u, 1u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, vfeStateDirty);
|
||||
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
mockCsr->requiredScratchSlot0Size = 0x200000;
|
||||
mockCsr->requiredScratchSize = 0x200000;
|
||||
|
||||
mockCsr->programVFEState(commandStream, flags, 10);
|
||||
ASSERT_EQ(1u, mockCsr->getFlatBatchBufferHelper().getPatchInfoCollection().size());
|
||||
@@ -310,7 +310,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch
|
||||
mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 0u, 10u, 0u, 1u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, vfeStateDirty);
|
||||
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
mockCsr->requiredScratchSlot0Size = 0x200000;
|
||||
mockCsr->requiredScratchSize = 0x200000;
|
||||
|
||||
mockCsr->programVFEState(commandStream, flags, 10);
|
||||
EXPECT_EQ(0u, mockCsr->getFlatBatchBufferHelper().getPatchInfoCollection().size());
|
||||
@@ -327,7 +327,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch
|
||||
mockCsr->overwriteFlatBatchBufferHelper(new MockFlatBatchBufferHelper<FamilyType>(*pDevice->executionEnvironment));
|
||||
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
mockCsr->requiredScratchSlot0Size = 0x200000;
|
||||
mockCsr->requiredScratchSize = 0x200000;
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor(DeviceBitfield(8)));
|
||||
mockCsr->setupContext(osContext);
|
||||
|
||||
|
||||
@@ -485,8 +485,8 @@ HWTEST_F(CommandStreamReceiverHwTest, WhenScratchSpaceIsNotRequiredThenScratchAl
|
||||
scratchController->setRequiredScratchSpace(reinterpret_cast<void *>(0x2000), 0u, 0u, 0u, 0u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
|
||||
EXPECT_FALSE(cfeStateDirty);
|
||||
EXPECT_FALSE(stateBaseAddressDirty);
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceSlot0Allocation());
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceSlot1Allocation());
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceAllocation());
|
||||
EXPECT_EQ(nullptr, scratchController->getPrivateScratchSpaceAllocation());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverHwTest, WhenScratchSpaceIsRequiredThenCorrectAddressIsReturned) {
|
||||
@@ -501,7 +501,7 @@ HWTEST_F(CommandStreamReceiverHwTest, WhenScratchSpaceIsRequiredThenCorrectAddre
|
||||
scratchController->setRequiredScratchSpace(surfaceHeap.get(), 0u, 0x1000u, 0u, 0u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
|
||||
|
||||
uint64_t expectedScratchAddress = 0xAAABBBCCCDDD000ull;
|
||||
auto scratchAllocation = scratchController->getScratchSpaceSlot0Allocation();
|
||||
auto scratchAllocation = scratchController->getScratchSpaceAllocation();
|
||||
auto gmmHelper = pDevice->getGmmHelper();
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(expectedScratchAddress);
|
||||
scratchAllocation->setCpuPtrAndGpuAddress(scratchAllocation->getUnderlyingBuffer(), canonizedGpuAddress);
|
||||
@@ -513,7 +513,7 @@ HWTEST_F(CommandStreamReceiverHwTest, WhenScratchSpaceIsNotRequiredThenGshAddres
|
||||
auto commandStreamReceiver = std::make_unique<MockCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto scratchController = commandStreamReceiver->getScratchSpaceController();
|
||||
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceSlot0Allocation());
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceAllocation());
|
||||
EXPECT_EQ(0u, scratchController->calculateNewGSH());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
using namespace NEO;
|
||||
struct MockScratchSpaceController : ScratchSpaceControllerBase {
|
||||
using ScratchSpaceControllerBase::scratchSlot1Allocation;
|
||||
using ScratchSpaceControllerBase::privateScratchAllocation;
|
||||
using ScratchSpaceControllerBase::ScratchSpaceControllerBase;
|
||||
};
|
||||
|
||||
@@ -24,8 +24,8 @@ using ScratchSpaceControllerTest = Test<ClDeviceFixture>;
|
||||
|
||||
TEST_F(ScratchSpaceControllerTest, whenScratchSpaceControllerIsDestroyedThenItReleasePrivateScratchSpaceAllocation) {
|
||||
MockScratchSpaceController scratchSpaceController(pDevice->getRootDeviceIndex(), *pDevice->getExecutionEnvironment(), *pDevice->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
scratchSpaceController.scratchSlot1Allocation = pDevice->getExecutionEnvironment()->memoryManager->allocateGraphicsMemoryInPreferredPool(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}, nullptr);
|
||||
EXPECT_NE(nullptr, scratchSpaceController.scratchSlot1Allocation);
|
||||
scratchSpaceController.privateScratchAllocation = pDevice->getExecutionEnvironment()->memoryManager->allocateGraphicsMemoryInPreferredPool(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}, nullptr);
|
||||
EXPECT_NE(nullptr, scratchSpaceController.privateScratchAllocation);
|
||||
// no memory leak is expected
|
||||
}
|
||||
|
||||
|
||||
@@ -185,15 +185,15 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
parseCommands<FamilyType>(commandStreamCSR, 0);
|
||||
findHardwareCommands<FamilyType>();
|
||||
|
||||
EXPECT_EQ(kernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0], commandStreamReceiver->requiredScratchSlot0Size);
|
||||
EXPECT_EQ(scratchSpaceSize, scratchController->scratchSlot0SizeInBytes);
|
||||
EXPECT_EQ(scratchSpaceSize, scratchController->getScratchSpaceSlot0Allocation()->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(kernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0], commandStreamReceiver->requiredScratchSize);
|
||||
EXPECT_EQ(scratchSpaceSize, scratchController->scratchSizeBytes);
|
||||
EXPECT_EQ(scratchSpaceSize, scratchController->getScratchSpaceAllocation()->getUnderlyingBufferSize());
|
||||
ASSERT_NE(nullptr, cmdMediaVfeState);
|
||||
auto cfeState = static_cast<CFE_STATE *>(cmdMediaVfeState);
|
||||
uint32_t bufferOffset = static_cast<uint32_t>(scratchController->slotId * scratchController->singleSurfaceStateSize * 2);
|
||||
EXPECT_EQ(bufferOffset, cfeState->getScratchSpaceBuffer());
|
||||
RENDER_SURFACE_STATE *scratchState = reinterpret_cast<RENDER_SURFACE_STATE *>(scratchController->surfaceStateHeap + bufferOffset);
|
||||
EXPECT_EQ(scratchController->scratchSlot0Allocation->getGpuAddress(), scratchState->getSurfaceBaseAddress());
|
||||
EXPECT_EQ(scratchController->scratchAllocation->getGpuAddress(), scratchState->getSurfaceBaseAddress());
|
||||
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_SCRATCH, scratchState->getSurfaceType());
|
||||
|
||||
SurfaceStateBufferLength length = {0};
|
||||
@@ -230,9 +230,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
EXPECT_EQ(1u, scratchController->slotId);
|
||||
EXPECT_EQ(scratchController->surfaceStateHeap, oldSurfaceHeap);
|
||||
char *surfaceStateBuf = static_cast<char *>(oldSurfaceHeap) + scratchController->slotId * sizeof(RENDER_SURFACE_STATE) * 2;
|
||||
GraphicsAllocation *scratchAllocation = scratchController->scratchSlot0Allocation;
|
||||
GraphicsAllocation *scratchAllocation = scratchController->scratchAllocation;
|
||||
RENDER_SURFACE_STATE *surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(surfaceStateBuf);
|
||||
EXPECT_EQ(scratchController->scratchSlot0Allocation->getGpuAddress(), surfaceState->getSurfaceBaseAddress());
|
||||
EXPECT_EQ(scratchController->scratchAllocation->getGpuAddress(), surfaceState->getSurfaceBaseAddress());
|
||||
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_SCRATCH, surfaceState->getSurfaceType());
|
||||
|
||||
void *newSurfaceHeap = alignedMalloc(0x1000, 0x1000);
|
||||
@@ -240,10 +240,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
EXPECT_TRUE(cfeStateDirty);
|
||||
EXPECT_EQ(1u, scratchController->slotId);
|
||||
EXPECT_EQ(scratchController->surfaceStateHeap, newSurfaceHeap);
|
||||
EXPECT_EQ(scratchAllocation, scratchController->scratchSlot0Allocation);
|
||||
EXPECT_EQ(scratchAllocation, scratchController->scratchAllocation);
|
||||
surfaceStateBuf = static_cast<char *>(newSurfaceHeap) + scratchController->slotId * sizeof(RENDER_SURFACE_STATE) * 2;
|
||||
surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(surfaceStateBuf);
|
||||
EXPECT_EQ(scratchController->scratchSlot0Allocation->getGpuAddress(), surfaceState->getSurfaceBaseAddress());
|
||||
EXPECT_EQ(scratchController->scratchAllocation->getGpuAddress(), surfaceState->getSurfaceBaseAddress());
|
||||
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_SCRATCH, surfaceState->getSurfaceType());
|
||||
|
||||
alignedFree(oldSurfaceHeap);
|
||||
@@ -269,7 +269,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
uint64_t offset = static_cast<uint64_t>(scratchController->slotId * sizeof(RENDER_SURFACE_STATE) * 2);
|
||||
EXPECT_EQ(offset, scratchController->getScratchPatchAddress());
|
||||
EXPECT_EQ(0u, scratchController->calculateNewGSH());
|
||||
uint64_t gpuVa = scratchController->scratchSlot0Allocation->getGpuAddress();
|
||||
uint64_t gpuVa = scratchController->scratchAllocation->getGpuAddress();
|
||||
char *surfaceStateBuf = static_cast<char *>(scratchController->surfaceStateHeap) + offset;
|
||||
RENDER_SURFACE_STATE *surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(surfaceStateBuf);
|
||||
EXPECT_EQ(gpuVa, surfaceState->getSurfaceBaseAddress());
|
||||
@@ -280,8 +280,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
EXPECT_EQ(8u, scratchController->slotId);
|
||||
offset = static_cast<uint64_t>(scratchController->slotId * sizeof(RENDER_SURFACE_STATE) * 2);
|
||||
EXPECT_EQ(offset, scratchController->getScratchPatchAddress());
|
||||
EXPECT_NE(gpuVa, scratchController->scratchSlot0Allocation->getGpuAddress());
|
||||
gpuVa = scratchController->scratchSlot0Allocation->getGpuAddress();
|
||||
EXPECT_NE(gpuVa, scratchController->scratchAllocation->getGpuAddress());
|
||||
gpuVa = scratchController->scratchAllocation->getGpuAddress();
|
||||
surfaceStateBuf = static_cast<char *>(scratchController->surfaceStateHeap) + offset;
|
||||
surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(surfaceStateBuf);
|
||||
EXPECT_EQ(gpuVa, surfaceState->getSurfaceBaseAddress());
|
||||
@@ -308,7 +308,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
uint64_t offset = static_cast<uint64_t>(scratchController->slotId * sizeof(RENDER_SURFACE_STATE) * 2);
|
||||
EXPECT_EQ(offset, scratchController->getScratchPatchAddress());
|
||||
EXPECT_EQ(0u, scratchController->calculateNewGSH());
|
||||
uint64_t gpuVa = scratchController->scratchSlot0Allocation->getGpuAddress();
|
||||
uint64_t gpuVa = scratchController->scratchAllocation->getGpuAddress();
|
||||
char *surfaceStateBuf = static_cast<char *>(scratchController->surfaceStateHeap) + offset;
|
||||
RENDER_SURFACE_STATE *surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(surfaceStateBuf);
|
||||
EXPECT_EQ(gpuVa, surfaceState->getSurfaceBaseAddress());
|
||||
@@ -324,12 +324,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
ExecutionEnvironment &environment,
|
||||
InternalAllocationStorage &allocationStorage) : ScratchSpaceControllerXeHPAndLater(rootDeviceIndex, environment, allocationStorage) {}
|
||||
|
||||
using ScratchSpaceControllerXeHPAndLater::scratchSlot0Allocation;
|
||||
using ScratchSpaceControllerXeHPAndLater::scratchAllocation;
|
||||
|
||||
void setRequiredScratchSpace(void *sshBaseAddress,
|
||||
uint32_t scratchSlot,
|
||||
uint32_t requiredPerThreadScratchSizeSlot0,
|
||||
uint32_t requiredPerThreadScratchSizeSlot1,
|
||||
uint32_t requiredPerThreadScratchSize,
|
||||
uint32_t requiredPerThreadPrivateScratchSize,
|
||||
TaskCountType currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
@@ -378,7 +378,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
ExecutionEnvironment &environment,
|
||||
InternalAllocationStorage &allocationStorage) : ScratchSpaceControllerXeHPAndLater(rootDeviceIndex, environment, allocationStorage) {}
|
||||
|
||||
using ScratchSpaceControllerXeHPAndLater::scratchSlot0Allocation;
|
||||
using ScratchSpaceControllerXeHPAndLater::scratchAllocation;
|
||||
using ScratchSpaceControllerXeHPAndLater::slotId;
|
||||
|
||||
protected:
|
||||
@@ -401,9 +401,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
|
||||
auto scratch = static_cast<MockScratchSpaceControllerXeHPAndLater *>(scratchController.get());
|
||||
scratch->slotId = 10;
|
||||
scratch->scratchSlot0Allocation = &graphicsAllocation;
|
||||
scratch->scratchAllocation = &graphicsAllocation;
|
||||
scratch->setNewSshPtr(surfaceHeap, cfeStateDirty, false);
|
||||
scratch->scratchSlot0Allocation = nullptr;
|
||||
scratch->scratchAllocation = nullptr;
|
||||
EXPECT_EQ(10u, scratch->slotId);
|
||||
EXPECT_EQ(scratch->programSurfaceStateCalledTimes, 1u);
|
||||
EXPECT_TRUE(cfeStateDirty);
|
||||
@@ -419,7 +419,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
InternalAllocationStorage &allocationStorage) : ScratchSpaceControllerXeHPAndLater(rootDeviceIndex, environment, allocationStorage) {}
|
||||
|
||||
using ScratchSpaceControllerXeHPAndLater::programSurfaceState;
|
||||
using ScratchSpaceControllerXeHPAndLater::scratchSlot0Allocation;
|
||||
using ScratchSpaceControllerXeHPAndLater::scratchAllocation;
|
||||
using ScratchSpaceControllerXeHPAndLater::slotId;
|
||||
using ScratchSpaceControllerXeHPAndLater::surfaceStateHeap;
|
||||
using ScratchSpaceControllerXeHPAndLater::updateSlots;
|
||||
@@ -439,9 +439,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
scratch->surfaceStateHeap = static_cast<char *>(surfaceHeap);
|
||||
scratch->slotId = 10;
|
||||
scratch->updateSlots = false;
|
||||
scratch->scratchSlot0Allocation = &graphicsAllocation;
|
||||
scratch->scratchAllocation = &graphicsAllocation;
|
||||
scratch->programSurfaceState();
|
||||
scratch->scratchSlot0Allocation = nullptr;
|
||||
scratch->scratchAllocation = nullptr;
|
||||
EXPECT_EQ(10u, scratch->slotId);
|
||||
|
||||
alignedFree(surfaceHeap);
|
||||
@@ -464,15 +464,15 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
scratchController->setRequiredScratchSpace(surfaceState, 0u, 0u, sizeForPrivateScratch, 0u,
|
||||
*pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
|
||||
EXPECT_TRUE(cfeStateDirty);
|
||||
uint64_t gpuVa = scratchController->scratchSlot1Allocation->getGpuAddress();
|
||||
uint64_t gpuVa = scratchController->privateScratchAllocation->getGpuAddress();
|
||||
EXPECT_EQ(gpuVa, surfaceState[3].getSurfaceBaseAddress());
|
||||
|
||||
scratchController->setRequiredScratchSpace(surfaceState, 0u, 0u, sizeForPrivateScratch * 2, 0u,
|
||||
*pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
|
||||
EXPECT_TRUE(cfeStateDirty);
|
||||
|
||||
EXPECT_NE(gpuVa, scratchController->scratchSlot1Allocation->getGpuAddress());
|
||||
EXPECT_EQ(scratchController->scratchSlot1Allocation->getGpuAddress(), surfaceState[5].getSurfaceBaseAddress());
|
||||
EXPECT_NE(gpuVa, scratchController->privateScratchAllocation->getGpuAddress());
|
||||
EXPECT_EQ(scratchController->privateScratchAllocation->getGpuAddress(), surfaceState[5].getSurfaceBaseAddress());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScratchSpaceControllerWithOnlyPrivateScratchSpaceWhenGettingPatchAddressThenGetCorrectValue) {
|
||||
@@ -489,8 +489,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
|
||||
uint32_t sizeForPrivateScratch = MemoryConstants::pageSize;
|
||||
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceSlot0Allocation());
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceSlot1Allocation());
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceAllocation());
|
||||
EXPECT_EQ(nullptr, scratchController->getPrivateScratchSpaceAllocation());
|
||||
|
||||
EXPECT_EQ(0u, scratchController->getScratchPatchAddress());
|
||||
|
||||
@@ -498,8 +498,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
*pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
|
||||
EXPECT_TRUE(cfeStateDirty);
|
||||
auto expectedPatchAddress = 2 * sizeof(RENDER_SURFACE_STATE);
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceSlot0Allocation());
|
||||
EXPECT_NE(nullptr, scratchController->getScratchSpaceSlot1Allocation());
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceAllocation());
|
||||
EXPECT_NE(nullptr, scratchController->getPrivateScratchSpaceAllocation());
|
||||
|
||||
EXPECT_EQ(expectedPatchAddress, scratchController->getScratchPatchAddress());
|
||||
}
|
||||
@@ -521,14 +521,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
scratchController->setRequiredScratchSpace(surfaceState, 0u, 0u, sizeForPrivateScratch, 0u,
|
||||
*pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
|
||||
EXPECT_TRUE(cfeStateDirty);
|
||||
uint64_t gpuVa = scratchController->scratchSlot1Allocation->getGpuAddress();
|
||||
uint64_t gpuVa = scratchController->privateScratchAllocation->getGpuAddress();
|
||||
cfeStateDirty = false;
|
||||
|
||||
scratchController->setRequiredScratchSpace(surfaceState, 0u, 0u, sizeForPrivateScratch, 0u,
|
||||
*pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
|
||||
EXPECT_FALSE(cfeStateDirty);
|
||||
|
||||
EXPECT_EQ(gpuVa, scratchController->scratchSlot1Allocation->getGpuAddress());
|
||||
EXPECT_EQ(gpuVa, scratchController->privateScratchAllocation->getGpuAddress());
|
||||
EXPECT_EQ(gpuVa, surfaceState[3].getSurfaceBaseAddress());
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
|
||||
scratchController->setRequiredScratchSpace(surfaceState, 0u, sizeForScratch, 0u, 0u,
|
||||
*pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
|
||||
EXPECT_TRUE(cfeStateDirty);
|
||||
EXPECT_EQ(nullptr, scratchController->scratchSlot1Allocation);
|
||||
EXPECT_EQ(nullptr, scratchController->privateScratchAllocation);
|
||||
|
||||
EXPECT_EQ(0u, surfaceState[3].getSurfaceBaseAddress());
|
||||
}
|
||||
@@ -584,8 +584,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenDisab
|
||||
bool stateBaseAddressDirty = false;
|
||||
scratchController->setRequiredScratchSpace(surfaceState, 0u, MemoryConstants::pageSize, MemoryConstants::pageSize, 0u,
|
||||
*pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
|
||||
EXPECT_EQ(0u, scratchController->scratchSlot1SizeInBytes);
|
||||
EXPECT_EQ(nullptr, scratchController->getScratchSpaceSlot1Allocation());
|
||||
EXPECT_EQ(0u, scratchController->privateScratchSizeBytes);
|
||||
EXPECT_EQ(nullptr, scratchController->getPrivateScratchSpaceAllocation());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenDisabledPrivateScratchSpaceWhenGettingOffsetForSlotThenEachSlotContainsOnlyOneSurfaceState) {
|
||||
|
||||
@@ -888,10 +888,9 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor
|
||||
|
||||
TEST_P(PerformanceHintKernelTest, GivenSpillFillWhenKernelIsInitializedThenContextProvidesProperHint) {
|
||||
|
||||
auto spillSize = zeroSized ? 0 : 1024;
|
||||
auto scratchSize = zeroSized ? 0 : 1024;
|
||||
MockKernelWithInternals mockKernel(context->getDevices(), context);
|
||||
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.spillFillScratchMemorySize = spillSize;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
|
||||
uint32_t computeUnitsForScratch[] = {0x10, 0x20};
|
||||
auto pClDevice = &mockKernel.mockKernel->getDevice();
|
||||
@@ -900,7 +899,7 @@ TEST_P(PerformanceHintKernelTest, GivenSpillFillWhenKernelIsInitializedThenConte
|
||||
|
||||
mockKernel.mockKernel->initialize();
|
||||
|
||||
auto expectedSize = spillSize * pClDevice->getSharedDeviceInfo().computeUnitsUsedForScratch * mockKernel.mockKernel->getKernelInfo().getMaxSimdSize();
|
||||
auto expectedSize = scratchSize * pClDevice->getSharedDeviceInfo().computeUnitsUsedForScratch * mockKernel.mockKernel->getKernelInfo().getMaxSimdSize();
|
||||
snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[REGISTER_PRESSURE_TOO_HIGH],
|
||||
mockKernel.mockKernel->getKernelInfo().kernelDescriptor.kernelMetadata.kernelName.c_str(), expectedSize);
|
||||
EXPECT_EQ(!zeroSized, containsHint(expectedHint, userData));
|
||||
|
||||
@@ -38,7 +38,7 @@ class DispatchInfoBuilderFixture : public ContextFixture, public ClDeviceFixture
|
||||
pKernelInfo->kernelDescriptor.kernelAttributes.simdSize = 32;
|
||||
pKernelInfo->kernelDescriptor.kernelAttributes.numGrfRequired = GrfConfig::defaultGrfNumber;
|
||||
|
||||
pKernelInfo->kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = 1024;
|
||||
pKernelInfo->setPerThreadScratchSize(1024, 0);
|
||||
pKernelInfo->setPrintfSurface(sizeof(uintptr_t), 0);
|
||||
|
||||
pKernelInfo->addArgBuffer(0, 0x10, sizeof(void *));
|
||||
|
||||
@@ -33,7 +33,7 @@ class DispatchInfoFixture : public ContextFixture, public ClDeviceFixture {
|
||||
ContextFixture::setUp(1, &device);
|
||||
pKernelInfo = std::make_unique<MockKernelInfo>();
|
||||
|
||||
pKernelInfo->kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = 1024;
|
||||
pKernelInfo->setPerThreadScratchSize(1024, 0);
|
||||
pKernelInfo->setPrintfSurface(sizeof(uintptr_t), 0);
|
||||
|
||||
pProgram = new MockProgram(pContext, false, toClDeviceVector(*pClDevice));
|
||||
@@ -60,7 +60,7 @@ TEST_F(DispatchInfoTest, GivenNoGeometryWhenDispatchInfoIsCreatedThenValuesAreSe
|
||||
std::unique_ptr<DispatchInfo> dispatchInfo(new DispatchInfo);
|
||||
|
||||
EXPECT_EQ(nullptr, dispatchInfo->getKernel());
|
||||
EXPECT_EQ(0u, dispatchInfo->getRequiredScratchSize(0u));
|
||||
EXPECT_EQ(0u, dispatchInfo->getRequiredScratchSize());
|
||||
EXPECT_FALSE(dispatchInfo->usesSlm());
|
||||
EXPECT_FALSE(dispatchInfo->usesStatelessPrintfSurface());
|
||||
EXPECT_EQ(0u, dispatchInfo->getDim());
|
||||
@@ -84,7 +84,7 @@ TEST_F(DispatchInfoTest, GivenUserGeometryWhenDispatchInfoIsCreatedThenValuesAre
|
||||
std::unique_ptr<DispatchInfo> dispatchInfo(new DispatchInfo(pClDevice, pKernel, 3, gws, elws, offset));
|
||||
|
||||
EXPECT_NE(nullptr, dispatchInfo->getKernel());
|
||||
EXPECT_EQ(1024u, dispatchInfo->getRequiredScratchSize(0u));
|
||||
EXPECT_EQ(1024u, dispatchInfo->getRequiredScratchSize());
|
||||
EXPECT_TRUE(dispatchInfo->usesSlm());
|
||||
EXPECT_TRUE(dispatchInfo->usesStatelessPrintfSurface());
|
||||
EXPECT_EQ(3u, dispatchInfo->getDim());
|
||||
@@ -117,7 +117,7 @@ TEST_F(DispatchInfoTest, GivenFullGeometryWhenDispatchInfoIsCreatedThenValuesAre
|
||||
std::unique_ptr<DispatchInfo> dispatchInfo(new DispatchInfo(pClDevice, pKernel, 3, gws, elws, offset, agws, lws, twgs, nwgs, swgs));
|
||||
|
||||
EXPECT_NE(nullptr, dispatchInfo->getKernel());
|
||||
EXPECT_EQ(1024u, dispatchInfo->getRequiredScratchSize(0u));
|
||||
EXPECT_EQ(1024u, dispatchInfo->getRequiredScratchSize());
|
||||
EXPECT_TRUE(dispatchInfo->usesSlm());
|
||||
EXPECT_TRUE(dispatchInfo->usesStatelessPrintfSurface());
|
||||
EXPECT_EQ(3u, dispatchInfo->getDim());
|
||||
@@ -148,7 +148,7 @@ TEST_F(DispatchInfoTest, WhenMultiDispatchInfoIsCreatedThenItIsNonAssignable) {
|
||||
TEST_F(DispatchInfoTest, WhenMultiDispatchInfoIsCreatedThenItIsEmpty) {
|
||||
MultiDispatchInfo multiDispatchInfo;
|
||||
EXPECT_TRUE(multiDispatchInfo.empty());
|
||||
EXPECT_EQ(0u, multiDispatchInfo.getRequiredScratchSize(0u));
|
||||
EXPECT_EQ(0u, multiDispatchInfo.getRequiredScratchSize());
|
||||
EXPECT_FALSE(multiDispatchInfo.usesSlm());
|
||||
EXPECT_FALSE(multiDispatchInfo.usesStatelessPrintfSurface());
|
||||
EXPECT_EQ(0u, multiDispatchInfo.getRedescribedSurfaces().size());
|
||||
@@ -172,7 +172,7 @@ TEST_F(DispatchInfoTest, GivenNoGeometryWhenMultiDispatchInfoIsCreatedThenValues
|
||||
MultiDispatchInfo multiDispatchInfo;
|
||||
multiDispatchInfo.push(dispatchInfo);
|
||||
EXPECT_FALSE(multiDispatchInfo.empty());
|
||||
EXPECT_EQ(0u, multiDispatchInfo.getRequiredScratchSize(0u));
|
||||
EXPECT_EQ(0u, multiDispatchInfo.getRequiredScratchSize());
|
||||
EXPECT_FALSE(multiDispatchInfo.usesSlm());
|
||||
EXPECT_FALSE(multiDispatchInfo.usesStatelessPrintfSurface());
|
||||
}
|
||||
@@ -187,7 +187,7 @@ TEST_F(DispatchInfoTest, GivenUserGeometryWhenMultiDispatchInfoIsCreatedThenValu
|
||||
MultiDispatchInfo multiDispatchInfo;
|
||||
multiDispatchInfo.push(dispatchInfo);
|
||||
EXPECT_FALSE(multiDispatchInfo.empty());
|
||||
EXPECT_EQ(1024u, multiDispatchInfo.getRequiredScratchSize(0u));
|
||||
EXPECT_EQ(1024u, multiDispatchInfo.getRequiredScratchSize());
|
||||
EXPECT_TRUE(multiDispatchInfo.usesSlm());
|
||||
EXPECT_TRUE(multiDispatchInfo.usesStatelessPrintfSurface());
|
||||
|
||||
@@ -220,7 +220,7 @@ TEST_F(DispatchInfoTest, GivenFullGeometryWhenMultiDispatchInfoIsCreatedThenValu
|
||||
MultiDispatchInfo multiDispatchInfo;
|
||||
multiDispatchInfo.push(dispatchInfo);
|
||||
EXPECT_FALSE(multiDispatchInfo.empty());
|
||||
EXPECT_EQ(1024u, multiDispatchInfo.getRequiredScratchSize(0u));
|
||||
EXPECT_EQ(1024u, multiDispatchInfo.getRequiredScratchSize());
|
||||
EXPECT_TRUE(multiDispatchInfo.usesSlm());
|
||||
EXPECT_TRUE(multiDispatchInfo.usesStatelessPrintfSurface());
|
||||
|
||||
@@ -318,3 +318,9 @@ TEST(DispatchInfoBasicTests, givenDispatchInfoWhenSetCanBePartitionIsCalledThenS
|
||||
dispatchInfo.setCanBePartitioned(true);
|
||||
EXPECT_TRUE(dispatchInfo.peekCanBePartitioned());
|
||||
}
|
||||
|
||||
TEST(DispatchInfoBasicTests, givenDispatchInfoWithoutKernelWhenGettingSizeForPrivateScratchThenZeroIsReturned) {
|
||||
DispatchInfo dispatchInfo;
|
||||
EXPECT_EQ(nullptr, dispatchInfo.getKernel());
|
||||
EXPECT_EQ(0u, dispatchInfo.getRequiredPrivateScratchSize());
|
||||
}
|
||||
|
||||
@@ -798,7 +798,7 @@ TEST_F(KernelPrivateSurfaceTest, GivenKernelWhenScratchSizeIsGreaterThanMaxScrat
|
||||
auto pKernelInfo = std::make_unique<MockKernelInfo>();
|
||||
pKernelInfo->kernelDescriptor.kernelAttributes.simdSize = 32;
|
||||
pKernelInfo->setPrivateMemory(0x100, false, 0, 0, 0);
|
||||
pKernelInfo->kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = maxScratchSize + 100;
|
||||
pKernelInfo->setPerThreadScratchSize(maxScratchSize + 100, 0);
|
||||
|
||||
MockContext context;
|
||||
MockProgram program(&context, false, toClDeviceVector(*pClDevice));
|
||||
@@ -2895,16 +2895,22 @@ TEST(KernelTest, givenNotAllArgumentsAreBuffersButAllBuffersAreStatefulWhenIniti
|
||||
EXPECT_TRUE(kernel.mockKernel->allBufferArgsStateful);
|
||||
}
|
||||
|
||||
TEST(KernelTest, givenKernelRequiringTwoSlotScratchSpaceWhenGettingSizeForScratchSpaceThenCorrectSizeIsReturned) {
|
||||
TEST(KernelTest, givenKernelRequiringPrivateScratchSpaceWhenGettingSizeForPrivateScratchSpaceThenCorrectSizeIsReturned) {
|
||||
auto device = clUniquePtr(new MockClDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get())));
|
||||
|
||||
MockKernelWithInternals mockKernel(*device);
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->getScratchSize(0u));
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->getScratchSize(1u));
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[0] = 512u;
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.perThreadScratchSize[1] = 1024u;
|
||||
EXPECT_EQ(512u, mockKernel.mockKernel->getScratchSize(0u));
|
||||
EXPECT_EQ(1024u, mockKernel.mockKernel->getScratchSize(1u));
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(512u, 0);
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(1024u, 1);
|
||||
|
||||
EXPECT_EQ(1024u, mockKernel.mockKernel->getPrivateScratchSize());
|
||||
}
|
||||
|
||||
TEST(KernelTest, givenKernelWithoutMediaVfeStateSlot1WhenGettingSizeForPrivateScratchSpaceThenCorrectSizeIsReturned) {
|
||||
auto device = clUniquePtr(new MockClDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get())));
|
||||
|
||||
MockKernelWithInternals mockKernel(*device);
|
||||
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->getPrivateScratchSize());
|
||||
}
|
||||
|
||||
TEST(KernelTest, givenKernelWithPatchInfoCollectionEnabledWhenPatchWithImplicitSurfaceCalledThenPatchInfoDataIsCollected) {
|
||||
|
||||
@@ -353,18 +353,18 @@ class MockKernelWithInternals {
|
||||
operator MockKernel *() {
|
||||
return mockKernel;
|
||||
}
|
||||
alignas(64) char sshLocal[128];
|
||||
alignas(64) char dshLocal[128];
|
||||
char crossThreadData[256];
|
||||
uint32_t kernelIsa[32];
|
||||
MockKernelInfo kernelInfo;
|
||||
|
||||
MockMultiDeviceKernel *mockMultiDeviceKernel = nullptr;
|
||||
MockKernel *mockKernel;
|
||||
MockProgram *mockProgram;
|
||||
Context *mockContext;
|
||||
KernelInfoContainer kernelInfos;
|
||||
MockKernelInfo kernelInfo;
|
||||
SKernelBinaryHeaderCommon kernelHeader = {};
|
||||
uint32_t kernelIsa[32];
|
||||
char crossThreadData[256];
|
||||
alignas(64) char sshLocal[128];
|
||||
alignas(64) char dshLocal[128];
|
||||
std::vector<Kernel::SimpleKernelArgInfo> defaultKernelArguments;
|
||||
};
|
||||
class MockDebugKernel : public MockKernel {
|
||||
|
||||
Reference in New Issue
Block a user