From 96031e7bba5fad3f45621fa892a1fa2f4caccc05 Mon Sep 17 00:00:00 2001 From: Filip Hazubski Date: Thu, 10 Oct 2019 10:14:11 +0200 Subject: [PATCH] Update programming BarrierEnable Related-To: NEO-3211 Change-Id: I27d04d12414738c8e4a3eef1d29967e47a61c0fb Signed-off-by: Filip Hazubski --- core/gen11/hw_cmds_generated.inl | 4 +-- core/gen12lp/hw_cmds_generated.inl | 4 +-- core/gen9/hw_cmds_generated.inl | 4 +-- .../device_queue/device_queue_hw_bdw_plus.inl | 2 +- runtime/helpers/hardware_commands_helper.inl | 2 +- unit_tests/gen_common/CMakeLists.txt | 1 + unit_tests/gen_common/hw_cmds_tests.cpp | 25 +++++++++++++++++++ 7 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 unit_tests/gen_common/hw_cmds_tests.cpp diff --git a/core/gen11/hw_cmds_generated.inl b/core/gen11/hw_cmds_generated.inl index 789984b328..b09b089359 100644 --- a/core/gen11/hw_cmds_generated.inl +++ b/core/gen11/hw_cmds_generated.inl @@ -466,8 +466,8 @@ typedef struct tagINTERFACE_DESCRIPTOR_DATA { inline SHARED_LOCAL_MEMORY_SIZE getSharedLocalMemorySize(void) const { return static_cast(TheStructure.Common.SharedLocalMemorySize); } - inline void setBarrierEnable(const bool value) { - TheStructure.Common.BarrierEnable = value; + inline void setBarrierEnable(const uint32_t value) { + TheStructure.Common.BarrierEnable = (value > 0u) ? 1u : 0u; } inline bool getBarrierEnable(void) const { return (TheStructure.Common.BarrierEnable); diff --git a/core/gen12lp/hw_cmds_generated.inl b/core/gen12lp/hw_cmds_generated.inl index 5387010373..b0fc33da05 100644 --- a/core/gen12lp/hw_cmds_generated.inl +++ b/core/gen12lp/hw_cmds_generated.inl @@ -468,8 +468,8 @@ typedef struct tagINTERFACE_DESCRIPTOR_DATA { inline SHARED_LOCAL_MEMORY_SIZE getSharedLocalMemorySize(void) const { return static_cast(TheStructure.Common.SharedLocalMemorySize); } - inline void setBarrierEnable(const bool value) { - TheStructure.Common.BarrierEnable = value; + inline void setBarrierEnable(const uint32_t value) { + TheStructure.Common.BarrierEnable = (value > 0u) ? 1u : 0u; } inline bool getBarrierEnable(void) const { return (TheStructure.Common.BarrierEnable); diff --git a/core/gen9/hw_cmds_generated.inl b/core/gen9/hw_cmds_generated.inl index 87199203fa..54cc60c013 100644 --- a/core/gen9/hw_cmds_generated.inl +++ b/core/gen9/hw_cmds_generated.inl @@ -461,8 +461,8 @@ typedef struct tagINTERFACE_DESCRIPTOR_DATA { inline SHARED_LOCAL_MEMORY_SIZE getSharedLocalMemorySize(void) const { return static_cast(TheStructure.Common.SharedLocalMemorySize); } - inline void setBarrierEnable(const bool value) { - TheStructure.Common.BarrierEnable = value; + inline void setBarrierEnable(const uint32_t value) { + TheStructure.Common.BarrierEnable = (value > 0u) ? 1u : 0u; } inline bool getBarrierEnable(void) const { return (TheStructure.Common.BarrierEnable); diff --git a/runtime/device_queue/device_queue_hw_bdw_plus.inl b/runtime/device_queue/device_queue_hw_bdw_plus.inl index ffc55d5d82..15473c5c2f 100644 --- a/runtime/device_queue/device_queue_hw_bdw_plus.inl +++ b/runtime/device_queue/device_queue_hw_bdw_plus.inl @@ -198,7 +198,7 @@ void DeviceQueueHw::setupIndirectState(IndirectHeap &surfaceStateHeap pIDDestination[blockIndex + i] = *pBlockID; pIDDestination[blockIndex + i].setKernelStartPointerHigh(gpuAddress >> 32); pIDDestination[blockIndex + i].setKernelStartPointer((uint32_t)gpuAddress); - pIDDestination[blockIndex + i].setBarrierEnable(pBlockInfo->patchInfo.executionEnvironment->HasBarriers > 0); + pIDDestination[blockIndex + i].setBarrierEnable(pBlockInfo->patchInfo.executionEnvironment->HasBarriers); pIDDestination[blockIndex + i].setDenormMode(INTERFACE_DESCRIPTOR_DATA::DENORM_MODE_SETBYKERNEL); // Set offset to sampler states, block's DHSOffset is added by scheduler diff --git a/runtime/helpers/hardware_commands_helper.inl b/runtime/helpers/hardware_commands_helper.inl index 2686076ed7..5c361440e2 100644 --- a/runtime/helpers/hardware_commands_helper.inl +++ b/runtime/helpers/hardware_commands_helper.inl @@ -163,7 +163,7 @@ size_t HardwareCommandsHelper::sendInterfaceDescriptorData( auto programmableIDSLMSize = static_cast(computeSlmValues(kernel.slmTotalSize)); pInterfaceDescriptor->setSharedLocalMemorySize(programmableIDSLMSize); - pInterfaceDescriptor->setBarrierEnable(!!kernel.getKernelInfo().patchInfo.executionEnvironment->HasBarriers); + pInterfaceDescriptor->setBarrierEnable(kernel.getKernelInfo().patchInfo.executionEnvironment->HasBarriers); PreemptionHelper::programInterfaceDescriptorDataPreemption(pInterfaceDescriptor, preemptionMode); diff --git a/unit_tests/gen_common/CMakeLists.txt b/unit_tests/gen_common/CMakeLists.txt index 1ac439d6f6..275591c60d 100644 --- a/unit_tests/gen_common/CMakeLists.txt +++ b/unit_tests/gen_common/CMakeLists.txt @@ -16,6 +16,7 @@ set(IGDRCL_SRCS_tests_gen_common ${CMAKE_CURRENT_SOURCE_DIR}/exclude_tests/exclude_test_exclude.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gen_cmd_parse.h ${CMAKE_CURRENT_SOURCE_DIR}/gen_commands_common_validation.h + ${CMAKE_CURRENT_SOURCE_DIR}/hw_cmds_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/matchers.h ${NEO_CORE_DIRECTORY}/unit_tests/test_macros${BRANCH_DIR_SUFFIX}/test.h ) diff --git a/unit_tests/gen_common/hw_cmds_tests.cpp b/unit_tests/gen_common/hw_cmds_tests.cpp new file mode 100644 index 0000000000..920b76fa72 --- /dev/null +++ b/unit_tests/gen_common/hw_cmds_tests.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2019 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "runtime/gen_common/hw_cmds.h" +#include "test.h" + +using InterfaceDescriptorDataTests = ::testing::Test; + +HWTEST_F(InterfaceDescriptorDataTests, givenVariousValuesWhenCallingSetBarrierEnableThenCorrectValueIsSet) { + using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; + INTERFACE_DESCRIPTOR_DATA idd = FamilyType::cmdInitInterfaceDescriptorData; + + idd.setBarrierEnable(0); + EXPECT_FALSE(idd.getBarrierEnable()); + + idd.setBarrierEnable(1); + EXPECT_TRUE(idd.getBarrierEnable()); + + idd.setBarrierEnable(2); + EXPECT_TRUE(idd.getBarrierEnable()); +}