mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 05:24:02 +08:00
Prepare for pool buffer enabling 1/n
check if flags allow buffer from pool add buffer offset to aubtests disable pool buffer where required Related-To: NEO-7332 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2ceada6bef
commit
70dbce12d1
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 Intel Corporation
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -12,6 +12,7 @@ set(RUNTIME_SRCS_CONTEXT
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/context_type.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_diagnostics.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_diagnostics.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}pool_buffer_additional_checks.cpp
|
||||
)
|
||||
|
||||
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_CONTEXT})
|
||||
|
||||
@@ -502,6 +502,7 @@ Buffer *Context::BufferPoolAllocator::allocateBufferFromPool(const MemoryPropert
|
||||
errcodeRet = CL_MEM_OBJECT_ALLOCATION_FAILURE;
|
||||
if (this->isAggregatedSmallBuffersEnabled() &&
|
||||
this->isSizeWithinThreshold(size) &&
|
||||
this->flagsAllowBufferFromPool(flags, flagsIntel) &&
|
||||
this->mainStorage) {
|
||||
auto lock = std::unique_lock<std::mutex>(this->mutex);
|
||||
cl_buffer_region bufferRegion{};
|
||||
|
||||
@@ -71,6 +71,8 @@ class Context : public BaseObject<_cl_context> {
|
||||
|
||||
bool isPoolBuffer(const MemObj *buffer) const;
|
||||
|
||||
bool flagsAllowBufferFromPool(const cl_mem_flags &flags, const cl_mem_flags_intel &flagsIntel) const;
|
||||
|
||||
protected:
|
||||
inline bool isSizeWithinThreshold(size_t size) const {
|
||||
return BufferPoolAllocator::smallBufferThreshold >= size;
|
||||
|
||||
15
opencl/source/context/pool_buffer_additional_checks.cpp
Normal file
15
opencl/source/context/pool_buffer_additional_checks.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/source/context/context.h"
|
||||
|
||||
namespace NEO {
|
||||
bool Context::BufferPoolAllocator::flagsAllowBufferFromPool(const cl_mem_flags &flags, const cl_mem_flags_intel &flagsIntel) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user