File: system_info.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 (91 lines) | stat: -rw-r--r-- 3,175 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
88
89
90
91
/*
 * Copyright (C) 2021-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/source/os_interface/linux/system_info.h"

#include "shared/source/helpers/debug_helpers.h"

namespace NEO {

SystemInfo::SystemInfo(const std::vector<uint32_t> &inputData) {
    this->parseDeviceBlob(inputData);
}

void SystemInfo::parseDeviceBlob(const std::vector<uint32_t> &inputData) {
    auto data = inputData.data();
    auto dataSize = inputData.size();
    uint32_t i = 0;
    while (i + 2 < dataSize) {
        DEBUG_BREAK_IF(data[i + 1] < 1);

        /* Attribute IDs range */
        DEBUG_BREAK_IF(data[i] < 1);

        if (DeviceBlobConstants::maxSlicesSupported == data[i]) {
            maxSlicesSupported = data[i + 2];
        }
        if (DeviceBlobConstants::maxDualSubSlicesSupported == data[i]) {
            maxDualSubSlicesSupported = std::max(data[i + 2], maxDualSubSlicesSupported);
        }
        if (DeviceBlobConstants::maxEuPerDualSubSlice == data[i]) {
            maxEuPerDualSubSlice = std::max(data[i + 2], maxEuPerDualSubSlice);
        }
        if (DeviceBlobConstants::maxMemoryChannels == data[i]) {
            maxMemoryChannels = data[i + 2];
        }
        if (DeviceBlobConstants::memoryType == data[i]) {
            memoryType = data[i + 2];
        }
        if (DeviceBlobConstants::numThreadsPerEu == data[i]) {
            numThreadsPerEu = data[i + 2];
        }
        if (DeviceBlobConstants::maxRcs == data[i]) {
            maxRCS = data[i + 2];
        }
        if (DeviceBlobConstants::maxCcs == data[i]) {
            maxCCS = data[i + 2];
        }
        if (DeviceBlobConstants::l3BankSizeInKb == data[i]) {
            l3BankSizeInKb = data[i + 2];
        }
        if (DeviceBlobConstants::maxSubSlicesSupported == data[i]) {
            maxDualSubSlicesSupported = std::max(data[i + 2], maxDualSubSlicesSupported);
        }
        if (DeviceBlobConstants::maxEuPerSubSlice == data[i]) {
            maxEuPerDualSubSlice = std::max(data[i + 2], maxEuPerDualSubSlice);
        }
        if (DeviceBlobConstants::csrSizeInMb == data[i]) {
            csrSizeInMb = data[i + 2];
        }
        if (DeviceBlobConstants::slmSizePerDss == data[i]) {
            slmSizePerDss = std::max(data[i + 2], slmSizePerDss);
        }
        if (DeviceBlobConstants::slmSizePerSs == data[i]) {
            slmSizePerDss = std::max(data[i + 2], slmSizePerDss);
        }
        if (DeviceBlobConstants::numHbmStacksPerTile == data[i]) {
            numHbmStacksPerTile = data[i + 2];
        }
        if (DeviceBlobConstants::numChannelsPerHbmStack == data[i]) {
            numChannelsPerHbmStack = data[i + 2];
        }
        if (DeviceBlobConstants::numRegions == data[i]) {
            numRegions = data[i + 2];
        }
        if (DeviceBlobConstants::numL3BanksPerGroup == data[i]) {
            numL3BanksPerGroup = data[i + 2];
        }
        if (DeviceBlobConstants::numL3BankGroups == data[i]) {
            numL3BankGroups = data[i + 2];
        }
        /* Skip to next attribute */
        auto blobLength = 2 + data[i + 1];
        i += blobLength;
    }
}

} // namespace NEO