diff --git a/core/command_stream/CMakeLists.txt b/core/command_stream/CMakeLists.txt index e9e58064bf..d1eebf50c0 100644 --- a/core/command_stream/CMakeLists.txt +++ b/core/command_stream/CMakeLists.txt @@ -6,6 +6,7 @@ set(NEO_CORE_COMMAND_STREAM ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/aub_subcapture_status.h ${CMAKE_CURRENT_SOURCE_DIR}/csr_definitions.h ${CMAKE_CURRENT_SOURCE_DIR}/csr_deps.cpp ${CMAKE_CURRENT_SOURCE_DIR}/csr_deps.h @@ -15,6 +16,8 @@ set(NEO_CORE_COMMAND_STREAM ${CMAKE_CURRENT_SOURCE_DIR}/preemption.cpp ${CMAKE_CURRENT_SOURCE_DIR}/preemption.h ${CMAKE_CURRENT_SOURCE_DIR}/preemption.inl + ${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.h ${CMAKE_CURRENT_SOURCE_DIR}/thread_arbitration_policy.h ) diff --git a/core/command_stream/aub_subcapture_status.h b/core/command_stream/aub_subcapture_status.h new file mode 100644 index 0000000000..bad38b52f0 --- /dev/null +++ b/core/command_stream/aub_subcapture_status.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +namespace NEO { + +struct AubSubCaptureStatus { + bool isActive; + bool wasActiveInPreviousEnqueue; +}; +} // namespace NEO diff --git a/runtime/command_stream/submissions_aggregator.cpp b/core/command_stream/submissions_aggregator.cpp similarity index 100% rename from runtime/command_stream/submissions_aggregator.cpp rename to core/command_stream/submissions_aggregator.cpp diff --git a/runtime/command_stream/submissions_aggregator.h b/core/command_stream/submissions_aggregator.h similarity index 98% rename from runtime/command_stream/submissions_aggregator.h rename to core/command_stream/submissions_aggregator.h index 379a26e10e..ce21a5de48 100644 --- a/runtime/command_stream/submissions_aggregator.h +++ b/core/command_stream/submissions_aggregator.h @@ -11,7 +11,6 @@ #include "core/memory_manager/residency_container.h" #include "core/utilities/idlist.h" #include "core/utilities/stackvec.h" -#include "runtime/helpers/properties_helper.h" #include namespace NEO { diff --git a/core/helpers/CMakeLists.txt b/core/helpers/CMakeLists.txt index 25d27a3478..5faebd5fba 100644 --- a/core/helpers/CMakeLists.txt +++ b/core/helpers/CMakeLists.txt @@ -9,6 +9,7 @@ set(NEO_CORE_HELPERS ${CMAKE_CURRENT_SOURCE_DIR}/abort.h ${CMAKE_CURRENT_SOURCE_DIR}/address_patch.h ${CMAKE_CURRENT_SOURCE_DIR}/aligned_memory.h + ${CMAKE_CURRENT_SOURCE_DIR}/aux_translation.h ${CMAKE_CURRENT_SOURCE_DIR}/basic_math.h ${CMAKE_CURRENT_SOURCE_DIR}/cache_policy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cache_policy.h diff --git a/core/helpers/aux_translation.h b/core/helpers/aux_translation.h new file mode 100644 index 0000000000..ce8a2ae708 --- /dev/null +++ b/core/helpers/aux_translation.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +namespace NEO { + +enum class AuxTranslationDirection { + None, + AuxToNonAux, + NonAuxToAux +}; + +enum class AuxTranslationMode : int32_t { + Builtin = 0, + Blit = 1 +}; +} // namespace NEO diff --git a/core/helpers/hw_helper.h b/core/helpers/hw_helper.h index 1578846020..088b50d1a9 100644 --- a/core/helpers/hw_helper.h +++ b/core/helpers/hw_helper.h @@ -7,6 +7,7 @@ #pragma once #include "core/command_stream/linear_stream.h" +#include "core/helpers/aux_translation.h" #include "core/helpers/hw_cmds.h" #include "runtime/built_ins/sip.h" #include "runtime/gen_common/aub_mapper.h" diff --git a/runtime/command_queue/enqueue_common.h b/runtime/command_queue/enqueue_common.h index 2da81da7c2..1242e8330c 100644 --- a/runtime/command_queue/enqueue_common.h +++ b/runtime/command_queue/enqueue_common.h @@ -502,8 +502,10 @@ void CommandQueueHw::processDispatchForBlitAuxTranslation(const Multi } if (!queueBlocked) { + CsrDependencies csrDeps; + eventsRequest.fillCsrDependencies(csrDeps, *getBcsCommandStreamReceiver(), CsrDependencies::DependenciesType::All); BlitProperties::setupDependenciesForAuxTranslation(blitPropertiesContainer, timestampPacketDependencies, - *this->timestampPacketContainer, eventsRequest, + *this->timestampPacketContainer, csrDeps, getGpgpuCommandStreamReceiver(), *getBcsCommandStreamReceiver()); } } diff --git a/runtime/command_stream/CMakeLists.txt b/runtime/command_stream/CMakeLists.txt index 883d836381..068c4c61eb 100644 --- a/runtime/command_stream/CMakeLists.txt +++ b/runtime/command_stream/CMakeLists.txt @@ -37,8 +37,6 @@ set(RUNTIME_SRCS_COMMAND_STREAM ${CMAKE_CURRENT_SOURCE_DIR}/scratch_space_controller.h ${CMAKE_CURRENT_SOURCE_DIR}/scratch_space_controller_base.cpp ${CMAKE_CURRENT_SOURCE_DIR}/scratch_space_controller_base.h - ${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.h ${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver.h ${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver_hw.h diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.h b/runtime/command_stream/aub_command_stream_receiver_hw.h index 7216f30c59..4bca902834 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.h +++ b/runtime/command_stream/aub_command_stream_receiver_hw.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -53,7 +53,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw::expectMMIO(uint32_t mmioRegister, ui } template -cl_int AUBCommandStreamReceiverHw::expectMemory(const void *gfxAddress, const void *srcAddress, - size_t length, uint32_t compareOperation) { +int32_t AUBCommandStreamReceiverHw::expectMemory(const void *gfxAddress, const void *srcAddress, + size_t length, uint32_t compareOperation) { pollForCompletion(); auto streamLocked = getAubStream()->lockStream(); diff --git a/runtime/command_stream/aub_subcapture.h b/runtime/command_stream/aub_subcapture.h index defbde3035..927887162f 100644 --- a/runtime/command_stream/aub_subcapture.h +++ b/runtime/command_stream/aub_subcapture.h @@ -1,11 +1,13 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once +#include "core/command_stream/aub_subcapture_status.h" + #include #include #include @@ -16,11 +18,6 @@ namespace NEO { struct MultiDispatchInfo; class SettingsReader; -struct AubSubCaptureStatus { - bool isActive; - bool wasActiveInPreviousEnqueue; -}; - class AubSubCaptureCommon { public: enum class SubCaptureMode { diff --git a/runtime/command_stream/command_stream_receiver.cpp b/runtime/command_stream/command_stream_receiver.cpp index b848e77d2e..1aaa24eddf 100644 --- a/runtime/command_stream/command_stream_receiver.cpp +++ b/runtime/command_stream/command_stream_receiver.cpp @@ -21,7 +21,6 @@ #include "runtime/command_stream/experimental_command_buffer.h" #include "runtime/command_stream/scratch_space_controller.h" #include "runtime/device/device.h" -#include "runtime/event/event.h" #include "runtime/gtpin/gtpin_notify.h" #include "runtime/helpers/array_count.h" #include "runtime/helpers/timestamp_packet.h" @@ -442,8 +441,8 @@ TagAllocator *CommandStreamReceiver::getTimestampPacketA return timestampPacketAllocator.get(); } -cl_int CommandStreamReceiver::expectMemory(const void *gfxAddress, const void *srcAddress, - size_t length, uint32_t compareOperation) { +int32_t CommandStreamReceiver::expectMemory(const void *gfxAddress, const void *srcAddress, + size_t length, uint32_t compareOperation) { auto isMemoryEqual = (memcmp(gfxAddress, srcAddress, length) == 0); auto isEqualMemoryExpected = (compareOperation == AubMemDump::CmdServicesMemTraceMemoryCompare::CompareOperationValues::CompareEqual); diff --git a/runtime/command_stream/command_stream_receiver.h b/runtime/command_stream/command_stream_receiver.h index f3b47af50e..76754b1842 100644 --- a/runtime/command_stream/command_stream_receiver.h +++ b/runtime/command_stream/command_stream_receiver.h @@ -6,16 +6,16 @@ */ #pragma once +#include "core/command_stream/aub_subcapture_status.h" #include "core/command_stream/csr_definitions.h" #include "core/command_stream/linear_stream.h" +#include "core/command_stream/submissions_aggregator.h" #include "core/command_stream/thread_arbitration_policy.h" #include "core/helpers/aligned_memory.h" #include "core/helpers/completion_stamp.h" #include "core/helpers/options.h" #include "core/indirect_heap/indirect_heap.h" #include "core/kernel/grf_config.h" -#include "runtime/command_stream/aub_subcapture.h" -#include "runtime/command_stream/submissions_aggregator.h" #include "runtime/helpers/blit_commands_helper.h" #include "runtime/helpers/flat_batch_buffer_helper.h" @@ -25,7 +25,6 @@ namespace NEO { class AllocationsList; class Device; -class EventBuilder; class ExecutionEnvironment; class ExperimentalCommandBuffer; class GmmPageTableMngr; @@ -170,7 +169,7 @@ class CommandStreamReceiver { TagAllocator *getEventPerfCountAllocator(const uint32_t tagSize); TagAllocator *getTimestampPacketAllocator(); - virtual cl_int expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation); + virtual int32_t expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation); virtual bool isMultiOsContextCapable() const = 0; diff --git a/runtime/helpers/blit_commands_helper.cpp b/runtime/helpers/blit_commands_helper.cpp index 268db918f3..9e32bf1c8d 100644 --- a/runtime/helpers/blit_commands_helper.cpp +++ b/runtime/helpers/blit_commands_helper.cpp @@ -182,7 +182,7 @@ BlitterConstants::BlitDirection BlitProperties::obtainBlitDirection(uint32_t com } void BlitProperties::setupDependenciesForAuxTranslation(BlitPropertiesContainer &blitPropertiesContainer, TimestampPacketDependencies ×tampPacketDependencies, - TimestampPacketContainer &kernelTimestamps, const EventsRequest &eventsRequest, + TimestampPacketContainer &kernelTimestamps, const CsrDependencies &depsFromEvents, CommandStreamReceiver &gpguCsr, CommandStreamReceiver &bcsCsr) { auto numObjects = blitPropertiesContainer.size() / 2; @@ -197,8 +197,10 @@ void BlitProperties::setupDependenciesForAuxTranslation(BlitPropertiesContainer // wait for barrier and events before AuxToNonAux blitPropertiesContainer[0].csrDependencies.push_back(×tampPacketDependencies.barrierNodes); - eventsRequest.fillCsrDependencies(blitPropertiesContainer[0].csrDependencies, bcsCsr, - CsrDependencies::DependenciesType::All); + + for (auto dep : depsFromEvents) { + blitPropertiesContainer[0].csrDependencies.push_back(dep); + } // wait for NDR before NonAuxToAux blitPropertiesContainer[numObjects].csrDependencies.push_back(&kernelTimestamps); diff --git a/runtime/helpers/blit_commands_helper.h b/runtime/helpers/blit_commands_helper.h index 421a3b7990..7b8218e229 100644 --- a/runtime/helpers/blit_commands_helper.h +++ b/runtime/helpers/blit_commands_helper.h @@ -7,9 +7,9 @@ #pragma once #include "core/command_stream/csr_deps.h" +#include "core/helpers/aux_translation.h" #include "core/memory_manager/memory_constants.h" #include "core/utilities/stackvec.h" -#include "runtime/helpers/properties_helper.h" #include @@ -48,7 +48,7 @@ struct BlitProperties { GraphicsAllocation *allocation); static void setupDependenciesForAuxTranslation(BlitPropertiesContainer &blitPropertiesContainer, TimestampPacketDependencies ×tampPacketDependencies, - TimestampPacketContainer &kernelTimestamps, const EventsRequest &eventsRequest, + TimestampPacketContainer &kernelTimestamps, const CsrDependencies &depsFromEvents, CommandStreamReceiver &gpguCsr, CommandStreamReceiver &bcsCsr); static BlitterConstants::BlitDirection obtainBlitDirection(uint32_t commandType); diff --git a/runtime/helpers/flat_batch_buffer_helper.h b/runtime/helpers/flat_batch_buffer_helper.h index a08a56b51d..9f7c0ebeec 100644 --- a/runtime/helpers/flat_batch_buffer_helper.h +++ b/runtime/helpers/flat_batch_buffer_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,8 +7,8 @@ #pragma once +#include "core/command_stream/submissions_aggregator.h" #include "core/helpers/address_patch.h" -#include "runtime/command_stream/submissions_aggregator.h" #include #include diff --git a/runtime/helpers/properties_helper.h b/runtime/helpers/properties_helper.h index 577c48397b..148898259d 100644 --- a/runtime/helpers/properties_helper.h +++ b/runtime/helpers/properties_helper.h @@ -35,17 +35,6 @@ using MemObjSizeArray = std::array; using MemObjOffsetArray = std::array; using MemObjsForAuxTranslation = std::unordered_set; -enum class AuxTranslationDirection { - None, - AuxToNonAux, - NonAuxToAux -}; - -enum class AuxTranslationMode : int32_t { - Builtin = 0, - Blit = 1 -}; - struct TransferProperties { TransferProperties() = delete; diff --git a/runtime/helpers/task_information.cpp b/runtime/helpers/task_information.cpp index 4c3189fd23..1219c6e5d4 100644 --- a/runtime/helpers/task_information.cpp +++ b/runtime/helpers/task_information.cpp @@ -196,8 +196,11 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate if (kernelOperation->blitPropertiesContainer.size() > 0) { auto &bcsCsr = *commandQueue.getBcsCommandStreamReceiver(); + CsrDependencies csrDeps; + eventsRequest.fillCsrDependencies(csrDeps, bcsCsr, CsrDependencies::DependenciesType::All); + BlitProperties::setupDependenciesForAuxTranslation(kernelOperation->blitPropertiesContainer, *timestampPacketDependencies, - *currentTimestampPacketNodes, eventsRequest, + *currentTimestampPacketNodes, csrDeps, commandQueue.getGpgpuCommandStreamReceiver(), bcsCsr); auto bcsTaskCount = bcsCsr.blitBuffer(kernelOperation->blitPropertiesContainer, false); diff --git a/runtime/helpers/timestamp_packet.h b/runtime/helpers/timestamp_packet.h index beb15f386c..ceba8c4e20 100644 --- a/runtime/helpers/timestamp_packet.h +++ b/runtime/helpers/timestamp_packet.h @@ -9,6 +9,7 @@ #include "core/command_container/command_encoder.h" #include "core/command_stream/csr_deps.h" +#include "core/helpers/aux_translation.h" #include "core/helpers/non_copyable_or_moveable.h" #include "runtime/helpers/properties_helper.h" #include "runtime/utilities/tag_allocator.h" diff --git a/unit_tests/command_stream/submissions_aggregator_tests.cpp b/unit_tests/command_stream/submissions_aggregator_tests.cpp index 0519b3cb19..0766d3831a 100644 --- a/unit_tests/command_stream/submissions_aggregator_tests.cpp +++ b/unit_tests/command_stream/submissions_aggregator_tests.cpp @@ -5,8 +5,8 @@ * */ +#include "core/command_stream/submissions_aggregator.h" #include "core/helpers/flush_stamp.h" -#include "runtime/command_stream/submissions_aggregator.h" #include "runtime/event/event.h" #include "test.h" #include "unit_tests/mocks/mock_command_queue.h" diff --git a/unit_tests/helpers/unit_test_helper.h b/unit_tests/helpers/unit_test_helper.h index 5d72433148..2324008998 100644 --- a/unit_tests/helpers/unit_test_helper.h +++ b/unit_tests/helpers/unit_test_helper.h @@ -1,12 +1,12 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once - +#include "core/helpers/aux_translation.h" #include "core/helpers/hw_cmds.h" #include "runtime/helpers/properties_helper.h" diff --git a/unit_tests/mocks/mock_submissions_aggregator.h b/unit_tests/mocks/mock_submissions_aggregator.h index fe2e86b61c..7acd8dea91 100644 --- a/unit_tests/mocks/mock_submissions_aggregator.h +++ b/unit_tests/mocks/mock_submissions_aggregator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,7 +7,7 @@ #pragma once -#include "runtime/command_stream/submissions_aggregator.h" +#include "core/command_stream/submissions_aggregator.h" namespace NEO { struct mockSubmissionsAggregator : public SubmissionAggregator {