Implement zeCommandListAppendLaunchCooperativeKernel

Resolves: NEO-4725


Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2021-03-19 23:14:09 +00:00
committed by Compute-Runtime-Automation
parent 3dc3ad36f8
commit 8d55bfe21d
26 changed files with 216 additions and 82 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2020 Intel Corporation
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -16,6 +16,7 @@ set(NEO_CORE_PROGRAM
${CMAKE_CURRENT_SOURCE_DIR}/program_initialization.h
${CMAKE_CURRENT_SOURCE_DIR}/sync_buffer_handler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sync_buffer_handler.h
${CMAKE_CURRENT_SOURCE_DIR}/sync_buffer_handler.inl
)
set_property(GLOBAL PROPERTY NEO_CORE_PROGRAM ${NEO_CORE_PROGRAM})

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,8 +11,6 @@
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "opencl/source/kernel/kernel.h"
namespace NEO {
SyncBufferHandler::~SyncBufferHandler() {
@@ -24,22 +22,6 @@ SyncBufferHandler::SyncBufferHandler(Device &device)
allocateNewBuffer();
}
void SyncBufferHandler::prepareForEnqueue(size_t workGroupsCount, Kernel &kernel) {
auto requiredSize = workGroupsCount;
std::lock_guard<std::mutex> guard(this->mutex);
bool isCurrentBufferFull = (usedBufferSize + requiredSize > bufferSize);
if (isCurrentBufferFull) {
memoryManager.checkGpuUsageAndDestroyGraphicsAllocations(graphicsAllocation);
allocateNewBuffer();
usedBufferSize = 0;
}
kernel.patchSyncBuffer(device, graphicsAllocation, usedBufferSize);
usedBufferSize += requiredSize;
}
void SyncBufferHandler::makeResident(CommandStreamReceiver &csr) {
csr.makeResident(*graphicsAllocation);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -17,8 +17,8 @@ class CommandStreamReceiver;
class Context;
class Device;
class GraphicsAllocation;
class MemoryManager;
class Kernel;
class MemoryManager;
class SyncBufferHandler {
public:
@@ -26,7 +26,8 @@ class SyncBufferHandler {
SyncBufferHandler(Device &device);
void prepareForEnqueue(size_t workGroupsCount, Kernel &kernel);
template <typename KernelT>
void prepareForEnqueue(size_t workGroupsCount, KernelT &kernel);
void makeResident(CommandStreamReceiver &csr);
protected:

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/memory_manager/memory_manager.h"
template <typename KernelT>
void NEO::SyncBufferHandler::prepareForEnqueue(size_t workGroupsCount, KernelT &kernel) {
auto requiredSize = workGroupsCount;
std::lock_guard<std::mutex> guard(this->mutex);
bool isCurrentBufferFull = (usedBufferSize + requiredSize > bufferSize);
if (isCurrentBufferFull) {
memoryManager.checkGpuUsageAndDestroyGraphicsAllocations(graphicsAllocation);
allocateNewBuffer();
usedBufferSize = 0;
}
kernel.patchSyncBuffer(device, graphicsAllocation, usedBufferSize);
usedBufferSize += requiredSize;
}