mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
feature: add getter of walker inline data offset
Related-To: NEO-10381 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3b1e6b61e4
commit
489ef2a310
@@ -189,6 +189,8 @@ struct EncodeDispatchKernel {
|
||||
|
||||
template <bool isHeapless>
|
||||
static void setScratchAddress(uint64_t &scratchAddress, uint32_t requiredScratchSlot0Size, uint32_t requiredScratchSlot1Size, IndirectHeap *ssh, CommandStreamReceiver &csr);
|
||||
|
||||
static size_t getInlineDataOffset(EncodeDispatchKernelArgs &args);
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -630,6 +630,11 @@ size_t EncodeDispatchKernel<Family>::additionalSizeRequiredDsh(uint32_t iddCount
|
||||
return iddCount * sizeof(typename Family::INTERFACE_DESCRIPTOR_DATA);
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
inline size_t EncodeDispatchKernel<Family>::getInlineDataOffset(EncodeDispatchKernelArgs &args) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
size_t EncodeStates<Family>::getSshHeapSize() {
|
||||
return 64 * MemoryConstants::kiloByte;
|
||||
|
||||
@@ -320,6 +320,11 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
}
|
||||
|
||||
if constexpr (heaplessModeEnabled) {
|
||||
auto inlineDataPointer = reinterpret_cast<char *>(walkerCmd.getInlineDataPointer());
|
||||
auto indirectDataPointerAddress = kernelDescriptor.payloadMappings.implicitArgs.indirectDataPointerAddress;
|
||||
auto heap = container.getIndirectHeap(HeapType::indirectObject);
|
||||
auto address = heap->getHeapGpuBase() + offsetThreadData;
|
||||
std::memcpy(inlineDataPointer + indirectDataPointerAddress.offset, &address, indirectDataPointerAddress.pointerSize);
|
||||
|
||||
auto requiredScratchSlot0Size = kernelDescriptor.kernelAttributes.perThreadScratchSize[0];
|
||||
auto requiredScratchSlot1Size = kernelDescriptor.kernelAttributes.perThreadScratchSize[1];
|
||||
@@ -327,18 +332,9 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
auto ssh = container.getIndirectHeap(HeapType::surfaceState);
|
||||
|
||||
uint64_t scratchAddress = 0u;
|
||||
|
||||
EncodeDispatchKernel<Family>::template setScratchAddress<heaplessModeEnabled>(scratchAddress, requiredScratchSlot0Size, requiredScratchSlot1Size, ssh, *csr);
|
||||
|
||||
auto inlineDataPointer = reinterpret_cast<char *>(walkerCmd.getInlineDataPointer());
|
||||
auto indirectDataPointerAddress = kernelDescriptor.payloadMappings.implicitArgs.indirectDataPointerAddress;
|
||||
auto heap = container.getIndirectHeap(HeapType::indirectObject);
|
||||
auto address = heap->getHeapGpuBase() + offsetThreadData;
|
||||
std::memcpy(inlineDataPointer + indirectDataPointerAddress.offset, &address, indirectDataPointerAddress.pointerSize);
|
||||
|
||||
auto scratchPointerAddress = kernelDescriptor.payloadMappings.implicitArgs.scratchPointerAddress;
|
||||
std::memcpy(inlineDataPointer + scratchPointerAddress.offset, &scratchAddress, scratchPointerAddress.pointerSize);
|
||||
|
||||
} else {
|
||||
walkerCmd.setIndirectDataStartAddress(static_cast<uint32_t>(offsetThreadData));
|
||||
walkerCmd.setIndirectDataLength(sizeThreadData);
|
||||
@@ -926,6 +922,12 @@ size_t EncodeDispatchKernel<Family>::additionalSizeRequiredDsh(uint32_t iddCount
|
||||
return 0u;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
inline size_t EncodeDispatchKernel<Family>::getInlineDataOffset(EncodeDispatchKernelArgs &args) {
|
||||
using DefaultWalkerType = typename Family::DefaultWalkerType;
|
||||
return offsetof(DefaultWalkerType, TheStructure.Common.InlineData);
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
size_t EncodeStates<Family>::getSshHeapSize() {
|
||||
return 2 * MemoryConstants::megaByte;
|
||||
|
||||
@@ -1628,4 +1628,10 @@ HWTEST_F(CommandEncodeStatesTest, givenCommandContainerWhenIsKernelDispatchedFro
|
||||
dispatchArgs.isKernelDispatchedFromImmediateCmdList = true;
|
||||
EncodeDispatchKernel<FamilyType>::template encode<DefaultWalkerType>(*cmdContainer.get(), dispatchArgs);
|
||||
EXPECT_NE(0u, cmdContainer->getHeapWithRequiredSizeAndAlignmentCalled);
|
||||
}
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenEncodeDispatchKernelWhenGettingInlineDataOffsetThenReturnZero) {
|
||||
EncodeDispatchKernelArgs dispatchArgs = {};
|
||||
|
||||
EXPECT_EQ(0u, EncodeDispatchKernel<FamilyType>::getInlineDataOffset(dispatchArgs));
|
||||
}
|
||||
|
||||
@@ -1557,3 +1557,13 @@ HWTEST2_F(EncodeKernelScratchProgrammingTest, givenHeaplessModeDisabledWhenSetSc
|
||||
uint64_t expectedScratchAddress = 0;
|
||||
EXPECT_EQ(expectedScratchAddress, scratchAddress);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncodeStatesTest, givenEncodeDispatchKernelWhenGettingInlineDataOffsetThenReturnWalkerInlineOffset, IsAtLeastXeHpCore) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
|
||||
EncodeDispatchKernelArgs dispatchArgs = {};
|
||||
|
||||
size_t expectedOffset = offsetof(DefaultWalkerType, TheStructure.Common.InlineData);
|
||||
|
||||
EXPECT_EQ(expectedOffset, EncodeDispatchKernel<FamilyType>::getInlineDataOffset(dispatchArgs));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user