refactor: Add ult with check if bindless ss is patched correctly

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2024-12-18 07:41:17 +00:00
committed by Compute-Runtime-Automation
parent 7986e68dfc
commit 3be52fa1d0
4 changed files with 82 additions and 16 deletions

View File

@@ -183,11 +183,9 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
uint32_t samplerCount = 0;
if constexpr (Family::supportsSampler && heaplessModeEnabled == false) {
if constexpr (Family::supportsSampler) {
if (args.device->getDeviceInfo().imageSupport && !args.makeCommandView) {
uint32_t samplerStateOffset = 0;
if (kernelDescriptor.payloadMappings.samplerTable.numSamplers > 0) {
auto dsHeap = args.dynamicStateHeap;
if (dsHeap == nullptr) {
@@ -199,22 +197,28 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
}
UNRECOVERABLE_IF(!dsHeap);
auto bindlessHeapsHelper = args.device->getBindlessHeapsHelper();
samplerCount = kernelDescriptor.payloadMappings.samplerTable.numSamplers;
samplerStateOffset = EncodeStates<Family>::copySamplerState(
uint64_t samplerStateOffset = EncodeStates<Family>::copySamplerState(
dsHeap, kernelDescriptor.payloadMappings.samplerTable.tableOffset,
kernelDescriptor.payloadMappings.samplerTable.numSamplers, kernelDescriptor.payloadMappings.samplerTable.borderColor,
kernelDescriptor.payloadMappings.samplerTable.numSamplers,
kernelDescriptor.payloadMappings.samplerTable.borderColor,
args.dispatchInterface->getDynamicStateHeapData(),
args.device->getBindlessHeapsHelper(), rootDeviceEnvironment);
bindlessHeapsHelper, rootDeviceEnvironment);
if (args.device->getBindlessHeapsHelper() && !args.device->getBindlessHeapsHelper()->isGlobalDshSupported()) {
if (bindlessHeapsHelper && !bindlessHeapsHelper->isGlobalDshSupported()) {
// add offset of graphics allocation base address relative to heap base address
samplerStateOffset += static_cast<uint32_t>(ptrDiff(dsHeap->getGpuBase(), args.device->getBindlessHeapsHelper()->getGlobalHeapsBase()));
samplerStateOffset += static_cast<uint32_t>(ptrDiff(dsHeap->getGpuBase(), bindlessHeapsHelper->getGlobalHeapsBase()));
}
if (heaplessModeEnabled && bindlessHeapsHelper) {
samplerStateOffset += bindlessHeapsHelper->getGlobalHeapsBase();
}
args.dispatchInterface->patchSamplerBindlessOffsetsInCrossThreadData(samplerStateOffset);
if constexpr (!heaplessModeEnabled) {
idd.setSamplerStatePointer(static_cast<uint32_t>(samplerStateOffset));
}
}
idd.setSamplerStatePointer(samplerStateOffset);
}
}

View File

@@ -30,7 +30,9 @@ struct MockDispatchKernelEncoder : public DispatchKernelEncoderI {
NEO::ImplicitArgs *getImplicitArgs() const override { return nullptr; }
void patchBindlessOffsetsInCrossThreadData(uint64_t bindlessSurfaceStateBaseOffset) const override { return; };
void patchSamplerBindlessOffsetsInCrossThreadData(uint64_t samplerStateOffset) const override { return; };
void patchSamplerBindlessOffsetsInCrossThreadData(uint64_t samplerStateOffset) const override {
samplerStateOffsetPassed = samplerStateOffset;
}
MockGraphicsAllocation mockAllocation{};
static constexpr uint32_t crossThreadSize = 0x40;
@@ -41,6 +43,8 @@ struct MockDispatchKernelEncoder : public DispatchKernelEncoderI {
uint32_t requiredWalkGroupOrder = 0x0u;
KernelDescriptor kernelDescriptor{};
mutable uint64_t samplerStateOffsetPassed = 0u;
ADDMETHOD_CONST_NOBASE(getKernelDescriptor, const KernelDescriptor &, kernelDescriptor, ());
ADDMETHOD_CONST_NOBASE(getGroupSize, const uint32_t *, groupSizes, ());
ADDMETHOD_CONST_NOBASE(getSlmTotalSize, uint32_t, 0u, ());