Refactor creation of buffer surface state 1/n

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2021-10-21 01:30:53 +00:00
committed by Compute-Runtime-Automation
parent 53d77bb801
commit 9d56939980
20 changed files with 236 additions and 97 deletions

View File

@@ -24,7 +24,7 @@ set(RUNTIME_SRCS_MEM_OBJ
${CMAKE_CURRENT_SOURCE_DIR}/mem_obj_helper_common.inl
${CMAKE_CURRENT_SOURCE_DIR}/pipe.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pipe.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}buffer_ext.inl
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}buffer_ext.cpp
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}image_ext.inl
)

View File

@@ -19,10 +19,11 @@
#include <functional>
namespace NEO {
class Device;
class Buffer;
class ClDevice;
class Device;
class MemoryManager;
struct EncodeSurfaceStateArgs;
using BufferCreatFunc = Buffer *(*)(Context *context,
MemoryProperties memoryProperties,
@@ -193,6 +194,8 @@ class Buffer : public MemObj {
static bool isReadOnlyMemoryPermittedByFlags(const MemoryProperties &properties);
void transferData(void *dst, void *src, size_t copySize, size_t copyOffset);
void appendSurfaceStateArgs(EncodeSurfaceStateArgs &args);
};
template <typename GfxFamily>
@@ -214,7 +217,6 @@ class BufferHw : public Buffer {
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation,
bool isReadOnlyArgument, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override;
void appendSurfaceStateExt(void *memory);
static Buffer *create(Context *context,
MemoryProperties memoryProperties,

View File

@@ -19,7 +19,6 @@
#include "opencl/source/helpers/surface_formats.h"
#include "opencl/source/mem_obj/buffer.h"
#include "buffer_ext.inl"
#include "hw_cmds.h"
namespace NEO {
@@ -39,11 +38,21 @@ void BufferHw<GfxFamily>::setArgStateful(void *memory, bool forceNonAuxMode, boo
auto rootDeviceIndex = device.getRootDeviceIndex();
auto graphicsAllocation = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex);
const auto isReadOnly = isValueSet(getFlags(), CL_MEM_READ_ONLY) || isReadOnlyArgument;
EncodeSurfaceState<GfxFamily>::encodeBuffer(memory, getBufferAddress(rootDeviceIndex),
getSurfaceSize(alignSizeForAuxTranslation, rootDeviceIndex),
getMocsValue(disableL3, isReadOnly, rootDeviceIndex),
true, forceNonAuxMode, isReadOnly, device.getNumGenericSubDevices(),
graphicsAllocation, device.getGmmHelper(), useGlobalAtomics, areMultipleSubDevicesInContext);
appendSurfaceStateExt(memory);
NEO::EncodeSurfaceStateArgs args;
args.outMemory = memory;
args.graphicsAddress = getBufferAddress(rootDeviceIndex);
args.size = getSurfaceSize(alignSizeForAuxTranslation, rootDeviceIndex);
args.mocs = getMocsValue(disableL3, isReadOnly, rootDeviceIndex);
args.cpuCoherent = true;
args.forceNonAuxMode = forceNonAuxMode;
args.isReadOnly = isReadOnly;
args.numAvailableDevices = device.getNumGenericSubDevices();
args.allocation = graphicsAllocation;
args.gmmHelper = device.getGmmHelper();
args.useGlobalAtomics = useGlobalAtomics;
args.areMultipleSubDevicesInContext = areMultipleSubDevicesInContext;
appendSurfaceStateArgs(args);
EncodeSurfaceState<GfxFamily>::encodeBuffer(args);
}
} // namespace NEO

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/mem_obj/buffer.h"
#include "encode_surface_state_args.h"
namespace NEO {
void Buffer::appendSurfaceStateArgs(EncodeSurfaceStateArgs &args) {
}
} // namespace NEO

View File

@@ -1,16 +0,0 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/mem_obj/buffer.h"
namespace NEO {
template <typename GfxFamily>
void BufferHw<GfxFamily>::appendSurfaceStateExt(void *memory) {
}
} // namespace NEO