2021-04-24 00:43:48 +08:00
|
|
|
/*
|
2022-02-04 21:59:01 +08:00
|
|
|
* Copyright (C) 2021-2022 Intel Corporation
|
2021-04-24 00:43:48 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
|
|
|
#include "shared/source/memory_manager/allocation_properties.h"
|
2021-09-08 23:07:46 +08:00
|
|
|
#include "shared/source/os_interface/hw_info_config.h"
|
2021-04-24 00:43:48 +08:00
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const {
|
2021-09-09 20:27:41 +08:00
|
|
|
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
|
|
|
|
|
|
|
if (LocalMemoryAccessMode::CpuAccessDisallowed == hwInfoConfig.getLocalMemoryAccessMode(hwInfo)) {
|
2022-02-04 21:59:01 +08:00
|
|
|
if (properties.allocationType == AllocationType::LINEAR_STREAM ||
|
|
|
|
properties.allocationType == AllocationType::INTERNAL_HEAP ||
|
|
|
|
properties.allocationType == AllocationType::PRINTF_SURFACE ||
|
2022-03-25 00:26:54 +08:00
|
|
|
properties.allocationType == AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER) {
|
2021-04-24 00:43:48 +08:00
|
|
|
allocationData.flags.useSystemMemory = true;
|
|
|
|
}
|
|
|
|
if (!allocationData.flags.useSystemMemory) {
|
|
|
|
allocationData.flags.requiresCpuAccess = false;
|
|
|
|
allocationData.storageInfo.isLockable = false;
|
|
|
|
}
|
|
|
|
}
|
2021-09-01 08:34:29 +08:00
|
|
|
|
2021-09-08 23:07:46 +08:00
|
|
|
if (hwInfoConfig.allowStatelessCompression(hwInfo)) {
|
2022-02-04 21:59:01 +08:00
|
|
|
if (properties.allocationType == AllocationType::GLOBAL_SURFACE ||
|
|
|
|
properties.allocationType == AllocationType::CONSTANT_SURFACE ||
|
|
|
|
properties.allocationType == AllocationType::PRINTF_SURFACE) {
|
2021-09-01 08:34:29 +08:00
|
|
|
allocationData.flags.requiresCpuAccess = false;
|
|
|
|
allocationData.storageInfo.isLockable = false;
|
|
|
|
}
|
|
|
|
}
|
2021-04-24 00:43:48 +08:00
|
|
|
}
|
|
|
|
} // namespace NEO
|