mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Move SLM functions to HwHelper class
Related-To: NEO-4585 Change-Id: I073e4138ef34584780a10a63ba8a2eb57eaa11bd Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
f40216441d
commit
77de2dd770
@@ -11,31 +11,6 @@
|
||||
#include "opencl/source/helpers/hardware_commands_helper_base.inl"
|
||||
#include "opencl/source/helpers/hardware_commands_helper_bdw_plus.inl"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
static uint32_t slmSizeId[] = {0, 1, 2, 4, 4, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16};
|
||||
|
||||
template <>
|
||||
uint32_t HardwareCommandsHelper<BDWFamily>::alignSlmSize(uint32_t slmSize) {
|
||||
if (slmSize == 0u) {
|
||||
return 0u;
|
||||
}
|
||||
slmSize = std::max(slmSize, 4096u);
|
||||
slmSize = Math::nextPowerOfTwo(slmSize);
|
||||
return slmSize;
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t HardwareCommandsHelper<BDWFamily>::computeSlmValues(uint32_t slmSize) {
|
||||
slmSize += (4 * KB - 1);
|
||||
slmSize = slmSize >> 12;
|
||||
slmSize = std::min(slmSize, 15u);
|
||||
slmSize = slmSizeId[slmSize];
|
||||
return slmSize;
|
||||
}
|
||||
|
||||
// Explicitly instantiate HardwareCommandsHelper for BDW device family
|
||||
template struct HardwareCommandsHelper<BDWFamily>;
|
||||
} // namespace NEO
|
||||
|
||||
@@ -34,9 +34,6 @@ struct HardwareCommandsHelper : public PerThreadDataHelper {
|
||||
using MI_ATOMIC = typename GfxFamily::MI_ATOMIC;
|
||||
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
|
||||
|
||||
static uint32_t alignSlmSize(uint32_t slmSize);
|
||||
static uint32_t computeSlmValues(uint32_t slmSize);
|
||||
|
||||
static INTERFACE_DESCRIPTOR_DATA *getInterfaceDescriptor(
|
||||
const IndirectHeap &indirectHeap,
|
||||
uint64_t offsetInterfaceDescriptor,
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/source/helpers/address_patch.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
@@ -33,27 +34,6 @@ bool HardwareCommandsHelper<GfxFamily>::isPipeControlPriorToPipelineSelectWArequ
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t HardwareCommandsHelper<GfxFamily>::alignSlmSize(uint32_t slmSize) {
|
||||
if (slmSize == 0u) {
|
||||
return 0u;
|
||||
}
|
||||
slmSize = std::max(slmSize, 1024u);
|
||||
slmSize = Math::nextPowerOfTwo(slmSize);
|
||||
UNRECOVERABLE_IF(slmSize > 64u * KB);
|
||||
return slmSize;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t HardwareCommandsHelper<GfxFamily>::computeSlmValues(uint32_t slmSize) {
|
||||
auto value = std::max(slmSize, 1024u);
|
||||
value = Math::nextPowerOfTwo(value);
|
||||
value = Math::getMinLsbSet(value);
|
||||
value = value - 9;
|
||||
DEBUG_BREAK_IF(value > 7);
|
||||
return value * !!slmSize;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t HardwareCommandsHelper<GfxFamily>::getSizeRequiredDSH(
|
||||
const Kernel &kernel) {
|
||||
@@ -207,7 +187,8 @@ size_t HardwareCommandsHelper<GfxFamily>::sendInterfaceDescriptorData(
|
||||
|
||||
interfaceDescriptor.setBindingTableEntryCount(bindingTablePrefetchSize);
|
||||
|
||||
auto programmableIDSLMSize = static_cast<typename INTERFACE_DESCRIPTOR_DATA::SHARED_LOCAL_MEMORY_SIZE>(computeSlmValues(kernel.slmTotalSize));
|
||||
auto programmableIDSLMSize =
|
||||
static_cast<typename INTERFACE_DESCRIPTOR_DATA::SHARED_LOCAL_MEMORY_SIZE>(HwHelperHw<GfxFamily>::get().computeSlmValues(kernel.slmTotalSize));
|
||||
|
||||
interfaceDescriptor.setSharedLocalMemorySize(programmableIDSLMSize);
|
||||
programBarrierEnable(&interfaceDescriptor, kernel.getKernelInfo().patchInfo.executionEnvironment->HasBarriers,
|
||||
|
||||
Reference in New Issue
Block a user