mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Move files to core
Change-Id: I78bf6a82df3399a2b79143333989bac81e7a392a Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
395444c5cc
commit
522dedfbd2
@@ -8,14 +8,17 @@
|
||||
#include "runtime/command_queue/command_queue.h"
|
||||
|
||||
#include "core/helpers/aligned_memory.h"
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/helpers/engine_node_helper.h"
|
||||
#include "core/helpers/get_info.h"
|
||||
#include "core/helpers/options.h"
|
||||
#include "core/helpers/ptr_math.h"
|
||||
#include "core/helpers/string.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/memory_manager/internal_allocation_storage.h"
|
||||
#include "core/os_interface/os_context.h"
|
||||
#include "core/utilities/api_intercept.h"
|
||||
#include "core/utilities/tag_allocator.h"
|
||||
#include "runtime/built_ins/builtins_dispatch_builder.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/context/context.h"
|
||||
@@ -24,15 +27,12 @@
|
||||
#include "runtime/event/event_builder.h"
|
||||
#include "runtime/event/user_event.h"
|
||||
#include "runtime/gtpin/gtpin_notify.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/convert_color.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/mipmap.h"
|
||||
#include "runtime/helpers/queue_helpers.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
#include "CL/cl_ext.h"
|
||||
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/helpers/engine_node_helper.h"
|
||||
#include "core/helpers/options.h"
|
||||
#include "core/memory_manager/internal_allocation_storage.h"
|
||||
#include "core/os_interface/os_context.h"
|
||||
#include "core/program/sync_buffer_handler.h"
|
||||
#include "core/utilities/range.h"
|
||||
#include "core/utilities/tag_allocator.h"
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/built_ins/builtins_dispatch_builder.h"
|
||||
#include "runtime/builtin_kernels_simulation/scheduler_simulation.h"
|
||||
@@ -22,7 +24,6 @@
|
||||
#include "runtime/event/event_builder.h"
|
||||
#include "runtime/event/user_event.h"
|
||||
#include "runtime/gtpin/gtpin_notify.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/dispatch_info_builder.h"
|
||||
#include "runtime/helpers/enqueue_properties.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
@@ -33,7 +34,6 @@
|
||||
#include "runtime/memory_manager/surface.h"
|
||||
#include "runtime/program/block_kernel_manager.h"
|
||||
#include "runtime/program/printf_handler.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <new>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -10,8 +10,10 @@
|
||||
#include "core/command_stream/linear_stream.h"
|
||||
#include "core/command_stream/preemption.h"
|
||||
#include "core/helpers/register_offsets.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/helpers/vec.h"
|
||||
#include "core/indirect_heap/indirect_heap.h"
|
||||
#include "core/utilities/tag_allocator.h"
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/command_queue/command_queue.h"
|
||||
#include "runtime/context/context.h"
|
||||
@@ -21,10 +23,8 @@
|
||||
#include "runtime/helpers/dispatch_info.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/task_information.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/kernel/kernel.h"
|
||||
#include "runtime/program/kernel_info.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "core/indirect_heap/indirect_heap.h"
|
||||
#include "core/memory_manager/graphics_allocation.h"
|
||||
#include "core/os_interface/os_context.h"
|
||||
#include "core/utilities/tag_allocator.h"
|
||||
#include "runtime/command_queue/command_queue.h"
|
||||
#include "runtime/command_queue/gpgpu_walker.h"
|
||||
#include "runtime/command_queue/local_id_gen.h"
|
||||
@@ -24,7 +25,6 @@
|
||||
#include "runtime/helpers/queue_helpers.h"
|
||||
#include "runtime/helpers/validators.h"
|
||||
#include "runtime/mem_obj/mem_obj.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/helpers/basic_math.h"
|
||||
#include "core/helpers/debug_helpers.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/dispatch_info.h"
|
||||
#include "runtime/kernel/kernel.h"
|
||||
|
||||
|
||||
@@ -33,10 +33,6 @@ set(RUNTIME_SRCS_COMMAND_STREAM
|
||||
${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}/scratch_space_controller.cpp
|
||||
${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}/tbx_command_stream_receiver.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver_hw.h
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/utilities/spinlock.h"
|
||||
#include "runtime/aub/aub_center.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
||||
#include "runtime/gen_common/aub_mapper.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "runtime/memory_manager/page_table.h"
|
||||
#include "runtime/memory_manager/physical_address_allocator.h"
|
||||
|
||||
@@ -8,26 +8,26 @@
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
|
||||
#include "core/command_stream/preemption.h"
|
||||
#include "core/command_stream/scratch_space_controller.h"
|
||||
#include "core/execution_environment/root_device_environment.h"
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/helpers/cache_policy.h"
|
||||
#include "core/helpers/flush_stamp.h"
|
||||
#include "core/helpers/hw_helper.h"
|
||||
#include "core/helpers/string.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/memory_manager/internal_allocation_storage.h"
|
||||
#include "core/os_interface/os_context.h"
|
||||
#include "core/os_interface/os_interface.h"
|
||||
#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/command_stream/scratch_space_controller.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/gtpin/gtpin_notify.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
#include "runtime/memory_manager/surface.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
namespace NEO {
|
||||
// Global table of CommandStreamReceiver factories for HW and tests
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "core/command_stream/linear_stream.h"
|
||||
#include "core/command_stream/preemption.h"
|
||||
#include "core/command_stream/scratch_space_controller_base.h"
|
||||
#include "core/debug_settings/debug_settings_manager.h"
|
||||
#include "core/execution_environment/root_device_environment.h"
|
||||
#include "core/gmm_helper/page_table_mngr.h"
|
||||
@@ -17,20 +18,19 @@
|
||||
#include "core/helpers/preamble.h"
|
||||
#include "core/helpers/ptr_math.h"
|
||||
#include "core/helpers/state_base_address.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/indirect_heap/indirect_heap.h"
|
||||
#include "core/memory_manager/internal_allocation_storage.h"
|
||||
#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/command_stream/scratch_space_controller_base.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/gtpin/gtpin_notify.h"
|
||||
#include "runtime/helpers/blit_commands_helper.h"
|
||||
#include "runtime/helpers/flat_batch_buffer_helper_hw.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
#include "command_stream_receiver_hw_ext.inl"
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/scratch_space_controller.h"
|
||||
|
||||
#include "core/helpers/hw_helper.h"
|
||||
#include "core/memory_manager/graphics_allocation.h"
|
||||
#include "core/memory_manager/internal_allocation_storage.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
ScratchSpaceController::ScratchSpaceController(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage)
|
||||
: rootDeviceIndex(rootDeviceIndex), executionEnvironment(environment), csrAllocationStorage(allocationStorage) {
|
||||
auto hwInfo = executionEnvironment.getHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(hwInfo);
|
||||
}
|
||||
|
||||
ScratchSpaceController::~ScratchSpaceController() {
|
||||
if (scratchAllocation) {
|
||||
getMemoryManager()->freeGraphicsMemory(scratchAllocation);
|
||||
}
|
||||
if (privateScratchAllocation) {
|
||||
getMemoryManager()->freeGraphicsMemory(privateScratchAllocation);
|
||||
}
|
||||
}
|
||||
|
||||
MemoryManager *ScratchSpaceController::getMemoryManager() const {
|
||||
UNRECOVERABLE_IF(executionEnvironment.memoryManager.get() == nullptr);
|
||||
return executionEnvironment.memoryManager.get();
|
||||
}
|
||||
} // namespace NEO
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/indirect_heap/indirect_heap.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class Device;
|
||||
class ExecutionEnvironment;
|
||||
class GraphicsAllocation;
|
||||
class InternalAllocationStorage;
|
||||
class MemoryManager;
|
||||
struct HardwareInfo;
|
||||
class OsContext;
|
||||
|
||||
namespace ScratchSpaceConstants {
|
||||
constexpr size_t scratchSpaceOffsetFor64Bit = 4096u;
|
||||
}
|
||||
|
||||
class ScratchSpaceController {
|
||||
public:
|
||||
ScratchSpaceController(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
|
||||
virtual ~ScratchSpaceController();
|
||||
|
||||
GraphicsAllocation *getScratchSpaceAllocation() {
|
||||
return scratchAllocation;
|
||||
}
|
||||
GraphicsAllocation *getPrivateScratchSpaceAllocation() {
|
||||
return privateScratchAllocation;
|
||||
}
|
||||
virtual void setRequiredScratchSpace(void *sshBaseAddress,
|
||||
uint32_t requiredPerThreadScratchSize,
|
||||
uint32_t requiredPerThreadPrivateScratchSize,
|
||||
uint32_t currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) = 0;
|
||||
virtual uint64_t calculateNewGSH() = 0;
|
||||
virtual uint64_t getScratchPatchAddress() = 0;
|
||||
|
||||
virtual void reserveHeap(IndirectHeap::Type heapType, IndirectHeap *&indirectHeap) = 0;
|
||||
|
||||
protected:
|
||||
MemoryManager *getMemoryManager() const;
|
||||
|
||||
const uint32_t rootDeviceIndex;
|
||||
ExecutionEnvironment &executionEnvironment;
|
||||
GraphicsAllocation *scratchAllocation = nullptr;
|
||||
GraphicsAllocation *privateScratchAllocation = nullptr;
|
||||
InternalAllocationStorage &csrAllocationStorage;
|
||||
size_t scratchSizeBytes = 0;
|
||||
size_t privateScratchSizeBytes = 0;
|
||||
bool force32BitAllocation = false;
|
||||
uint32_t computeUnitsUsedForScratch = 0;
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/scratch_space_controller_base.h"
|
||||
|
||||
#include "core/helpers/aligned_memory.h"
|
||||
#include "core/helpers/hw_helper.h"
|
||||
#include "core/helpers/preamble.h"
|
||||
#include "core/memory_manager/graphics_allocation.h"
|
||||
#include "core/memory_manager/internal_allocation_storage.h"
|
||||
#include "core/memory_manager/memory_constants.h"
|
||||
#include "core/os_interface/os_context.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
ScratchSpaceControllerBase::ScratchSpaceControllerBase(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage)
|
||||
: ScratchSpaceController(rootDeviceIndex, environment, allocationStorage) {
|
||||
}
|
||||
|
||||
void ScratchSpaceControllerBase::setRequiredScratchSpace(void *sshBaseAddress,
|
||||
uint32_t requiredPerThreadScratchSize,
|
||||
uint32_t requiredPerThreadPrivateScratchSize,
|
||||
uint32_t currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) {
|
||||
size_t requiredScratchSizeInBytes = requiredPerThreadScratchSize * computeUnitsUsedForScratch;
|
||||
if (requiredScratchSizeInBytes && (!scratchAllocation || scratchSizeBytes < requiredScratchSizeInBytes)) {
|
||||
if (scratchAllocation) {
|
||||
scratchAllocation->updateTaskCount(currentTaskCount, osContext.getContextId());
|
||||
csrAllocationStorage.storeAllocation(std::unique_ptr<GraphicsAllocation>(scratchAllocation), TEMPORARY_ALLOCATION);
|
||||
}
|
||||
scratchSizeBytes = requiredScratchSizeInBytes;
|
||||
createScratchSpaceAllocation();
|
||||
vfeStateDirty = true;
|
||||
force32BitAllocation = getMemoryManager()->peekForce32BitAllocations();
|
||||
if (is64bit && !force32BitAllocation) {
|
||||
stateBaseAddressDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScratchSpaceControllerBase::createScratchSpaceAllocation() {
|
||||
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, scratchSizeBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE});
|
||||
UNRECOVERABLE_IF(scratchAllocation == nullptr);
|
||||
}
|
||||
|
||||
uint64_t ScratchSpaceControllerBase::calculateNewGSH() {
|
||||
uint64_t gsh = 0;
|
||||
if (scratchAllocation) {
|
||||
gsh = scratchAllocation->getGpuAddress() - ScratchSpaceConstants::scratchSpaceOffsetFor64Bit;
|
||||
}
|
||||
return gsh;
|
||||
}
|
||||
uint64_t ScratchSpaceControllerBase::getScratchPatchAddress() {
|
||||
//for 32 bit scratch space pointer is being programmed in Media VFE State and is relative to 0 as General State Base Address
|
||||
//for 64 bit, scratch space pointer is being programmed as "General State Base Address - scratchSpaceOffsetFor64bit"
|
||||
// and "0 + scratchSpaceOffsetFor64bit" is being programmed in Media VFE state
|
||||
uint64_t scratchAddress = 0;
|
||||
if (scratchAllocation) {
|
||||
scratchAddress = scratchAllocation->getGpuAddressToPatch();
|
||||
if (is64bit && !getMemoryManager()->peekForce32BitAllocations()) {
|
||||
//this is to avoid scractch allocation offset "0"
|
||||
scratchAddress = ScratchSpaceConstants::scratchSpaceOffsetFor64Bit;
|
||||
}
|
||||
}
|
||||
return scratchAddress;
|
||||
}
|
||||
|
||||
void ScratchSpaceControllerBase::reserveHeap(IndirectHeap::Type heapType, IndirectHeap *&indirectHeap) {
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/command_stream/scratch_space_controller.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class ScratchSpaceControllerBase : public ScratchSpaceController {
|
||||
public:
|
||||
ScratchSpaceControllerBase(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
|
||||
|
||||
void setRequiredScratchSpace(void *sshBaseAddress,
|
||||
uint32_t requiredPerThreadScratchSize,
|
||||
uint32_t requiredPerThreadPrivateScratchSize,
|
||||
uint32_t currentTaskCount,
|
||||
OsContext &osContext,
|
||||
bool &stateBaseAddressDirty,
|
||||
bool &vfeStateDirty) override;
|
||||
uint64_t calculateNewGSH() override;
|
||||
uint64_t getScratchPatchAddress() override;
|
||||
|
||||
void reserveHeap(IndirectHeap::Type heapType, IndirectHeap *&indirectHeap) override;
|
||||
|
||||
protected:
|
||||
void createScratchSpaceAllocation();
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -9,11 +9,11 @@
|
||||
#include "core/helpers/hw_helper.h"
|
||||
#include "core/helpers/preamble.h"
|
||||
#include "core/helpers/string.h"
|
||||
#include "core/utilities/tag_allocator.h"
|
||||
#include "runtime/command_queue/gpgpu_walker.h"
|
||||
#include "runtime/device_queue/device_queue_hw.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
namespace NEO {
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/helpers/hw_cmds.h"
|
||||
#include "core/helpers/options.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
|
||||
namespace NEO {
|
||||
// AUB file folder location
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
#include "runtime/event/async_events_handler.h"
|
||||
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/os_interface/os_thread.h"
|
||||
#include "runtime/event/event.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
|
||||
#include "core/helpers/aligned_memory.h"
|
||||
#include "core/helpers/get_info.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/memory_manager/internal_allocation_storage.h"
|
||||
#include "core/utilities/range.h"
|
||||
#include "core/utilities/stackvec.h"
|
||||
#include "core/utilities/tag_allocator.h"
|
||||
#include "public/cl_ext_private.h"
|
||||
#include "runtime/api/cl_types.h"
|
||||
#include "runtime/command_queue/command_queue.h"
|
||||
@@ -21,10 +23,8 @@
|
||||
#include "runtime/event/async_events_handler.h"
|
||||
#include "runtime/event/event_tracker.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/mem_obj/mem_obj.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
#define OCLRT_NUM_TIMESTAMP_BITS (32)
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include "runtime/event/event_builder.h"
|
||||
|
||||
#include "core/helpers/debug_helpers.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "runtime/api/cl_types.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/event/user_event.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
|
||||
namespace NEO {
|
||||
EventBuilder::~EventBuilder() {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw_bdw_plus.inl"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
*/
|
||||
|
||||
#include "core/gen11/hw_cmds.h"
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.inl"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/memory_manager/memory_pool.h"
|
||||
#include "runtime/aub_mem_dump/aub_alloc_dump.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw_bdw_plus.inl"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/gen12lp/hw_cmds.h"
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/memory_manager/memory_pool.h"
|
||||
#include "runtime/aub_mem_dump/aub_mem_dump.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.inl"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw_bdw_plus.inl"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/gen8/hw_cmds.h"
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.inl"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw_bdw_plus.inl"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/gen9/hw_cmds.h"
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/tbx_command_stream_receiver_hw.inl"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
set(RUNTIME_SRCS_HELPERS_BASE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/array_count.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/base_object.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/base_object.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/blit_commands_helper_base.inl
|
||||
@@ -51,8 +50,6 @@ set(RUNTIME_SRCS_HELPERS_BASE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/string_helpers.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/surface_formats.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/surface_formats.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/timestamp_packet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/timestamp_packet.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/task_information.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/task_information.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/task_information.inl
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
template <typename T, size_t N>
|
||||
constexpr size_t arrayCount(const T (&)[N]) {
|
||||
return N;
|
||||
}
|
||||
|
||||
template <typename T, size_t N>
|
||||
constexpr bool isInRange(size_t idx, const T (&)[N]) {
|
||||
return (idx < N);
|
||||
}
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
#include "runtime/helpers/blit_commands_helper.h"
|
||||
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "runtime/built_ins/builtins_dispatch_builder.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/memory_manager/surface.h"
|
||||
|
||||
#include "CL/cl.h"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/helpers/hw_cmds.h"
|
||||
#include "core/helpers/options.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
#include "runtime/helpers/properties_helper.h"
|
||||
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "runtime/command_queue/command_queue.h"
|
||||
#include "runtime/helpers/mipmap.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
#include "runtime/mem_obj/mem_obj.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "surface_formats.h"
|
||||
|
||||
#include "core/gmm_helper/gmm_lib.h"
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "runtime/api/cl_types.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
|
||||
#include "validators.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,11 +9,11 @@
|
||||
#include "core/command_stream/linear_stream.h"
|
||||
#include "core/helpers/completion_stamp.h"
|
||||
#include "core/helpers/hw_info.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/indirect_heap/indirect_heap.h"
|
||||
#include "core/utilities/iflist.h"
|
||||
#include "runtime/helpers/blit_commands_helper.h"
|
||||
#include "runtime/helpers/properties_helper.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
|
||||
#include "core/command_stream/linear_stream.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
void TimestampPacketContainer::add(Node *timestampPacketNode) {
|
||||
timestampPacketNodes.push_back(timestampPacketNode);
|
||||
}
|
||||
|
||||
TimestampPacketContainer::~TimestampPacketContainer() {
|
||||
for (auto node : timestampPacketNodes) {
|
||||
node->returnTag();
|
||||
}
|
||||
}
|
||||
|
||||
void TimestampPacketContainer::swapNodes(TimestampPacketContainer ×tampPacketContainer) {
|
||||
timestampPacketNodes.swap(timestampPacketContainer.timestampPacketNodes);
|
||||
}
|
||||
|
||||
void TimestampPacketContainer::resolveDependencies(bool clearAllDependencies) {
|
||||
std::vector<Node *> pendingNodes;
|
||||
|
||||
for (auto node : timestampPacketNodes) {
|
||||
if (node->canBeReleased() || clearAllDependencies) {
|
||||
node->returnTag();
|
||||
} else {
|
||||
pendingNodes.push_back(node);
|
||||
}
|
||||
}
|
||||
|
||||
std::swap(timestampPacketNodes, pendingNodes);
|
||||
}
|
||||
|
||||
void TimestampPacketContainer::assignAndIncrementNodesRefCounts(const TimestampPacketContainer &inputTimestampPacketContainer) {
|
||||
auto &inputNodes = inputTimestampPacketContainer.peekNodes();
|
||||
std::copy(inputNodes.begin(), inputNodes.end(), std::back_inserter(timestampPacketNodes));
|
||||
|
||||
for (auto node : inputNodes) {
|
||||
node->incRefCount();
|
||||
}
|
||||
}
|
||||
|
||||
void TimestampPacketContainer::makeResident(CommandStreamReceiver &commandStreamReceiver) {
|
||||
for (auto node : timestampPacketNodes) {
|
||||
commandStreamReceiver.makeResident(*node->getBaseGraphicsAllocation());
|
||||
}
|
||||
}
|
||||
|
||||
bool TimestampPacketContainer::isCompleted() const {
|
||||
for (auto node : timestampPacketNodes) {
|
||||
if (!node->tagForCpuAccess->isCompleted()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#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"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class CommandStreamReceiver;
|
||||
class LinearStream;
|
||||
|
||||
namespace TimestampPacketSizeControl {
|
||||
constexpr uint32_t preferredPacketCount = 16u;
|
||||
}
|
||||
|
||||
#pragma pack(1)
|
||||
struct TimestampPacketStorage {
|
||||
struct Packet {
|
||||
uint32_t contextStart = 1u;
|
||||
uint32_t globalStart = 1u;
|
||||
uint32_t contextEnd = 1u;
|
||||
uint32_t globalEnd = 1u;
|
||||
};
|
||||
|
||||
enum class WriteOperationType : uint32_t {
|
||||
BeforeWalker,
|
||||
AfterWalker
|
||||
};
|
||||
|
||||
static GraphicsAllocation::AllocationType getAllocationType() {
|
||||
return GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER;
|
||||
}
|
||||
|
||||
bool isCompleted() const {
|
||||
for (uint32_t i = 0; i < packetsUsed; i++) {
|
||||
if ((packets[i].contextEnd & 1) || (packets[i].globalEnd & 1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return implicitDependenciesCount.load() == 0;
|
||||
}
|
||||
|
||||
void initialize() {
|
||||
for (auto &packet : packets) {
|
||||
packet.contextStart = 1u;
|
||||
packet.globalStart = 1u;
|
||||
packet.contextEnd = 1u;
|
||||
packet.globalEnd = 1u;
|
||||
}
|
||||
implicitDependenciesCount.store(0);
|
||||
packetsUsed = 1;
|
||||
}
|
||||
|
||||
void incImplicitDependenciesCount() { implicitDependenciesCount++; }
|
||||
|
||||
Packet packets[TimestampPacketSizeControl::preferredPacketCount];
|
||||
std::atomic<uint32_t> implicitDependenciesCount{0u};
|
||||
uint32_t packetsUsed = 1;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
static_assert(((4 * TimestampPacketSizeControl::preferredPacketCount + 2) * sizeof(uint32_t)) == sizeof(TimestampPacketStorage),
|
||||
"This structure is consumed by GPU and has to follow specific restrictions for padding and size");
|
||||
|
||||
class TimestampPacketContainer : public NonCopyableClass {
|
||||
public:
|
||||
using Node = TagNode<TimestampPacketStorage>;
|
||||
TimestampPacketContainer() = default;
|
||||
TimestampPacketContainer(TimestampPacketContainer &&) = default;
|
||||
TimestampPacketContainer &operator=(TimestampPacketContainer &&) = default;
|
||||
MOCKABLE_VIRTUAL ~TimestampPacketContainer();
|
||||
|
||||
const std::vector<Node *> &peekNodes() const { return timestampPacketNodes; }
|
||||
void add(Node *timestampPacketNode);
|
||||
void swapNodes(TimestampPacketContainer ×tampPacketContainer);
|
||||
void assignAndIncrementNodesRefCounts(const TimestampPacketContainer &inputTimestampPacketContainer);
|
||||
void resolveDependencies(bool clearAllDependencies);
|
||||
void makeResident(CommandStreamReceiver &commandStreamReceiver);
|
||||
bool isCompleted() const;
|
||||
|
||||
protected:
|
||||
std::vector<Node *> timestampPacketNodes;
|
||||
};
|
||||
|
||||
struct TimestampPacketDependencies : public NonCopyableClass {
|
||||
TimestampPacketContainer previousEnqueueNodes;
|
||||
TimestampPacketContainer barrierNodes;
|
||||
TimestampPacketContainer auxToNonAuxNodes;
|
||||
TimestampPacketContainer nonAuxToAuxNodes;
|
||||
};
|
||||
|
||||
struct TimestampPacketHelper {
|
||||
template <typename GfxFamily>
|
||||
static void programSemaphoreWithImplicitDependency(LinearStream &cmdStream, TagNode<TimestampPacketStorage> ×tampPacketNode) {
|
||||
using MI_ATOMIC = typename GfxFamily::MI_ATOMIC;
|
||||
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
|
||||
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
|
||||
|
||||
auto compareAddress = timestampPacketNode.getGpuAddress() + offsetof(TimestampPacketStorage, packets[0].contextEnd);
|
||||
auto dependenciesCountAddress = timestampPacketNode.getGpuAddress() + offsetof(TimestampPacketStorage, implicitDependenciesCount);
|
||||
|
||||
for (uint32_t packetId = 0; packetId < timestampPacketNode.tagForCpuAccess->packetsUsed; packetId++) {
|
||||
uint64_t compareOffset = packetId * sizeof(TimestampPacketStorage::Packet);
|
||||
auto miSemaphoreCmd = cmdStream.getSpaceForCmd<MI_SEMAPHORE_WAIT>();
|
||||
EncodeSempahore<GfxFamily>::programMiSemaphoreWait(miSemaphoreCmd, compareAddress + compareOffset, 1, COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD);
|
||||
}
|
||||
|
||||
timestampPacketNode.tagForCpuAccess->incImplicitDependenciesCount();
|
||||
|
||||
auto miAtomic = cmdStream.getSpaceForCmd<MI_ATOMIC>();
|
||||
EncodeAtomic<GfxFamily>::programMiAtomic(miAtomic, dependenciesCountAddress,
|
||||
MI_ATOMIC::ATOMIC_OPCODES::ATOMIC_4B_DECREMENT,
|
||||
MI_ATOMIC::DATA_SIZE::DATA_SIZE_DWORD);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
static void programCsrDependencies(LinearStream &cmdStream, const CsrDependencies &csrDependencies) {
|
||||
for (auto timestampPacketContainer : csrDependencies) {
|
||||
for (auto &node : timestampPacketContainer->peekNodes()) {
|
||||
TimestampPacketHelper::programSemaphoreWithImplicitDependency<GfxFamily>(cmdStream, *node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily, AuxTranslationDirection auxTranslationDirection>
|
||||
static void programSemaphoreWithImplicitDependencyForAuxTranslation(LinearStream &cmdStream,
|
||||
const TimestampPacketDependencies *timestampPacketDependencies) {
|
||||
auto &container = (auxTranslationDirection == AuxTranslationDirection::AuxToNonAux)
|
||||
? timestampPacketDependencies->auxToNonAuxNodes
|
||||
: timestampPacketDependencies->nonAuxToAuxNodes;
|
||||
|
||||
for (auto &node : container.peekNodes()) {
|
||||
TimestampPacketHelper::programSemaphoreWithImplicitDependency<GfxFamily>(cmdStream, *node);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
static size_t getRequiredCmdStreamSizeForAuxTranslationNodeDependency(const MemObjsForAuxTranslation *memObjsForAuxTranslation) {
|
||||
return memObjsForAuxTranslation->size() * TimestampPacketHelper::getRequiredCmdStreamSizeForNodeDependencyWithBlitEnqueue<GfxFamily>();
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
static size_t getRequiredCmdStreamSizeForNodeDependencyWithBlitEnqueue() {
|
||||
return sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT) + sizeof(typename GfxFamily::MI_ATOMIC);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
static size_t getRequiredCmdStreamSizeForNodeDependency(TagNode<TimestampPacketStorage> ×tampPacketNode) {
|
||||
size_t totalMiSemaphoreWaitSize = timestampPacketNode.tagForCpuAccess->packetsUsed * sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT);
|
||||
|
||||
return totalMiSemaphoreWaitSize + sizeof(typename GfxFamily::MI_ATOMIC);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
static size_t getRequiredCmdStreamSize(const CsrDependencies &csrDependencies) {
|
||||
size_t totalCommandsSize = 0;
|
||||
for (auto timestampPacketContainer : csrDependencies) {
|
||||
for (auto &node : timestampPacketContainer->peekNodes()) {
|
||||
totalCommandsSize += getRequiredCmdStreamSizeForNodeDependency<GfxFamily>(*node);
|
||||
}
|
||||
}
|
||||
|
||||
return totalCommandsSize;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "core/helpers/hw_info.h"
|
||||
#include "core/helpers/ptr_math.h"
|
||||
#include "core/helpers/string.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/memory_manager/host_ptr_manager.h"
|
||||
#include "core/memory_manager/unified_memory_manager.h"
|
||||
#include "runtime/command_queue/command_queue.h"
|
||||
@@ -22,7 +23,6 @@
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/helpers/validators.h"
|
||||
#include "runtime/mem_obj/mem_obj_helper.h"
|
||||
#include "runtime/memory_manager/memory_manager.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 @@
|
||||
|
||||
#include "runtime/os_interface/performance_counters.h"
|
||||
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
#include "core/utilities/tag_allocator.h"
|
||||
|
||||
using namespace MetricsLibraryApi;
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/helpers/array_count.h"
|
||||
#include "core/helpers/debug_helpers.h"
|
||||
#include "runtime/api/dispatch.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/sharings/sharing.h"
|
||||
|
||||
#include "DXGI1_2.h"
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/os_interface/os_interface.h"
|
||||
#include "core/os_interface/windows/gdi_interface.h"
|
||||
#include "public/cl_gl_private_intel.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/os_interface/windows/os_context_win.h"
|
||||
#include "runtime/os_interface/windows/os_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "core/os_interface/windows/windows_wrapper.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/helpers/windows/gl_helper.h"
|
||||
#include "runtime/sharings/gl/gl_arb_sync_event.h"
|
||||
#include "runtime/sharings/gl/windows/gl_sharing_windows.h"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "runtime/sharings/gl/gl_sharing.h"
|
||||
|
||||
#include "core/helpers/string.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "runtime/context/context.inl"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/sharings/gl/gl_context_guard.h"
|
||||
#include "runtime/sharings/sharing_factory.h"
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
*/
|
||||
|
||||
#include "core/helpers/get_info.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "public/cl_gl_private_intel.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/event/async_events_handler.h"
|
||||
#include "runtime/event/event_builder.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "runtime/sharings/gl/gl_context_guard.h"
|
||||
#include "runtime/sharings/gl/gl_sync_event.h"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "runtime/sharings/unified/unified_sharing.h"
|
||||
|
||||
#include "core/helpers/string.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/sharings/sharing_factory.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -8,7 +8,6 @@ set(RUNTIME_SRCS_UTILITIES_BASE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/logger.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/logger.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tag_allocator.h
|
||||
)
|
||||
|
||||
set_property(GLOBAL PROPERTY RUNTIME_SRCS_UTILITIES_BASE ${RUNTIME_SRCS_UTILITIES_BASE})
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "runtime/utilities/logger.h"
|
||||
|
||||
#include "core/debug_settings/debug_settings_manager.h"
|
||||
#include "core/helpers/timestamp_packet.h"
|
||||
#include "runtime/event/event.h"
|
||||
#include "runtime/helpers/dispatch_info.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/kernel/kernel.h"
|
||||
#include "runtime/mem_obj/mem_obj.h"
|
||||
|
||||
|
||||
@@ -1,196 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/helpers/aligned_memory.h"
|
||||
#include "core/helpers/debug_helpers.h"
|
||||
#include "core/utilities/idlist.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class GraphicsAllocation;
|
||||
|
||||
template <typename TagType>
|
||||
class TagAllocator;
|
||||
|
||||
template <typename TagType>
|
||||
struct TagNode : public IDNode<TagNode<TagType>> {
|
||||
public:
|
||||
TagType *tagForCpuAccess;
|
||||
|
||||
GraphicsAllocation *getBaseGraphicsAllocation() const { return gfxAllocation; }
|
||||
uint64_t getGpuAddress() const { return gpuAddress; }
|
||||
|
||||
void incRefCount() { refCount++; }
|
||||
|
||||
MOCKABLE_VIRTUAL void returnTag() {
|
||||
allocator->returnTag(this);
|
||||
}
|
||||
|
||||
bool canBeReleased() const {
|
||||
return !doNotReleaseNodes && tagForCpuAccess->isCompleted();
|
||||
}
|
||||
|
||||
void setDoNotReleaseNodes(bool doNotRelease) {
|
||||
doNotReleaseNodes = doNotRelease;
|
||||
}
|
||||
|
||||
protected:
|
||||
TagAllocator<TagType> *allocator = nullptr;
|
||||
GraphicsAllocation *gfxAllocation = nullptr;
|
||||
uint64_t gpuAddress = 0;
|
||||
std::atomic<uint32_t> refCount{0};
|
||||
bool doNotReleaseNodes = false;
|
||||
|
||||
template <typename TagType2>
|
||||
friend class TagAllocator;
|
||||
};
|
||||
|
||||
template <typename TagType>
|
||||
class TagAllocator {
|
||||
public:
|
||||
using NodeType = TagNode<TagType>;
|
||||
|
||||
TagAllocator(uint32_t rootDeviceIndex, MemoryManager *memMngr, size_t tagCount,
|
||||
size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes) : rootDeviceIndex(rootDeviceIndex),
|
||||
memoryManager(memMngr),
|
||||
tagCount(tagCount),
|
||||
tagAlignment(tagAlignment),
|
||||
doNotReleaseNodes(doNotReleaseNodes) {
|
||||
|
||||
this->tagSize = alignUp(tagSize, tagAlignment);
|
||||
populateFreeTags();
|
||||
}
|
||||
|
||||
MOCKABLE_VIRTUAL ~TagAllocator() {
|
||||
cleanUpResources();
|
||||
}
|
||||
|
||||
void cleanUpResources() {
|
||||
for (auto gfxAllocation : gfxAllocations) {
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
gfxAllocations.clear();
|
||||
|
||||
for (auto nodesMemory : tagPoolMemory) {
|
||||
delete[] nodesMemory;
|
||||
}
|
||||
tagPoolMemory.clear();
|
||||
}
|
||||
|
||||
NodeType *getTag() {
|
||||
if (freeTags.peekIsEmpty()) {
|
||||
releaseDeferredTags();
|
||||
}
|
||||
NodeType *node = freeTags.removeFrontOne().release();
|
||||
if (!node) {
|
||||
std::unique_lock<std::mutex> lock(allocatorMutex);
|
||||
populateFreeTags();
|
||||
node = freeTags.removeFrontOne().release();
|
||||
}
|
||||
usedTags.pushFrontOne(*node);
|
||||
node->incRefCount();
|
||||
node->tagForCpuAccess->initialize();
|
||||
return node;
|
||||
}
|
||||
|
||||
MOCKABLE_VIRTUAL void returnTag(NodeType *node) {
|
||||
if (node->refCount.fetch_sub(1) == 1) {
|
||||
if (node->canBeReleased()) {
|
||||
returnTagToFreePool(node);
|
||||
} else {
|
||||
returnTagToDeferredPool(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
IDList<NodeType> freeTags;
|
||||
IDList<NodeType> usedTags;
|
||||
IDList<NodeType> deferredTags;
|
||||
std::vector<GraphicsAllocation *> gfxAllocations;
|
||||
std::vector<NodeType *> tagPoolMemory;
|
||||
|
||||
const uint32_t rootDeviceIndex;
|
||||
MemoryManager *memoryManager;
|
||||
size_t tagCount;
|
||||
size_t tagAlignment;
|
||||
size_t tagSize;
|
||||
bool doNotReleaseNodes = false;
|
||||
|
||||
std::mutex allocatorMutex;
|
||||
|
||||
MOCKABLE_VIRTUAL void returnTagToFreePool(NodeType *node) {
|
||||
NodeType *usedNode = usedTags.removeOne(*node).release();
|
||||
DEBUG_BREAK_IF(usedNode == nullptr);
|
||||
UNUSED_VARIABLE(usedNode);
|
||||
freeTags.pushFrontOne(*node);
|
||||
}
|
||||
|
||||
void returnTagToDeferredPool(NodeType *node) {
|
||||
NodeType *usedNode = usedTags.removeOne(*node).release();
|
||||
DEBUG_BREAK_IF(!usedNode);
|
||||
deferredTags.pushFrontOne(*usedNode);
|
||||
}
|
||||
|
||||
void populateFreeTags() {
|
||||
size_t allocationSizeRequired = tagCount * tagSize;
|
||||
|
||||
auto allocationType = TagType::getAllocationType();
|
||||
GraphicsAllocation *graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, allocationSizeRequired, allocationType});
|
||||
gfxAllocations.push_back(graphicsAllocation);
|
||||
|
||||
uint64_t gpuBaseAddress = graphicsAllocation->getGpuAddress();
|
||||
uintptr_t Size = graphicsAllocation->getUnderlyingBufferSize();
|
||||
uintptr_t Start = reinterpret_cast<uintptr_t>(graphicsAllocation->getUnderlyingBuffer());
|
||||
uintptr_t End = Start + Size;
|
||||
|
||||
NodeType *nodesMemory = new NodeType[tagCount];
|
||||
|
||||
for (size_t i = 0; i < tagCount; ++i) {
|
||||
nodesMemory[i].allocator = this;
|
||||
nodesMemory[i].gfxAllocation = graphicsAllocation;
|
||||
nodesMemory[i].tagForCpuAccess = reinterpret_cast<TagType *>(Start);
|
||||
nodesMemory[i].gpuAddress = gpuBaseAddress + (i * tagSize);
|
||||
nodesMemory[i].setDoNotReleaseNodes(doNotReleaseNodes);
|
||||
freeTags.pushTailOne(nodesMemory[i]);
|
||||
Start += tagSize;
|
||||
}
|
||||
DEBUG_BREAK_IF(Start > End);
|
||||
UNUSED_VARIABLE(End);
|
||||
tagPoolMemory.push_back(nodesMemory);
|
||||
}
|
||||
|
||||
void releaseDeferredTags() {
|
||||
IDList<NodeType, false> pendingFreeTags;
|
||||
IDList<NodeType, false> pendingDeferredTags;
|
||||
auto currentNode = deferredTags.detachNodes();
|
||||
|
||||
while (currentNode != nullptr) {
|
||||
auto nextNode = currentNode->next;
|
||||
if (currentNode->canBeReleased()) {
|
||||
pendingFreeTags.pushFrontOne(*currentNode);
|
||||
} else {
|
||||
pendingDeferredTags.pushFrontOne(*currentNode);
|
||||
}
|
||||
currentNode = nextNode;
|
||||
}
|
||||
|
||||
if (!pendingFreeTags.peekIsEmpty()) {
|
||||
freeTags.splice(*pendingFreeTags.detachNodes());
|
||||
}
|
||||
if (!pendingDeferredTags.peekIsEmpty()) {
|
||||
deferredTags.splice(*pendingDeferredTags.detachNodes());
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user