2021-04-24 00:43:48 +08:00
|
|
|
/*
|
2023-01-04 17:45:07 +08:00
|
|
|
* Copyright (C) 2021-2023 Intel Corporation
|
2021-04-24 00:43:48 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-01-24 01:58:31 +08:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2021-04-24 00:43:48 +08:00
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
2022-11-29 03:00:39 +08:00
|
|
|
#include "shared/source/helpers/local_memory_access_modes.h"
|
2021-04-24 00:43:48 +08:00
|
|
|
#include "shared/source/memory_manager/allocation_properties.h"
|
2023-01-04 17:45:07 +08:00
|
|
|
#include "shared/source/memory_manager/compression_selector.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 <>
|
2023-01-24 01:58:31 +08:00
|
|
|
void GfxCoreHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
|
|
|
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
|
|
|
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
2021-09-09 20:27:41 +08:00
|
|
|
|
2022-12-13 00:43:41 +08:00
|
|
|
if (LocalMemoryAccessMode::CpuAccessDisallowed == productHelper.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-30 19:18:39 +08:00
|
|
|
properties.allocationType == AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER ||
|
|
|
|
properties.allocationType == AllocationType::RING_BUFFER ||
|
|
|
|
properties.allocationType == AllocationType::SEMAPHORE_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;
|
|
|
|
}
|
2022-06-24 20:33:41 +08:00
|
|
|
} else if (hwInfo.featureTable.flags.ftrLocalMemory &&
|
2022-07-12 18:19:15 +08:00
|
|
|
(properties.allocationType == AllocationType::COMMAND_BUFFER ||
|
|
|
|
properties.allocationType == AllocationType::RING_BUFFER ||
|
|
|
|
properties.allocationType == AllocationType::SEMAPHORE_BUFFER)) {
|
2022-06-24 20:33:41 +08:00
|
|
|
allocationData.flags.useSystemMemory = false;
|
|
|
|
allocationData.flags.requiresCpuAccess = true;
|
2021-04-24 00:43:48 +08:00
|
|
|
}
|
2021-09-01 08:34:29 +08:00
|
|
|
|
2023-01-04 17:45:07 +08:00
|
|
|
if (CompressionSelector::allowStatelessCompression()) {
|
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;
|
|
|
|
}
|
|
|
|
}
|
2022-06-13 22:13:34 +08:00
|
|
|
|
2022-12-29 07:30:03 +08:00
|
|
|
if (productHelper.isStorageInfoAdjustmentRequired()) {
|
2022-06-13 22:13:34 +08:00
|
|
|
if (properties.allocationType == AllocationType::BUFFER && !properties.flags.preferCompressed && !properties.flags.shareable) {
|
|
|
|
allocationData.storageInfo.isLockable = true;
|
|
|
|
}
|
|
|
|
}
|
2021-04-24 00:43:48 +08:00
|
|
|
}
|
|
|
|
} // namespace NEO
|