2018-08-20 21:54:20 +08:00
|
|
|
/*
|
2023-02-02 00:23:01 +08:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2018-08-20 21:54:20 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-08-20 21:54:20 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-10-16 18:10:52 +08:00
|
|
|
#include "shared/source/aub/aub_helper.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2021-12-07 19:22:25 +08:00
|
|
|
#include "shared/source/aub_mem_dump/aub_mem_dump.h"
|
2021-07-05 22:52:03 +08:00
|
|
|
#include "shared/source/aub_mem_dump/page_table_entry_bits.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
|
|
|
#include "shared/source/helpers/basic_math.h"
|
2021-07-05 22:52:03 +08:00
|
|
|
#include "shared/source/helpers/constants.h"
|
2023-02-02 00:23:01 +08:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2021-07-05 22:52:03 +08:00
|
|
|
#include "shared/source/tbx/tbx_proto.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2022-11-23 17:14:27 +08:00
|
|
|
#include "aubstream/aubstream.h"
|
2020-08-22 20:12:46 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-09-11 16:26:39 +08:00
|
|
|
|
2019-02-12 20:37:39 +08:00
|
|
|
uint64_t AubHelper::getTotalMemBankSize() {
|
2021-07-05 22:52:03 +08:00
|
|
|
return 32ull * MemoryConstants::gigaByte;
|
2019-02-12 20:37:39 +08:00
|
|
|
}
|
|
|
|
|
2018-08-20 21:54:20 +08:00
|
|
|
int AubHelper::getMemTrace(uint64_t pdEntryBits) {
|
2021-07-05 22:52:03 +08:00
|
|
|
if (pdEntryBits & BIT(PageTableEntry::localMemoryBit)) {
|
|
|
|
return AubMemDump::AddressSpaceValues::TraceLocal;
|
|
|
|
}
|
2018-08-20 21:54:20 +08:00
|
|
|
return AubMemDump::AddressSpaceValues::TraceNonlocal;
|
|
|
|
}
|
2018-09-11 16:26:39 +08:00
|
|
|
|
|
|
|
uint64_t AubHelper::getPTEntryBits(uint64_t pdEntryBits) {
|
2021-07-05 22:52:03 +08:00
|
|
|
pdEntryBits &= ~BIT(PageTableEntry::localMemoryBit);
|
2018-09-11 16:26:39 +08:00
|
|
|
return pdEntryBits;
|
|
|
|
}
|
2018-10-15 19:01:45 +08:00
|
|
|
|
2018-11-10 15:00:58 +08:00
|
|
|
uint32_t AubHelper::getMemType(uint32_t addressSpace) {
|
2021-07-05 22:52:03 +08:00
|
|
|
if (addressSpace == AubMemDump::AddressSpaceValues::TraceLocal) {
|
|
|
|
return mem_types::MEM_TYPE_LOCALMEM;
|
|
|
|
}
|
|
|
|
return mem_types::MEM_TYPE_SYSTEM;
|
2018-11-10 15:00:58 +08:00
|
|
|
}
|
|
|
|
|
2021-12-06 19:38:24 +08:00
|
|
|
uint64_t AubHelper::getPerTileLocalMemorySize(const HardwareInfo *pHwInfo) {
|
2021-07-05 22:52:03 +08:00
|
|
|
if (DebugManager.flags.HBMSizePerTileInGigabytes.get() > 0) {
|
|
|
|
return DebugManager.flags.HBMSizePerTileInGigabytes.get() * MemoryConstants::gigaByte;
|
|
|
|
}
|
2022-12-08 20:22:35 +08:00
|
|
|
return getTotalMemBankSize() / GfxCoreHelper::getSubDevicesCount(pHwInfo);
|
2020-08-22 20:12:46 +08:00
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|