refactor: use indirectDataAlignment from gen cmds

Related-To: NEO-10641
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2024-06-25 16:29:31 +00:00
committed by Compute-Runtime-Automation
parent 66d4d141e1
commit fbc29bb43d
8 changed files with 17 additions and 13 deletions

View File

@@ -76,7 +76,7 @@ size_t HardwareCommandsHelper<GfxFamily>::getSizeRequiredIOH(const Kernel &kerne
if (pImplicitArgs) {
size += ImplicitArgsHelper::getSizeForImplicitArgsPatching(pImplicitArgs, kernelDescriptor, isHwLocalIdGeneration, rootDeviceEnvironment);
}
return alignUp(size, DefaultWalkerType::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
return alignUp(size, GfxFamily::indirectDataAlignment);
}
template <typename GfxFamily>

View File

@@ -662,7 +662,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenAutoLocal
EXPECT_EQ(1u, walker->getGenerateLocalId());
EXPECT_EQ(1u, walker->getEmitLocalId());
uint32_t expectedIndirectDataLength = alignUp(kernel->mockKernel->getCrossThreadDataSize(), DefaultWalkerType::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
uint32_t expectedIndirectDataLength = alignUp(kernel->mockKernel->getCrossThreadDataSize(), FamilyType::indirectDataAlignment);
EXPECT_EQ(expectedIndirectDataLength, walker->getIndirectDataLength());
INTERFACE_DESCRIPTOR_DATA &idd = walker->getInterfaceDescriptor();
@@ -732,7 +732,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenPassInlin
sizePerThreadData = std::max(sizePerThreadData, sizeGrf);
size_t perThreadTotalDataSize = getThreadsPerWG(simd, static_cast<uint32_t>(lws[0])) * sizePerThreadData;
uint32_t expectedIndirectDataLength = alignUp(static_cast<uint32_t>(perThreadTotalDataSize), DefaultWalkerType::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
uint32_t expectedIndirectDataLength = alignUp(static_cast<uint32_t>(perThreadTotalDataSize), FamilyType::indirectDataAlignment);
EXPECT_EQ(expectedIndirectDataLength, walker->getIndirectDataLength());
INTERFACE_DESCRIPTOR_DATA &idd = walker->getInterfaceDescriptor();
@@ -840,7 +840,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenPassInlin
// second GRF in indirect
uint32_t expectedIndirectDataLength = sizePerThreadData + crossThreadDataSize;
expectedIndirectDataLength = alignUp(expectedIndirectDataLength, DefaultWalkerType::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
expectedIndirectDataLength = alignUp(expectedIndirectDataLength, FamilyType::indirectDataAlignment);
EXPECT_EQ(expectedIndirectDataLength, walker->getIndirectDataLength());
memoryManager->freeGraphicsMemory(kernel->kernelInfo.kernelAllocation);
@@ -883,7 +883,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenKernelWit
size_t perThreadTotalDataSize = 0U;
uint32_t expectedIndirectDataLength = static_cast<uint32_t>(perThreadTotalDataSize);
expectedIndirectDataLength = alignUp(expectedIndirectDataLength, DefaultWalkerType::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
expectedIndirectDataLength = alignUp(expectedIndirectDataLength, FamilyType::indirectDataAlignment);
EXPECT_EQ(expectedIndirectDataLength, walker->getIndirectDataLength());
memoryManager->freeGraphicsMemory(kernel->kernelInfo.kernelAllocation);
@@ -931,7 +931,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenPassInlin
// second GRF in indirect
uint32_t expectedIndirectDataLength = static_cast<uint32_t>(perThreadTotalDataSize + sizeof(INLINE_DATA));
expectedIndirectDataLength = alignUp(expectedIndirectDataLength, DefaultWalkerType::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
expectedIndirectDataLength = alignUp(expectedIndirectDataLength, FamilyType::indirectDataAlignment);
EXPECT_EQ(expectedIndirectDataLength, walker->getIndirectDataLength());
memoryManager->freeGraphicsMemory(kernel->kernelInfo.kernelAllocation);

View File

@@ -102,7 +102,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenFillingBufferThenHeapsAndCommandBufferCo
auto expectedSizeIOH = HardwareCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = HardwareCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
EXPECT_EQ(0u, expectedSizeIOH % GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
EXPECT_EQ(0u, expectedSizeIOH % FamilyType::indirectDataAlignment);
EXPECT_EQ(0u, expectedSizeDSH % 64);
// Since each enqueue* may flush, we may see a MI_BATCH_BUFFER_END appended.
@@ -155,7 +155,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenCopyingBufferThenHeapsAndCommandBufferCo
auto expectedSizeIOH = HardwareCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = HardwareCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
EXPECT_EQ(0u, expectedSizeIOH % GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
EXPECT_EQ(0u, expectedSizeIOH % FamilyType::indirectDataAlignment);
EXPECT_EQ(0u, expectedSizeDSH % 64);
// Since each enqueue* may flush, we may see a MI_BATCH_BUFFER_END appended.
@@ -209,7 +209,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferNonBlockingThenHeapsAndComm
auto expectedSizeIOH = HardwareCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = HardwareCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
EXPECT_EQ(0u, expectedSizeIOH % GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
EXPECT_EQ(0u, expectedSizeIOH % FamilyType::indirectDataAlignment);
EXPECT_EQ(0u, expectedSizeDSH % 64);
// Since each enqueue* may flush, we may see a MI_BATCH_BUFFER_END appended.
@@ -264,7 +264,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferBlockingThenThenHeapsAndCom
auto expectedSizeIOH = HardwareCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = HardwareCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
EXPECT_EQ(0u, expectedSizeIOH % GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
EXPECT_EQ(0u, expectedSizeIOH % FamilyType::indirectDataAlignment);
EXPECT_EQ(0u, expectedSizeDSH % 64);
// Since each enqueue* may flush, we may see a MI_BATCH_BUFFER_END appended.
@@ -543,7 +543,7 @@ HWTEST_F(GetSizeRequiredBufferTest, GivenKernelWithSimpleArgWhenEnqueingKernelTh
auto expectedSizeIOH = HardwareCommandsHelper<FamilyType>::getSizeRequiredIOH(*KernelFixture::pKernel, localWorkSizes, pClDevice->getRootDeviceEnvironment());
auto expectedSizeSSH = HardwareCommandsHelper<FamilyType>::getSizeRequiredSSH(*KernelFixture::pKernel);
EXPECT_EQ(0u, expectedSizeIOH % GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
EXPECT_EQ(0u, expectedSizeIOH % FamilyType::indirectDataAlignment);
EXPECT_EQ(0u, expectedSizeDSH % 64);
// Since each enqueue* may flush, we may see a MI_BATCH_BUFFER_END appended.

View File

@@ -244,10 +244,10 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
{
auto heap = container.getIndirectHeap(HeapType::indirectObject);
UNRECOVERABLE_IF(!heap);
heap->align(DefaultWalkerType::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
heap->align(Family::indirectDataAlignment);
void *ptr = nullptr;
if (args.isKernelDispatchedFromImmediateCmdList) {
ptr = container.getHeapWithRequiredSizeAndAlignment(HeapType::indirectObject, iohRequiredSize, DefaultWalkerType::INDIRECTDATASTARTADDRESS_ALIGN_SIZE)->getSpace(iohRequiredSize);
ptr = container.getHeapWithRequiredSizeAndAlignment(HeapType::indirectObject, iohRequiredSize, Family::indirectDataAlignment)->getSpace(iohRequiredSize);
} else {
ptr = container.getHeapSpaceAllowGrow(HeapType::indirectObject, iohRequiredSize);
}

View File

@@ -133,6 +133,7 @@ struct Gen11Family : public Gen11 {
static const XY_COLOR_BLT cmdInitXyColorBlt;
static constexpr bool isQwordInOrderCounter = false;
static constexpr bool walkerPostSyncSupport = false;
static constexpr size_t indirectDataAlignment = GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE;
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
return cmdSetBaseFamily == IGFX_GEN8_CORE;

View File

@@ -134,6 +134,7 @@ struct Gen12LpFamily : public Gen12Lp {
static const XY_FAST_COLOR_BLT cmdInitXyColorBlt;
static constexpr bool isQwordInOrderCounter = false;
static constexpr bool walkerPostSyncSupport = false;
static constexpr size_t indirectDataAlignment = GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE;
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
return cmdSetBaseFamily == IGFX_GEN8_CORE;

View File

@@ -133,6 +133,7 @@ struct Gen8Family : public Gen8 {
static const XY_COLOR_BLT cmdInitXyColorBlt;
static constexpr bool isQwordInOrderCounter = false;
static constexpr bool walkerPostSyncSupport = false;
static constexpr size_t indirectDataAlignment = GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE;
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
return cmdSetBaseFamily == IGFX_GEN8_CORE;

View File

@@ -133,6 +133,7 @@ struct Gen9Family : public Gen9 {
static const XY_COLOR_BLT cmdInitXyColorBlt;
static constexpr bool isQwordInOrderCounter = false;
static constexpr bool walkerPostSyncSupport = false;
static constexpr size_t indirectDataAlignment = GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE;
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
return cmdSetBaseFamily == IGFX_GEN8_CORE;