File: get_devices.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 (73 lines) | stat: -rw-r--r-- 2,975 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
/*
 * Copyright (C) 2019-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/source/command_stream/create_command_stream_impl.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/product_helper.h"

#include "hw_cmds_default.h"

namespace NEO {

bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment, std::string &osPciPath, const uint32_t rootDeviceIndex) {
    bool returnValue = false;
    if (osPciPath.empty()) {
        returnValue = prepareDeviceEnvironmentsImpl(executionEnvironment);
    } else {
        returnValue = prepareDeviceEnvironmentImpl(executionEnvironment, osPciPath, rootDeviceIndex);
    }

    if (debugManager.flags.Force32BitDriverSupport.get() != -1) {
        return returnValue;
    }

    if (returnValue) {
        if (!DeviceFactory::validateDeviceFlags(executionEnvironment.rootDeviceEnvironments[0]->getProductHelper())) {
            return false;
        }
        auto i = 0u;
        while (i < executionEnvironment.rootDeviceEnvironments.size()) {
            executionEnvironment.rootDeviceEnvironments[i]->initGmm();
            bool unsupportedDeviceDetected = false;

            auto &featureTable = executionEnvironment.rootDeviceEnvironments[i]->getHardwareInfo()->featureTable;
            if (!featureTable.flags.ftrRcsNode && !featureTable.flags.ftrCCSNode) {
                unsupportedDeviceDetected = true;
            }

            if (unsupportedDeviceDetected) {
                executionEnvironment.rootDeviceEnvironments.erase(executionEnvironment.rootDeviceEnvironments.begin() + i);
            } else {
                if (!executionEnvironment.rootDeviceEnvironments[i]->getProductHelper().isExposingSubdevicesAllowed()) {
                    executionEnvironment.rootDeviceEnvironments[i]->setExposeSingleDeviceMode(true);
                }
                if (debugManager.flags.ExposeSingleDevice.get() != -1) {
                    executionEnvironment.rootDeviceEnvironments[i]->setExposeSingleDeviceMode(!!debugManager.flags.ExposeSingleDevice.get());
                }
                i++;
            }
        }
    }

    return returnValue && executionEnvironment.rootDeviceEnvironments.size() > 0;
}

bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment) {
    std::string path = "";
    return prepareDeviceEnvironments(executionEnvironment, path, 0u);
}

bool prepareDeviceEnvironment(ExecutionEnvironment &executionEnvironment, std::string &osPciPath, const uint32_t rootDeviceIndex) {
    return prepareDeviceEnvironments(executionEnvironment, osPciPath, rootDeviceIndex);
}
const HardwareInfo *getDefaultHwInfo() {
    return &DEFAULT_PLATFORM::hwInfo;
}
} // namespace NEO