Skip to content

Commit 65ba8e9

Browse files
Fix programBarrierEnable call
Related-To: NEO-3211 Change-Id: I14b89d650d8f6aa4aed01d3b15f5392e1ca15cbd Signed-off-by: Filip Hazubski <[email protected]>
1 parent 79e7a51 commit 65ba8e9

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

runtime/device_queue/device_queue_hw_bdw_plus.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void DeviceQueueHw<GfxFamily>::setupIndirectState(IndirectHeap &surfaceStateHeap
199199
pIDDestination[blockIndex + i].setKernelStartPointerHigh(gpuAddress >> 32);
200200
pIDDestination[blockIndex + i].setKernelStartPointer((uint32_t)gpuAddress);
201201
pIDDestination[blockIndex + i].setDenormMode(INTERFACE_DESCRIPTOR_DATA::DENORM_MODE_SETBYKERNEL);
202-
HardwareCommandsHelper<GfxFamily>::programBarrierEnable(ptrOffset(pIDDestination, blockIndex + i),
202+
HardwareCommandsHelper<GfxFamily>::programBarrierEnable(&pIDDestination[blockIndex + i],
203203
pBlockInfo->patchInfo.executionEnvironment->HasBarriers,
204204
parentKernel->getDevice().getHardwareInfo());
205205

unit_tests/device_queue/device_queue_hw_tests.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,42 @@ HWCMDTEST_P(IGFX_GEN8_CORE, DeviceQueueHwWithKernel, setupIndirectStateSetsCorre
616616
}
617617
}
618618

619+
HWCMDTEST_P(IGFX_GEN8_CORE, DeviceQueueHwWithKernel, GivenHasBarriersSetWhenCallingSetupIndirectStateThenAllIddHaveBarriersEnabled) {
620+
using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER;
621+
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
622+
623+
if (std::string(pPlatform->getDevice(0)->getDeviceInfo().clVersion).find("OpenCL 2.") != std::string::npos) {
624+
pKernel->createReflectionSurface();
625+
626+
MockContext mockContext;
627+
auto devQueueHw = std::make_unique<MockDeviceQueueHw<FamilyType>>(&mockContext, device, deviceQueueProperties::minimumProperties[0]);
628+
auto dsh = devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
629+
630+
uint32_t parentCount = 1;
631+
632+
auto blockManager = pKernel->getProgram()->getBlockKernelManager();
633+
auto iddCount = blockManager->getCount();
634+
for (uint32_t i = 0; i < iddCount; i++) {
635+
((SPatchExecutionEnvironment *)blockManager->getBlockKernelInfo(i)->patchInfo.executionEnvironment)->HasBarriers = 1u;
636+
}
637+
638+
auto surfaceStateHeapSize =
639+
HardwareCommandsHelper<FamilyType>::getSizeRequiredForExecutionModel(IndirectHeap::SURFACE_STATE,
640+
const_cast<const Kernel &>(*pKernel));
641+
auto ssh = std::make_unique<IndirectHeap>(alignedMalloc(surfaceStateHeapSize, MemoryConstants::pageSize), surfaceStateHeapSize);
642+
643+
devQueueHw->setupIndirectState(*ssh, *dsh, pKernel, parentCount);
644+
645+
auto iddStartPtr = static_cast<INTERFACE_DESCRIPTOR_DATA *>(ptrOffset(dsh->getCpuBase(), devQueueHw->colorCalcStateSize));
646+
auto iddStartIndex = parentCount;
647+
for (uint32_t i = 0; i < iddCount; i++) {
648+
EXPECT_TRUE(iddStartPtr[iddStartIndex + i].getBarrierEnable());
649+
}
650+
651+
alignedFree(ssh->getCpuBase());
652+
}
653+
}
654+
619655
static const char *binaryFile = "simple_block_kernel";
620656
static const char *KernelNames[] = {"kernel_reflection", "simple_block_kernel"};
621657

0 commit comments

Comments
 (0)