mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Move GTPin notifications out from CSR
Change-Id: I4209fc18017c694d71848c3fecd8c3d7440f151b Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
be41b3b30a
commit
0aedea1ae2
@ -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
|
||||
|
@ -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"
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
@ -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 {
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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);
|
||||
|
@ -794,6 +794,10 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
|
||||
dispatchFlags,
|
||||
getDevice());
|
||||
|
||||
if (gtpinIsGTPinInitialized()) {
|
||||
gtpinNotifyFlushTask(completionStamp.taskCount);
|
||||
}
|
||||
|
||||
return completionStamp;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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(>pinCallbacks, &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
|
||||
|
@ -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 {
|
||||
|
||||
|
Reference in New Issue
Block a user