Move GTPin notifications out from CSR

Change-Id: I4209fc18017c694d71848c3fecd8c3d7440f151b
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-02-19 16:32:40 +01:00
committed by sys_ocldev
parent be41b3b30a
commit 0aedea1ae2
17 changed files with 80 additions and 33 deletions

View File

@ -10,6 +10,9 @@ set(NEO_CORE_COMMAND_STREAM
${CMAKE_CURRENT_SOURCE_DIR}/csr_definitions.h
${CMAKE_CURRENT_SOURCE_DIR}/csr_deps.cpp
${CMAKE_CURRENT_SOURCE_DIR}/csr_deps.h
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.h
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.inl
${CMAKE_CURRENT_SOURCE_DIR}/linear_stream.cpp
${CMAKE_CURRENT_SOURCE_DIR}/linear_stream.h
${CMAKE_CURRENT_SOURCE_DIR}/preemption_mode.h

View File

@ -5,7 +5,7 @@
*
*/
#include "runtime/command_stream/experimental_command_buffer.h"
#include "core/command_stream/experimental_command_buffer.h"
#include "core/command_stream/linear_stream.h"
#include "core/memory_manager/internal_allocation_storage.h"

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*

View File

@ -5,12 +5,12 @@
*
*/
#include "core/command_stream/experimental_command_buffer.h"
#include "core/command_stream/linear_stream.h"
#include "core/execution_environment/root_device_environment.h"
#include "core/helpers/hw_helper.h"
#include "core/memory_manager/graphics_allocation.h"
#include "runtime/command_stream/command_stream_receiver_hw.h"
#include "runtime/command_stream/experimental_command_buffer.h"
namespace NEO {

View File

@ -7,6 +7,7 @@
#include "core/device/device.h"
#include "core/command_stream/experimental_command_buffer.h"
#include "core/command_stream/preemption.h"
#include "core/execution_environment/root_device_environment.h"
#include "core/helpers/hw_helper.h"
@ -15,7 +16,6 @@
#include "core/os_interface/os_interface.h"
#include "core/os_interface/os_time.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/command_stream/experimental_command_buffer.h"
#include "runtime/device/driver_info.h"
#include "runtime/source_level_debugger/source_level_debugger.h"

View File

@ -150,6 +150,10 @@ void CommandQueue::waitUntilComplete(uint32_t taskCountToWait, FlushStamp flushS
useQuickKmdSleep, forcePowerSavingMode);
DEBUG_BREAK_IF(getHwTag() < taskCountToWait);
if (gtpinIsGTPinInitialized()) {
gtpinNotifyTaskCompletion(taskCountToWait);
}
if (auto bcsCsr = getBcsCommandStreamReceiver()) {
bcsCsr->waitForTaskCountWithKmdNotifyFallback(bcsTaskCount, 0, false, false);
bcsCsr->waitForTaskCountAndCleanTemporaryAllocationList(bcsTaskCount);

View File

@ -794,6 +794,10 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
dispatchFlags,
getDevice());
if (gtpinIsGTPinInitialized()) {
gtpinNotifyFlushTask(completionStamp.taskCount);
}
return completionStamp;
}

View File

@ -29,9 +29,6 @@ set(RUNTIME_SRCS_COMMAND_STREAM
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_common_hw_base.inl
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_common_hw_bdw_plus.inl
${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream.h
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.h
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.inl
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/per_dss_backed_buffer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver.h

View File

@ -7,6 +7,7 @@
#include "runtime/command_stream/command_stream_receiver.h"
#include "core/command_stream/experimental_command_buffer.h"
#include "core/command_stream/preemption.h"
#include "core/command_stream/scratch_space_controller.h"
#include "core/device/device.h"
@ -25,11 +26,9 @@
#include "core/utilities/cpuintrinsics.h"
#include "core/utilities/tag_allocator.h"
#include "runtime/built_ins/built_ins.h"
#include "runtime/command_stream/experimental_command_buffer.h"
#include "runtime/gtpin/gtpin_notify.h"
#include "runtime/platform/platform.h"
namespace NEO {
// Global table of CommandStreamReceiver factories for HW and tests
CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE] = {};
@ -226,9 +225,6 @@ bool CommandStreamReceiver::waitForCompletionWithTimeout(bool enableTimeout, int
}
}
if (*getTagAddress() >= taskCountToWait) {
if (gtpinIsGTPinInitialized()) {
gtpinNotifyTaskCompletion(taskCountToWait);
}
return true;
}
return false;

View File

@ -5,6 +5,7 @@
*
*/
#include "core/command_stream/experimental_command_buffer.h"
#include "core/command_stream/linear_stream.h"
#include "core/command_stream/preemption.h"
#include "core/command_stream/scratch_space_controller_base.h"
@ -28,8 +29,6 @@
#include "core/os_interface/os_context.h"
#include "core/utilities/tag_allocator.h"
#include "runtime/command_stream/command_stream_receiver_hw.h"
#include "runtime/command_stream/experimental_command_buffer.h"
#include "runtime/gtpin/gtpin_notify.h"
#include "runtime/helpers/hardware_commands_helper.h"
#include "command_stream_receiver_hw_ext.inl"
@ -515,10 +514,6 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
this->taskLevel += levelClosed ? 1 : 0;
if (gtpinIsGTPinInitialized()) {
gtpinNotifyFlushTask(completionStamp.taskCount);
}
return completionStamp;
}

View File

@ -1,13 +1,13 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "core/command_stream/experimental_command_buffer.h"
#include "core/command_stream/experimental_command_buffer.inl"
#include "core/helpers/hw_helper.h"
#include "runtime/command_stream/experimental_command_buffer.h"
#include "runtime/command_stream/experimental_command_buffer.inl"
namespace NEO {
typedef ICLFamily GfxFamily;

View File

@ -1,13 +1,13 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "core/command_stream/experimental_command_buffer.h"
#include "core/command_stream/experimental_command_buffer.inl"
#include "core/helpers/hw_helper.h"
#include "runtime/command_stream/experimental_command_buffer.h"
#include "runtime/command_stream/experimental_command_buffer.inl"
namespace NEO {
typedef TGLLPFamily GfxFamily;

View File

@ -1,13 +1,13 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "core/command_stream/experimental_command_buffer.h"
#include "core/command_stream/experimental_command_buffer.inl"
#include "core/helpers/hw_helper.h"
#include "runtime/command_stream/experimental_command_buffer.h"
#include "runtime/command_stream/experimental_command_buffer.inl"
namespace NEO {
typedef BDWFamily GfxFamily;

View File

@ -1,13 +1,13 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "core/command_stream/experimental_command_buffer.h"
#include "core/command_stream/experimental_command_buffer.inl"
#include "core/helpers/hw_helper.h"
#include "runtime/command_stream/experimental_command_buffer.h"
#include "runtime/command_stream/experimental_command_buffer.inl"
namespace NEO {
typedef SKLFamily GfxFamily;

View File

@ -260,6 +260,10 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
dispatchFlags,
commandQueue.getDevice());
if (gtpinIsGTPinInitialized()) {
gtpinNotifyFlushTask(completionStamp.taskCount);
}
if (printfHandler) {
commandQueue.waitUntilComplete(completionStamp.taskCount, completionStamp.flushStamp, false);
printfHandler.get()->printEnqueueOutput();

View File

@ -30,6 +30,7 @@
#include "unit_tests/helpers/kernel_binary_helper.h"
#include "unit_tests/helpers/test_files.h"
#include "unit_tests/helpers/variable_backup.h"
#include "unit_tests/mocks/mock_buffer.h"
#include "unit_tests/mocks/mock_command_queue.h"
#include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_device.h"
@ -2349,4 +2350,47 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOnKernelCreateIsCalledWithN
EXPECT_EQ(prevCreateCount, KernelCreateCallbackCount);
}
HWTEST_F(GTPinTests, givenGtPinInitializedWhenSubmittingKernelCommandThenFlushedTaskCountIsNotified) {
auto mockCmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(pContext, pDevice, nullptr);
auto onKernelSubmitFnc = [](command_buffer_handle_t cb, uint64_t kernelId, uint32_t *entryOffset, resource_handle_t *resource) { return; };
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onKernelSubmit = onKernelSubmitFnc;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
IndirectHeap *ih1 = nullptr, *ih2 = nullptr, *ih3 = nullptr;
mockCmdQ->allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 128, ih1);
mockCmdQ->allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 128, ih2);
mockCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, 128, ih3);
PreemptionMode preemptionMode = pDevice->getPreemptionMode();
auto cmdStream = new LinearStream(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), 128, GraphicsAllocation::AllocationType::COMMAND_BUFFER}));
std::vector<Surface *> surfaces;
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *mockCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
MockKernelWithInternals kernel(*pDevice);
kernel.kernelInfo.usesSsh = true;
kernelOperation->setHeaps(ih1, ih2, ih3);
bool flushDC = false;
bool slmUsed = false;
bool ndRangeKernel = false;
gtpinNotifyKernelSubmit(kernel, mockCmdQ.get());
std::unique_ptr<Command> command(new CommandComputeKernel(*mockCmdQ, kernelOperation, surfaces, flushDC, slmUsed, ndRangeKernel, nullptr, preemptionMode, kernel, 1));
CompletionStamp stamp = command->submit(20, false);
ASSERT_EQ(1u, kernelExecQueue.size());
EXPECT_TRUE(kernelExecQueue[0].isTaskCountValid);
EXPECT_EQ(kernelExecQueue[0].taskCount, stamp.taskCount);
}
} // namespace ULT

View File

@ -1,12 +1,12 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "runtime/command_stream/experimental_command_buffer.h"
#include "core/command_stream/experimental_command_buffer.h"
namespace NEO {