mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-01 12:33:12 +08:00
Implement zeCommandListAppendLaunchCooperativeKernel
Resolves: NEO-4725 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3dc3ad36f8
commit
8d55bfe21d
@@ -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})
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
25
shared/source/program/sync_buffer_handler.inl
Normal file
25
shared/source/program/sync_buffer_handler.inl
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user