Add ClHwHelper

Related-To: NEO-3964

Change-Id: Ib2660e8f7d92fc970172517b3e2ddfd607e09ec1
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2020-10-21 15:10:25 +02:00
committed by sys_ocldev
parent b8858ee0d6
commit 0738ad5a82
19 changed files with 241 additions and 48 deletions

View File

@@ -17,6 +17,7 @@ set(RUNTIME_SRCS_GENX_CPP_BASE
aub_command_stream_receiver
aub_mem_dump
buffer
cl_hw_helper
command_queue
command_stream_receiver_simulated_common_hw
experimental_command_buffer

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/populate_factory.h"
#include "opencl/source/helpers/cl_hw_helper_base.inl"
#include "hw_cmds.h"
namespace NEO {
using Family = ICLFamily;
static auto gfxCore = IGFX_GEN11_CORE;
template <>
void populateFactoryTable<ClHwHelperHw<Family>>() {
extern ClHwHelper *clHwHelperFactory[IGFX_MAX_CORE];
clHwHelperFactory[gfxCore] = &ClHwHelperHw<Family>::get();
}
template class ClHwHelperHw<Family>;
} // namespace NEO

View File

@@ -12,6 +12,7 @@
#include "opencl/source/command_stream/aub_command_stream_receiver_hw.h"
#include "opencl/source/command_stream/tbx_command_stream_receiver_hw.h"
#include "opencl/source/device_queue/device_queue_hw.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/source/mem_obj/buffer.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/source/sampler/sampler.h"
@@ -23,13 +24,14 @@ typedef ICLFamily Family;
struct EnableOCLGen11 {
EnableOCLGen11() {
populateFactoryTable<AUBCommandStreamReceiverHw<Family>>();
populateFactoryTable<TbxCommandStreamReceiverHw<Family>>();
populateFactoryTable<CommandQueueHw<Family>>();
populateFactoryTable<DeviceQueueHw<Family>>();
populateFactoryTable<CommandStreamReceiverHw<Family>>();
populateFactoryTable<BufferHw<Family>>();
populateFactoryTable<ClHwHelperHw<Family>>();
populateFactoryTable<CommandQueueHw<Family>>();
populateFactoryTable<CommandStreamReceiverHw<Family>>();
populateFactoryTable<DeviceQueueHw<Family>>();
populateFactoryTable<ImageHw<Family>>();
populateFactoryTable<SamplerHw<Family>>();
populateFactoryTable<TbxCommandStreamReceiverHw<Family>>();
}
};

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/populate_factory.h"
#include "opencl/source/helpers/cl_hw_helper_base.inl"
#include "hw_cmds.h"
namespace NEO {
using Family = TGLLPFamily;
static auto gfxCore = IGFX_GEN12LP_CORE;
template <>
void populateFactoryTable<ClHwHelperHw<Family>>() {
extern ClHwHelper *clHwHelperFactory[IGFX_MAX_CORE];
clHwHelperFactory[gfxCore] = &ClHwHelperHw<Family>::get();
}
template class ClHwHelperHw<Family>;
} // namespace NEO

View File

@@ -12,6 +12,7 @@
#include "opencl/source/command_stream/aub_command_stream_receiver_hw.h"
#include "opencl/source/command_stream/tbx_command_stream_receiver_hw.h"
#include "opencl/source/device_queue/device_queue_hw.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/source/mem_obj/buffer.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/source/sampler/sampler.h"
@@ -23,13 +24,14 @@ typedef TGLLPFamily Family;
struct EnableOCLGen12LP {
EnableOCLGen12LP() {
populateFactoryTable<AUBCommandStreamReceiverHw<Family>>();
populateFactoryTable<TbxCommandStreamReceiverHw<Family>>();
populateFactoryTable<CommandQueueHw<Family>>();
populateFactoryTable<DeviceQueueHw<Family>>();
populateFactoryTable<CommandStreamReceiverHw<Family>>();
populateFactoryTable<BufferHw<Family>>();
populateFactoryTable<ClHwHelperHw<Family>>();
populateFactoryTable<CommandQueueHw<Family>>();
populateFactoryTable<CommandStreamReceiverHw<Family>>();
populateFactoryTable<DeviceQueueHw<Family>>();
populateFactoryTable<ImageHw<Family>>();
populateFactoryTable<SamplerHw<Family>>();
populateFactoryTable<TbxCommandStreamReceiverHw<Family>>();
}
};

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/populate_factory.h"
#include "opencl/source/helpers/cl_hw_helper_base.inl"
#include "hw_cmds.h"
namespace NEO {
using Family = BDWFamily;
static auto gfxCore = IGFX_GEN8_CORE;
template <>
void populateFactoryTable<ClHwHelperHw<Family>>() {
extern ClHwHelper *clHwHelperFactory[IGFX_MAX_CORE];
clHwHelperFactory[gfxCore] = &ClHwHelperHw<Family>::get();
}
template class ClHwHelperHw<Family>;
} // namespace NEO

View File

@@ -13,6 +13,7 @@
#include "opencl/source/command_stream/tbx_command_stream_receiver_hw.h"
#include "opencl/source/device_queue/device_queue_hw.h"
#include "opencl/source/event/perf_counter.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/source/mem_obj/buffer.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/source/sampler/sampler.h"
@@ -26,13 +27,14 @@ typedef BDWFamily Family;
struct EnableOCLGen8 {
EnableOCLGen8() {
populateFactoryTable<AUBCommandStreamReceiverHw<Family>>();
populateFactoryTable<TbxCommandStreamReceiverHw<Family>>();
populateFactoryTable<CommandQueueHw<Family>>();
populateFactoryTable<DeviceQueueHw<Family>>();
populateFactoryTable<CommandStreamReceiverHw<Family>>();
populateFactoryTable<BufferHw<Family>>();
populateFactoryTable<ClHwHelperHw<Family>>();
populateFactoryTable<CommandQueueHw<Family>>();
populateFactoryTable<CommandStreamReceiverHw<Family>>();
populateFactoryTable<DeviceQueueHw<Family>>();
populateFactoryTable<ImageHw<Family>>();
populateFactoryTable<SamplerHw<Family>>();
populateFactoryTable<TbxCommandStreamReceiverHw<Family>>();
}
};

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/populate_factory.h"
#include "opencl/source/helpers/cl_hw_helper_base.inl"
#include "hw_cmds.h"
namespace NEO {
using Family = SKLFamily;
static auto gfxCore = IGFX_GEN9_CORE;
template <>
void populateFactoryTable<ClHwHelperHw<Family>>() {
extern ClHwHelper *clHwHelperFactory[IGFX_MAX_CORE];
clHwHelperFactory[gfxCore] = &ClHwHelperHw<Family>::get();
}
template class ClHwHelperHw<Family>;
} // namespace NEO

View File

@@ -13,6 +13,7 @@
#include "opencl/source/command_stream/tbx_command_stream_receiver_hw.h"
#include "opencl/source/device_queue/device_queue_hw.h"
#include "opencl/source/event/perf_counter.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/source/mem_obj/buffer.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/source/sampler/sampler.h"
@@ -26,13 +27,14 @@ typedef SKLFamily Family;
struct EnableOCLGen9 {
EnableOCLGen9() {
populateFactoryTable<AUBCommandStreamReceiverHw<Family>>();
populateFactoryTable<TbxCommandStreamReceiverHw<Family>>();
populateFactoryTable<CommandQueueHw<Family>>();
populateFactoryTable<DeviceQueueHw<Family>>();
populateFactoryTable<CommandStreamReceiverHw<Family>>();
populateFactoryTable<BufferHw<Family>>();
populateFactoryTable<ClHwHelperHw<Family>>();
populateFactoryTable<CommandQueueHw<Family>>();
populateFactoryTable<CommandStreamReceiverHw<Family>>();
populateFactoryTable<DeviceQueueHw<Family>>();
populateFactoryTable<ImageHw<Family>>();
populateFactoryTable<SamplerHw<Family>>();
populateFactoryTable<TbxCommandStreamReceiverHw<Family>>();
}
};

View File

@@ -13,6 +13,9 @@ set(RUNTIME_SRCS_HELPERS_BASE
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/cl_device_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cl_device_helpers.h
${CMAKE_CURRENT_SOURCE_DIR}/cl_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper_base.inl
${CMAKE_CURRENT_SOURCE_DIR}/convert_color.h
${CMAKE_CURRENT_SOURCE_DIR}/destructor_callback.h
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_info.cpp

View File

@@ -0,0 +1,18 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/helpers/cl_hw_helper.h"
namespace NEO {
ClHwHelper *clHwHelperFactory[IGFX_MAX_CORE] = {};
ClHwHelper &ClHwHelper::get(GFXCORE_FAMILY gfxCore) {
return *clHwHelperFactory[gfxCore];
}
} // namespace NEO

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "igfxfmid.h"
namespace NEO {
struct KernelInfo;
class ClHwHelper {
public:
static ClHwHelper &get(GFXCORE_FAMILY gfxCore);
virtual bool requiresAuxResolves(const KernelInfo &kernelInfo) const = 0;
protected:
virtual bool hasStatelessAccessToBuffer(const KernelInfo &kernelInfo) const = 0;
ClHwHelper() = default;
};
template <typename GfxFamily>
class ClHwHelperHw : public ClHwHelper {
public:
static ClHwHelper &get() {
static ClHwHelperHw<GfxFamily> clHwHelper;
return clHwHelper;
}
bool requiresAuxResolves(const KernelInfo &kernelInfo) const override;
protected:
bool hasStatelessAccessToBuffer(const KernelInfo &kernelInfo) const override;
ClHwHelperHw() = default;
};
} // namespace NEO

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/source/program/kernel_info.h"
namespace NEO {
template <typename GfxFamily>
inline bool ClHwHelperHw<GfxFamily>::requiresAuxResolves(const KernelInfo &kernelInfo) const {
return hasStatelessAccessToBuffer(kernelInfo);
}
template <typename GfxFamily>
inline bool ClHwHelperHw<GfxFamily>::hasStatelessAccessToBuffer(const KernelInfo &kernelInfo) const {
bool hasStatelessAccessToBuffer = false;
for (uint32_t i = 0; i < kernelInfo.kernelArgInfo.size(); ++i) {
if (kernelInfo.kernelArgInfo[i].isBuffer) {
hasStatelessAccessToBuffer |= !kernelInfo.kernelArgInfo[i].pureStatefulBufferAccess;
}
}
return hasStatelessAccessToBuffer;
}
} // namespace NEO

View File

@@ -32,6 +32,7 @@
#include "opencl/source/device_queue/device_queue.h"
#include "opencl/source/execution_model/device_enqueue.h"
#include "opencl/source/gtpin/gtpin_notify.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/source/helpers/dispatch_info.h"
#include "opencl/source/helpers/get_info_status_mapper.h"
#include "opencl/source/helpers/per_thread_data.h"
@@ -378,7 +379,8 @@ cl_int Kernel::initialize() {
}
}
auxTranslationRequired = HwHelper::renderCompressedBuffersSupported(hwInfo) && hwHelper.requiresAuxResolves(kernelInfo);
auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
auxTranslationRequired = HwHelper::renderCompressedBuffersSupported(hwInfo) && clHwHelper.requiresAuxResolves(kernelInfo);
if (DebugManager.flags.ForceAuxTranslationEnabled.get() != -1) {
auxTranslationRequired &= !!DebugManager.flags.ForceAuxTranslationEnabled.get();
}