test: improve tests

- scratch related tests - fix getting ssh gpu address
- driver test - fix order of extensions
- cmdlist private heap - move ssh space consumption after appendKernel
to make sure first kernel will not allocate new ssh and the second one
will

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2024-09-24 15:07:58 +00:00
committed by Compute-Runtime-Automation
parent 47ef854665
commit 6ce947cb77
4 changed files with 22 additions and 26 deletions

View File

@@ -633,15 +633,11 @@ uint64_t CommandListScratchPatchFixtureInit::getSurfStateGpuBase(bool useImmedia
if (fixtureGlobalStatelessMode == 1) {
return device->getNEODevice()->getDefaultEngine().commandStreamReceiver->getGlobalStatelessHeapAllocation()->getGpuAddress();
} else {
auto bindlessHeapsHelper = device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getNEODevice()->getRootDeviceIndex()]->bindlessHeapsHelper.get();
if (bindlessHeapsHelper) {
return device->getNEODevice()->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::specialSsh)->getGpuBase();
if (useImmediate) {
return device->getNEODevice()->getDefaultEngine().commandStreamReceiver->getIndirectHeap(NEO::surfaceState, 0).getGpuBase();
} else {
if (useImmediate) {
return device->getNEODevice()->getDefaultEngine().commandStreamReceiver->getIndirectHeap(NEO::surfaceState, 0).getGpuBase();
} else {
return commandList->commandContainer.getIndirectHeap(NEO::surfaceState)->getGpuBase();
}
return commandList->commandContainer.getIndirectHeap(NEO::surfaceState)->getGpuBase();
}
}
}

View File

@@ -1421,8 +1421,6 @@ void CommandListScratchPatchFixtureInit::testScratchInline(bool useImmediate) {
size_t inlineOffset = NEO::EncodeDispatchKernel<FamilyType>::getInlineDataOffset(dispatchKernelArgs);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(useImmediate);
auto scratchCmdList = static_cast<L0::CommandList *>(commandList.get());
auto cmdListStream = commandList->commandContainer.getCommandStream();
if (useImmediate) {
@@ -1439,6 +1437,8 @@ void CommandListScratchPatchFixtureInit::testScratchInline(bool useImmediate) {
size_t usedAfter = cmdListStream->getUsed();
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(useImmediate);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList,
@@ -1503,8 +1503,6 @@ void CommandListScratchPatchFixtureInit::testScratchGrowingPatching() {
size_t inlineOffset = NEO::EncodeDispatchKernel<FamilyType>::getInlineDataOffset(dispatchKernelArgs);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(false);
auto cmdListStream = commandList->commandContainer.getCommandStream();
const ze_group_count_t groupCount{1, 1, 1};
@@ -1516,6 +1514,8 @@ void CommandListScratchPatchFixtureInit::testScratchGrowingPatching() {
size_t usedAfter = cmdListStream->getUsed();
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(false);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList,
@@ -1606,8 +1606,6 @@ void CommandListScratchPatchFixtureInit::testScratchSameNotPatching() {
size_t inlineOffset = NEO::EncodeDispatchKernel<FamilyType>::getInlineDataOffset(dispatchKernelArgs);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(false);
auto cmdListStream = commandList->commandContainer.getCommandStream();
const ze_group_count_t groupCount{1, 1, 1};
@@ -1619,6 +1617,8 @@ void CommandListScratchPatchFixtureInit::testScratchSameNotPatching() {
size_t usedAfter = cmdListStream->getUsed();
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(false);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList,
@@ -1664,8 +1664,6 @@ void CommandListScratchPatchFixtureInit::testScratchImmediatePatching() {
size_t inlineOffset = NEO::EncodeDispatchKernel<FamilyType>::getInlineDataOffset(dispatchKernelArgs);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(true);
auto cmdListStream = commandListImmediate->commandContainer.getCommandStream();
commandListImmediate->commandContainer.setImmediateCmdListCsr(csr);
@@ -1678,6 +1676,8 @@ void CommandListScratchPatchFixtureInit::testScratchImmediatePatching() {
size_t usedAfter = cmdListStream->getUsed();
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(true);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList,
@@ -1715,8 +1715,6 @@ void CommandListScratchPatchFixtureInit::testScratchChangedControllerPatching()
size_t inlineOffset = NEO::EncodeDispatchKernel<FamilyType>::getInlineDataOffset(dispatchKernelArgs);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(false);
auto cmdListStream = commandList->commandContainer.getCommandStream();
const ze_group_count_t groupCount{1, 1, 1};
@@ -1728,6 +1726,8 @@ void CommandListScratchPatchFixtureInit::testScratchChangedControllerPatching()
size_t usedAfter = cmdListStream->getUsed();
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(false);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList,
@@ -1832,8 +1832,6 @@ void CommandListScratchPatchFixtureInit::testExternalScratchPatching() {
size_t inlineOffset = NEO::EncodeDispatchKernel<FamilyType>::getInlineDataOffset(dispatchKernelArgs);
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(false);
auto cmdListStream = commandList->commandContainer.getCommandStream();
mockKernelImmData->kernelDescriptor->kernelAttributes.perThreadScratchSize[0] = 0x0;
@@ -1853,6 +1851,8 @@ void CommandListScratchPatchFixtureInit::testExternalScratchPatching() {
EXPECT_EQ(0x80u, commandList->getCommandListPerThreadScratchSize(0));
EXPECT_EQ(0x40u, commandList->getCommandListPerThreadScratchSize(1));
uint64_t surfaceHeapGpuBase = getSurfStateGpuBase(false);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList,

View File

@@ -3152,8 +3152,6 @@ HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest,
EXPECT_TRUE(sbaCmd->getSurfaceStateBaseAddressModifyEnable());
EXPECT_EQ(firstHeapSurfaceBaseAddress, sbaCmd->getSurfaceStateBaseAddress());
ssh->getSpace(ssh->getAvailableSpace() - (2 * FamilyType::cacheLineSize));
result = commandList->reset();
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
@@ -3163,6 +3161,9 @@ HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest,
result = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams, false);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto sizeEnoughForSingleKernel = kernel->getSurfaceStateHeapDataSize();
ssh->getSpace(ssh->getAvailableSpace() - sizeEnoughForSingleKernel / 2);
result = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams, false);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
size_t usedAfter = cmdListStream.getUsed();

View File

@@ -148,13 +148,12 @@ TEST_F(DriverVersionTest, givenCallToGetExtensionPropertiesThenSupportedExtensio
additionalExtensions.emplace_back(ZE_SYNCHRONIZED_DISPATCH_EXP_NAME, ZE_SYNCHRONIZED_DISPATCH_EXP_VERSION_CURRENT);
}
if (!device->getProductHelper().isDcFlushAllowed()) {
additionalExtensions.emplace_back(ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_NAME, ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_VERSION_CURRENT);
}
if (device->getNEODevice()->getRootDeviceEnvironment().getBindlessHeapsHelper()) {
additionalExtensions.emplace_back(ZE_BINDLESS_IMAGE_EXP_NAME, ZE_BINDLESS_IMAGE_EXP_VERSION_CURRENT);
}
if (!device->getProductHelper().isDcFlushAllowed()) {
additionalExtensions.emplace_back(ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_NAME, ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_VERSION_CURRENT);
}
uint32_t count = 0;
ze_result_t res = driverHandle->getExtensionProperties(&count, nullptr);