File: aub_helper.cpp

package info (click to toggle)
intel-compute-runtime 25.44.36015.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 79,632 kB
  • sloc: cpp: 931,547; lisp: 2,074; sh: 719; makefile: 162; python: 21
file content (87 lines) | stat: -rw-r--r-- 3,312 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * Copyright (C) 2018-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/source/aub/aub_helper.h"

#include "shared/source/aub_mem_dump/page_table_entry_bits.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/basic_math.h"
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/string.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/tbx/tbx_proto.h"

#include "aubstream/aubstream.h"

namespace NEO {

bool AubHelper::isOneTimeAubWritableAllocationType(const AllocationType &type) {
    switch (type) {
    case AllocationType::constantSurface:
    case AllocationType::globalSurface:
    case AllocationType::kernelIsa:
    case AllocationType::kernelIsaInternal:
    case AllocationType::privateSurface:
    case AllocationType::scratchSurface:
    case AllocationType::workPartitionSurface:
    case AllocationType::buffer:
    case AllocationType::image:
    case AllocationType::timestampPacketTagBuffer:
    case AllocationType::externalHostPtr:
    case AllocationType::mapAllocation:
    case AllocationType::svmGpu:
    case AllocationType::gpuTimestampDeviceBuffer:
    case AllocationType::assertBuffer:
    case AllocationType::tagBuffer:
    case AllocationType::syncDispatchToken:
    case AllocationType::hostFunction:
        return true;
    case AllocationType::bufferHostMemory:
        return NEO::debugManager.isTbxPageFaultManagerEnabled() ||
               (NEO::debugManager.flags.SetBufferHostMemoryAlwaysAubWritable.get() == false);
    default:
        return false;
    }
}

uint64_t AubHelper::getTotalMemBankSize(const ReleaseHelper *releaseHelper) {
    if (releaseHelper) {
        return releaseHelper->getTotalMemBankSize();
    }
    return 32ull * MemoryConstants::gigaByte;
}

uint64_t AubHelper::getPTEntryBits(uint64_t pdEntryBits) {
    pdEntryBits &= ~makeBitMask<PageTableEntry::localMemoryBit>();
    return pdEntryBits;
}

uint64_t AubHelper::getPerTileLocalMemorySize(const HardwareInfo *pHwInfo, const ReleaseHelper *releaseHelper) {
    if (debugManager.flags.HBMSizePerTileInGigabytes.get() > 0) {
        return debugManager.flags.HBMSizePerTileInGigabytes.get() * MemoryConstants::gigaByte;
    }
    return getTotalMemBankSize(releaseHelper) / GfxCoreHelper::getSubDevicesCount(pHwInfo);
}

const std::string AubHelper::getDeviceConfigString(const ReleaseHelper *releaseHelper, uint32_t tileCount, uint32_t sliceCount, uint32_t subSliceCount, uint32_t euPerSubSliceCount) {
    if (releaseHelper) {
        return releaseHelper->getDeviceConfigString(tileCount, sliceCount, subSliceCount, euPerSubSliceCount);
    }
    char configString[16] = {0};
    if (tileCount > 1) {
        auto err = snprintf_s(configString, sizeof(configString), sizeof(configString), "%utx%ux%ux%u", tileCount, sliceCount, subSliceCount, euPerSubSliceCount);
        UNRECOVERABLE_IF(err < 0);
    } else {
        auto err = snprintf_s(configString, sizeof(configString), sizeof(configString), "%ux%ux%u", sliceCount, subSliceCount, euPerSubSliceCount);
        UNRECOVERABLE_IF(err < 0);
    }
    return configString;
}

} // namespace NEO