From 7b4d6fc27866dd456b0858ac2ab005953e3dfa59 Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Mon, 13 Jan 2020 13:15:03 +0100 Subject: [PATCH] Improve engine helper methods Change-Id: Iac614c3da23119f2000a21e720d5144da0459528 Signed-off-by: Dunajski, Bartosz --- core/helpers/engine_node_helper.cpp | 8 ++++---- core/helpers/engine_node_helper.h | 6 +++--- runtime/command_queue/command_queue.cpp | 2 +- runtime/command_queue/enqueue_common.h | 2 +- runtime/command_queue/gpgpu_walker_base.inl | 6 +++--- runtime/command_queue/gpgpu_walker_bdw_plus.inl | 4 ++-- .../hardware_interface_bdw_plus.inl | 4 ++-- .../aub_command_stream_receiver_hw_base.inl | 4 ++-- runtime/helpers/task_information.cpp | 4 ++-- .../enqueue_execution_model_kernel_tests.cpp | 4 ++-- .../helpers/hardware_commands_helper_tests.cpp | 16 ++++++++-------- 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/core/helpers/engine_node_helper.cpp b/core/helpers/engine_node_helper.cpp index bdefc901da..81aa9500d9 100644 --- a/core/helpers/engine_node_helper.cpp +++ b/core/helpers/engine_node_helper.cpp @@ -1,14 +1,14 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ -#include "engine_node.h" +#include "core/helpers/engine_node_helper.h" namespace NEO { - +namespace EngineHelpers { bool isCcs(aub_stream::EngineType engineType) { return engineType == aub_stream::ENGINE_CCS; } @@ -16,5 +16,5 @@ bool isCcs(aub_stream::EngineType engineType) { bool isBcs(aub_stream::EngineType engineType) { return engineType == aub_stream::ENGINE_BCS; } - +} // namespace EngineHelpers } // namespace NEO diff --git a/core/helpers/engine_node_helper.h b/core/helpers/engine_node_helper.h index 6c379e79e3..7600ab0103 100644 --- a/core/helpers/engine_node_helper.h +++ b/core/helpers/engine_node_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,8 +10,8 @@ #include "engine_node.h" namespace NEO { - +namespace EngineHelpers { bool isCcs(aub_stream::EngineType engineType); bool isBcs(aub_stream::EngineType engineType); - +}; // namespace EngineHelpers } // namespace NEO diff --git a/runtime/command_queue/command_queue.cpp b/runtime/command_queue/command_queue.cpp index 20b1ea8205..924cb306a7 100644 --- a/runtime/command_queue/command_queue.cpp +++ b/runtime/command_queue/command_queue.cpp @@ -292,7 +292,7 @@ bool CommandQueue::setPerfCountersEnabled() { DEBUG_BREAK_IF(device == nullptr); auto perfCounters = device->getPerformanceCounters(); - bool isCcsEngine = isCcs(getGpgpuEngine().osContext->getEngineType()); + bool isCcsEngine = EngineHelpers::isCcs(getGpgpuEngine().osContext->getEngineType()); perfCountersEnabled = perfCounters->enable(isCcsEngine); diff --git a/runtime/command_queue/enqueue_common.h b/runtime/command_queue/enqueue_common.h index a5766c42db..e0849f25ec 100644 --- a/runtime/command_queue/enqueue_common.h +++ b/runtime/command_queue/enqueue_common.h @@ -532,7 +532,7 @@ void CommandQueueHw::processDeviceEnqueue(DeviceQueueHw *d bool &blocking) { auto parentKernel = multiDispatchInfo.peekParentKernel(); size_t minSizeSSHForEM = HardwareCommandsHelper::getSshSizeForExecutionModel(*parentKernel); - bool isCcsUsed = isCcs(gpgpuEngine->osContext->getEngineType()); + bool isCcsUsed = EngineHelpers::isCcs(gpgpuEngine->osContext->getEngineType()); uint32_t taskCount = getGpgpuCommandStreamReceiver().peekTaskCount() + 1; devQueueHw->setupExecutionModelDispatch(getIndirectHeap(IndirectHeap::SURFACE_STATE, minSizeSSHForEM), diff --git a/runtime/command_queue/gpgpu_walker_base.inl b/runtime/command_queue/gpgpu_walker_base.inl index 4b4d95aad1..d87e00f563 100644 --- a/runtime/command_queue/gpgpu_walker_base.inl +++ b/runtime/command_queue/gpgpu_walker_base.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -159,7 +159,7 @@ void GpgpuWalkerHelper::dispatchPerfCountersCommandsStart( LinearStream *commandStream) { const auto pPerformanceCounters = commandQueue.getPerfCounters(); - const auto commandBufferType = isCcs(commandQueue.getDevice().getDefaultEngine().osContext->getEngineType()) + const auto commandBufferType = EngineHelpers::isCcs(commandQueue.getDevice().getDefaultEngine().osContext->getEngineType()) ? MetricsLibraryApi::GpuCommandBufferType::Compute : MetricsLibraryApi::GpuCommandBufferType::Render; const uint32_t size = pPerformanceCounters->getGpuCommandsSize(commandBufferType, true); @@ -175,7 +175,7 @@ void GpgpuWalkerHelper::dispatchPerfCountersCommandsEnd( LinearStream *commandStream) { const auto pPerformanceCounters = commandQueue.getPerfCounters(); - const auto commandBufferType = isCcs(commandQueue.getDevice().getDefaultEngine().osContext->getEngineType()) + const auto commandBufferType = EngineHelpers::isCcs(commandQueue.getDevice().getDefaultEngine().osContext->getEngineType()) ? MetricsLibraryApi::GpuCommandBufferType::Compute : MetricsLibraryApi::GpuCommandBufferType::Render; const uint32_t size = pPerformanceCounters->getGpuCommandsSize(commandBufferType, false); diff --git a/runtime/command_queue/gpgpu_walker_bdw_plus.inl b/runtime/command_queue/gpgpu_walker_bdw_plus.inl index 535fc15b32..b0c5603e5c 100644 --- a/runtime/command_queue/gpgpu_walker_bdw_plus.inl +++ b/runtime/command_queue/gpgpu_walker_bdw_plus.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -194,7 +194,7 @@ size_t EnqueueOperation::getSizeRequiredCSKernel(bool reserveProfilin } if (reservePerfCounters) { - const auto commandBufferType = isCcs(commandQueue.getDevice().getDefaultEngine().osContext->getEngineType()) + const auto commandBufferType = EngineHelpers::isCcs(commandQueue.getDevice().getDefaultEngine().osContext->getEngineType()) ? MetricsLibraryApi::GpuCommandBufferType::Compute : MetricsLibraryApi::GpuCommandBufferType::Render; diff --git a/runtime/command_queue/hardware_interface_bdw_plus.inl b/runtime/command_queue/hardware_interface_bdw_plus.inl index 165ddfab11..14f6230767 100644 --- a/runtime/command_queue/hardware_interface_bdw_plus.inl +++ b/runtime/command_queue/hardware_interface_bdw_plus.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -114,7 +114,7 @@ inline void HardwareInterface::programWalker( GpgpuWalkerHelper::setupTimestampPacket(&commandStream, walkerCmd, timestampPacketNode, TimestampPacketStorage::WriteOperationType::AfterWalker, commandQueue.getDevice().getHardwareInfo()); } - auto isCcsUsed = isCcs(commandQueue.getGpgpuEngine().osContext->getEngineType()); + auto isCcsUsed = EngineHelpers::isCcs(commandQueue.getGpgpuEngine().osContext->getEngineType()); HardwareCommandsHelper::sendIndirectState( commandStream, diff --git a/runtime/command_stream/aub_command_stream_receiver_hw_base.inl b/runtime/command_stream/aub_command_stream_receiver_hw_base.inl index 237c8bbc40..c292669e1b 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw_base.inl +++ b/runtime/command_stream/aub_command_stream_receiver_hw_base.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -729,7 +729,7 @@ void AUBCommandStreamReceiverHw::processResidency(const ResidencyCont template void AUBCommandStreamReceiverHw::dumpAllocation(GraphicsAllocation &gfxAllocation) { - if (isBcs(this->osContext->getEngineType())) { + if (EngineHelpers::isBcs(this->osContext->getEngineType())) { return; } diff --git a/runtime/helpers/task_information.cpp b/runtime/helpers/task_information.cpp index 8653c17177..6d76fd2812 100644 --- a/runtime/helpers/task_information.cpp +++ b/runtime/helpers/task_information.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -130,7 +130,7 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate auto devQueue = commandQueue.getContext().getDefaultDeviceQueue(); auto commandStreamReceiverOwnership = commandStreamReceiver.obtainUniqueOwnership(); - bool isCcsUsed = isCcs(commandQueue.getGpgpuEngine().osContext->getEngineType()); + bool isCcsUsed = EngineHelpers::isCcs(commandQueue.getGpgpuEngine().osContext->getEngineType()); if (executionModelKernel) { while (!devQueue->isEMCriticalSectionFree()) diff --git a/unit_tests/execution_model/enqueue_execution_model_kernel_tests.cpp b/unit_tests/execution_model/enqueue_execution_model_kernel_tests.cpp index f6eeef7ffd..69850a56ef 100644 --- a/unit_tests/execution_model/enqueue_execution_model_kernel_tests.cpp +++ b/unit_tests/execution_model/enqueue_execution_model_kernel_tests.cpp @@ -62,7 +62,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelWhenEnqueu auto graphicsAllocation = pKernel->getKernelInfo().getGraphicsAllocation(); auto kernelIsaAddress = graphicsAllocation->getGpuAddressToPatch(); - if (isCcs(pCmdQ->getGpgpuEngine().osContext->getEngineType()) && HwHelperHw::isOffsetToSkipSetFFIDGPWARequired(pKernel->getDevice().getHardwareInfo())) { + if (EngineHelpers::isCcs(pCmdQ->getGpgpuEngine().osContext->getEngineType()) && HwHelperHw::isOffsetToSkipSetFFIDGPWARequired(pKernel->getDevice().getHardwareInfo())) { kernelIsaAddress += pKernel->getKernelInfo().patchInfo.threadPayload->OffsetToSkipSetFFIDGP; } @@ -104,7 +104,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelWhenEnqueu uint64_t blockKernelAddress = ((uint64_t)idData[blockFirstIndex + i].getKernelStartPointerHigh() << 32) | (uint64_t)idData[blockFirstIndex + i].getKernelStartPointer(); uint64_t expectedBlockKernelAddress = pBlockInfo->getGraphicsAllocation()->getGpuAddressToPatch(); - if (isCcs(pCmdQ->getGpgpuEngine().osContext->getEngineType()) && HwHelperHw::isOffsetToSkipSetFFIDGPWARequired(pKernel->getDevice().getHardwareInfo())) { + if (EngineHelpers::isCcs(pCmdQ->getGpgpuEngine().osContext->getEngineType()) && HwHelperHw::isOffsetToSkipSetFFIDGPWARequired(pKernel->getDevice().getHardwareInfo())) { expectedBlockKernelAddress += pBlockInfo->patchInfo.threadPayload->OffsetToSkipSetFFIDGP; } diff --git a/unit_tests/helpers/hardware_commands_helper_tests.cpp b/unit_tests/helpers/hardware_commands_helper_tests.cpp index 663b5af183..2ffd4b133a 100644 --- a/unit_tests/helpers/hardware_commands_helper_tests.cpp +++ b/unit_tests/helpers/hardware_commands_helper_tests.cpp @@ -324,7 +324,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, sendIndirectStateResourceUsage IDToffset, sizeof(INTERFACE_DESCRIPTOR_DATA)); uint32_t interfaceDescriptorIndex = 0; - auto isCcsUsed = isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); + auto isCcsUsed = EngineHelpers::isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); HardwareCommandsHelper::sendIndirectState( commandStream, @@ -377,7 +377,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenKernelWithFourBindingTabl const size_t localWorkSize = 256; const size_t localWorkSizes[3]{localWorkSize, 1, 1}; uint32_t interfaceDescriptorIndex = 0; - auto isCcsUsed = isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); + auto isCcsUsed = EngineHelpers::isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); HardwareCommandsHelper::sendIndirectState( commandStream, dsh, @@ -422,7 +422,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenKernelThatIsSchedulerWhen const size_t localWorkSize = 256; const size_t localWorkSizes[3]{localWorkSize, 1, 1}; uint32_t interfaceDescriptorIndex = 0; - auto isCcsUsed = isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); + auto isCcsUsed = EngineHelpers::isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); HardwareCommandsHelper::sendIndirectState( commandStream, dsh, @@ -461,7 +461,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenKernelWith100BindingTable const size_t localWorkSize = 256; const size_t localWorkSizes[3]{localWorkSize, 1, 1}; uint32_t interfaceDescriptorIndex = 0; - auto isCcsUsed = isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); + auto isCcsUsed = EngineHelpers::isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); HardwareCommandsHelper::sendIndirectState( commandStream, dsh, @@ -535,7 +535,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, whenSendingIndirectStateThenKe modifiedKernelInfo.workgroupDimensionsOrder[2] = 0; MockKernel mockKernel{kernel->getProgram(), modifiedKernelInfo, kernel->getDevice(), false}; uint32_t interfaceDescriptorIndex = 0; - auto isCcsUsed = isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); + auto isCcsUsed = EngineHelpers::isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); HardwareCommandsHelper::sendIndirectState( commandStream, dsh, @@ -617,7 +617,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, usedBindingTableStatePointer) // force statefull path for buffers const_cast(kernelInfo).requiresSshForBuffers = true; uint32_t interfaceDescriptorIndex = 0; - auto isCcsUsed = isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); + auto isCcsUsed = EngineHelpers::isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); HardwareCommandsHelper::sendIndirectState( commandStream, dsh, @@ -779,7 +779,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, usedBindingTableStatePointersF // push surfaces states and binding table to given ssh heap uint32_t interfaceDescriptorIndex = 0; - auto isCcsUsed = isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); + auto isCcsUsed = EngineHelpers::isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); HardwareCommandsHelper::sendIndirectState( commandStream, dsh, @@ -1059,7 +1059,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, GivenKernelWithSamplersWhenInd mockKernelWithInternal->mockKernel->setCrossThreadData(mockKernelWithInternal->crossThreadData, sizeof(mockKernelWithInternal->crossThreadData)); mockKernelWithInternal->mockKernel->setSshLocal(mockKernelWithInternal->sshLocal, sizeof(mockKernelWithInternal->sshLocal)); uint32_t interfaceDescriptorIndex = 0; - auto isCcsUsed = isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); + auto isCcsUsed = EngineHelpers::isCcs(cmdQ.getGpgpuEngine().osContext->getEngineType()); HardwareCommandsHelper::sendIndirectState( commandStream, dsh,