test: add getWalkerPartitionEstimateSpaceRequiredInCommandBuffer helper

Related-To: NEO-10641
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk 2024-08-13 16:10:23 +00:00 committed by Compute-Runtime-Automation
parent 0d5b6003e2
commit fbf84c4077
4 changed files with 32 additions and 10 deletions

View File

@ -1198,13 +1198,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
testArgs.staticPartitioning = false;
testArgs.synchronizeBeforeExecution = false;
csr.staticWorkPartitioningEnabled = false;
auto partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
auto partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
auto returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, dispatchInfo);
EXPECT_EQ(returnedSize, partitionSize + baseSize);
testArgs.staticPartitioning = true;
csr.staticWorkPartitioningEnabled = true;
partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, dispatchInfo);
EXPECT_EQ(returnedSize, partitionSize + baseSize);
@ -1212,14 +1213,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
testArgs.synchronizeBeforeExecution = true;
testArgs.staticPartitioning = false;
csr.staticWorkPartitioningEnabled = false;
partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, dispatchInfo);
EXPECT_EQ(returnedSize, partitionSize + baseSize);
testArgs.synchronizeBeforeExecution = true;
testArgs.staticPartitioning = true;
csr.staticWorkPartitioningEnabled = true;
partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, dispatchInfo);
EXPECT_EQ(returnedSize, partitionSize + baseSize);
}
@ -1258,13 +1259,13 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
testArgs.staticPartitioning = false;
testArgs.synchronizeBeforeExecution = false;
csr.staticWorkPartitioningEnabled = false;
auto partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
auto partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
auto returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, dispatchInfo);
EXPECT_EQ(returnedSize, partitionSize + baseSize);
testArgs.staticPartitioning = true;
csr.staticWorkPartitioningEnabled = true;
partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, dispatchInfo);
EXPECT_EQ(returnedSize, partitionSize + baseSize);
@ -1272,14 +1273,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
testArgs.synchronizeBeforeExecution = true;
testArgs.staticPartitioning = false;
csr.staticWorkPartitioningEnabled = false;
partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, dispatchInfo);
EXPECT_EQ(returnedSize, partitionSize + baseSize);
testArgs.synchronizeBeforeExecution = true;
testArgs.staticPartitioning = true;
csr.staticWorkPartitioningEnabled = true;
partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, dispatchInfo);
EXPECT_EQ(returnedSize, partitionSize + baseSize);
}
@ -1343,7 +1344,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
testArgs.dcFlushEnable = csr.getDcFlushSupport();
testArgs.tileCount = static_cast<uint32_t>(device->getDeviceBitfield().count());
auto partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
auto partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
DispatchInfo dispatchInfo{};
dispatchInfo.setNumberOfWorkgroups({32, 1, 1});
@ -1376,7 +1377,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
testArgs.dcFlushEnable = csr.getDcFlushSupport();
testArgs.tileCount = static_cast<uint32_t>(device->getDeviceBitfield().count());
auto partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType, WalkerType>(testArgs);
auto partitionSize = UnitTestHelper<FamilyType>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(this->heaplessEnabled, testArgs);
DispatchInfo dispatchInfo{};
dispatchInfo.setNumberOfWorkgroups({32, 1, 1});

View File

@ -14,6 +14,12 @@
class DebugManagerStateRestore;
namespace WalkerPartition {
struct WalkerPartitionArgs;
} // namespace WalkerPartition
namespace NEO {
class CommandStreamReceiver;
@ -107,6 +113,7 @@ struct UnitTestHelper {
static bool findStateCacheFlushPipeControl(CommandStreamReceiver &csr, LinearStream &csrStream);
static void verifyDummyBlitWa(const RootDeviceEnvironment *rootDeviceEnvironment, GenCmdList::iterator &cmdIterator);
static uint64_t getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(bool isHeaplessEnabled, WalkerPartition::WalkerPartitionArgs &testArgs);
static GenCmdList::iterator findWalkerTypeCmd(GenCmdList::iterator begin, GenCmdList::iterator end);
static std::vector<GenCmdList::iterator> findAllWalkerTypeCmds(GenCmdList::iterator begin, GenCmdList::iterator end);
static typename GfxFamily::WalkerVariant getWalkerVariant(void *walkerItor);

View File

@ -163,4 +163,10 @@ std::vector<GenCmdList::iterator> UnitTestHelper<GfxFamily>::findAllWalkerTypeCm
return findAll<typename GfxFamily::GPGPU_WALKER *>(begin, end);
}
template <typename GfxFamily>
uint64_t UnitTestHelper<GfxFamily>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(bool isHeaplessEnabled, WalkerPartition::WalkerPartitionArgs &testArgs) {
UNRECOVERABLE_IF(true);
return 0u;
}
} // namespace NEO

View File

@ -6,6 +6,7 @@
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_container/walker_partition_xehp_and_later.h"
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/kernel/kernel_descriptor.h"
@ -148,4 +149,11 @@ std::vector<GenCmdList::iterator> UnitTestHelper<GfxFamily>::findAllWalkerTypeCm
return findAll<typename GfxFamily::COMPUTE_WALKER *>(begin, end);
}
template <typename GfxFamily>
uint64_t UnitTestHelper<GfxFamily>::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(bool isHeaplessEnabled, WalkerPartition::WalkerPartitionArgs &testArgs) {
using DefaultWalkerType = typename GfxFamily::DefaultWalkerType;
return WalkerPartition::estimateSpaceRequiredInCommandBuffer<GfxFamily, DefaultWalkerType>(testArgs);
}
} // namespace NEO