2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-11-29 22:41:47 +08:00
|
|
|
#include "core/gen8/hw_cmds.h"
|
2019-06-12 15:13:06 +08:00
|
|
|
#include "runtime/helpers/hardware_commands_helper.h"
|
|
|
|
#include "runtime/helpers/hardware_commands_helper.inl"
|
|
|
|
#include "runtime/helpers/hardware_commands_helper_base.inl"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include <cstdint>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
static uint32_t slmSizeId[] = {0, 1, 2, 4, 4, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16};
|
|
|
|
|
|
|
|
template <>
|
2019-11-08 01:49:46 +08:00
|
|
|
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;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2019-06-12 15:13:06 +08:00
|
|
|
// Explicitly instantiate HardwareCommandsHelper for BDW device family
|
|
|
|
template struct HardwareCommandsHelper<BDWFamily>;
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|