Skip to content

Commit 6a7b701

Browse files
Add programBarrierEnable helper function
Related-To: NEO-3211 Change-Id: I7afe11fa9d440837d66f0003b9e02db1f404d650 Signed-off-by: Filip Hazubski <[email protected]>
1 parent 100f888 commit 6a7b701

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

runtime/device_queue/device_queue_hw_bdw_plus.inl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@ void DeviceQueueHw<GfxFamily>::setupIndirectState(IndirectHeap &surfaceStateHeap
198198
pIDDestination[blockIndex + i] = *pBlockID;
199199
pIDDestination[blockIndex + i].setKernelStartPointerHigh(gpuAddress >> 32);
200200
pIDDestination[blockIndex + i].setKernelStartPointer((uint32_t)gpuAddress);
201-
pIDDestination[blockIndex + i].setBarrierEnable(pBlockInfo->patchInfo.executionEnvironment->HasBarriers);
202201
pIDDestination[blockIndex + i].setDenormMode(INTERFACE_DESCRIPTOR_DATA::DENORM_MODE_SETBYKERNEL);
202+
HardwareCommandsHelper<GfxFamily>::programBarrierEnable(ptrOffset(pIDDestination, blockIndex + i),
203+
pBlockInfo->patchInfo.executionEnvironment->HasBarriers,
204+
parentKernel->getDevice().getHardwareInfo());
203205

204206
// Set offset to sampler states, block's DHSOffset is added by scheduler
205207
pIDDestination[blockIndex + i].setSamplerStatePointer(static_cast<uint32_t>(pBlockInfo->getBorderColorStateSize()));

runtime/helpers/hardware_commands_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ struct HardwareCommandsHelper : public PerThreadDataHelper {
207207
static MI_ATOMIC *programMiAtomic(LinearStream &commandStream, uint64_t writeAddress, typename MI_ATOMIC::ATOMIC_OPCODES opcode, typename MI_ATOMIC::DATA_SIZE dataSize);
208208
static void programMiAtomic(MI_ATOMIC &atomic, uint64_t writeAddress, typename MI_ATOMIC::ATOMIC_OPCODES opcode, typename MI_ATOMIC::DATA_SIZE dataSize);
209209
static void programCacheFlushAfterWalkerCommand(LinearStream *commandStream, const CommandQueue &commandQueue, const Kernel *kernel, uint64_t postSyncAddress);
210+
static void programBarrierEnable(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo);
210211

211212
static const size_t alignInterfaceDescriptorData = 64 * sizeof(uint8_t);
212213
static const uint32_t alignIndirectStatePointer = 64 * sizeof(uint8_t);

runtime/helpers/hardware_commands_helper.inl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ size_t HardwareCommandsHelper<GfxFamily>::sendInterfaceDescriptorData(
163163
auto programmableIDSLMSize = static_cast<typename INTERFACE_DESCRIPTOR_DATA::SHARED_LOCAL_MEMORY_SIZE>(computeSlmValues(kernel.slmTotalSize));
164164

165165
pInterfaceDescriptor->setSharedLocalMemorySize(programmableIDSLMSize);
166-
pInterfaceDescriptor->setBarrierEnable(kernel.getKernelInfo().patchInfo.executionEnvironment->HasBarriers);
166+
programBarrierEnable(pInterfaceDescriptor, kernel.getKernelInfo().patchInfo.executionEnvironment->HasBarriers,
167+
kernel.getDevice().getHardwareInfo());
167168

168169
PreemptionHelper::programInterfaceDescriptorDataPreemption<GfxFamily>(pInterfaceDescriptor, preemptionMode);
169170

runtime/helpers/hardware_commands_helper_base.inl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,10 @@ void HardwareCommandsHelper<GfxFamily>::programCacheFlushAfterWalkerCommand(Line
170170

171171
template <typename GfxFamily>
172172
void HardwareCommandsHelper<GfxFamily>::appendMiFlushDw(typename GfxFamily::MI_FLUSH_DW *miFlushDwCmd) {}
173+
174+
template <typename GfxFamily>
175+
void HardwareCommandsHelper<GfxFamily>::programBarrierEnable(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo) {
176+
pInterfaceDescriptor->setBarrierEnable(value);
177+
}
178+
173179
} // namespace NEO

unit_tests/gen_common/hw_cmds_tests.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,24 @@
66
*/
77

88
#include "runtime/gen_common/hw_cmds.h"
9+
#include "runtime/helpers/hardware_commands_helper.h"
910
#include "test.h"
11+
#include "unit_tests/mocks/mock_device.h"
1012

1113
using InterfaceDescriptorDataTests = ::testing::Test;
1214

13-
HWTEST_F(InterfaceDescriptorDataTests, givenVariousValuesWhenCallingSetBarrierEnableThenCorrectValueIsSet) {
15+
HWCMDTEST_F(IGFX_GEN8_CORE, InterfaceDescriptorDataTests, givenVariousValuesWhenCallingSetBarrierEnableThenCorrectValueIsSet) {
1416
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
1517
INTERFACE_DESCRIPTOR_DATA idd = FamilyType::cmdInitInterfaceDescriptorData;
18+
MockDevice device;
19+
auto hwInfo = device.getHardwareInfo();
1620

17-
idd.setBarrierEnable(0);
21+
HardwareCommandsHelper<FamilyType>::programBarrierEnable(&idd, 0, hwInfo);
1822
EXPECT_FALSE(idd.getBarrierEnable());
1923

20-
idd.setBarrierEnable(1);
24+
HardwareCommandsHelper<FamilyType>::programBarrierEnable(&idd, 1, hwInfo);
2125
EXPECT_TRUE(idd.getBarrierEnable());
2226

23-
idd.setBarrierEnable(2);
27+
HardwareCommandsHelper<FamilyType>::programBarrierEnable(&idd, 2, hwInfo);
2428
EXPECT_TRUE(idd.getBarrierEnable());
2529
}

0 commit comments

Comments
 (0)