File: gmm_interface_win.cpp

package info (click to toggle)
intel-compute-runtime 22.43.24595.41-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 57,740 kB
  • sloc: cpp: 631,142; lisp: 3,515; sh: 470; makefile: 76; python: 21
file content (36 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download | duplicates (2)
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
/*
 * Copyright (C) 2020 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/source/gmm_helper/gmm_interface.h"
#include "shared/source/helpers/debug_helpers.h"
#include "shared/source/os_interface/os_library.h"

#include <memory>

namespace NEO {

static std::unique_ptr<OsLibrary> gmmLib;

namespace GmmInterface {

GMM_STATUS initialize(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs) {
    if (!gmmLib) {
        gmmLib.reset(OsLibrary::load(GMM_UMD_DLL));
        UNRECOVERABLE_IF(!gmmLib);
    }
    auto initGmmFunc = reinterpret_cast<decltype(&InitializeGmm)>(gmmLib->getProcAddress(GMM_ADAPTER_INIT_NAME));
    UNRECOVERABLE_IF(!initGmmFunc);
    return initGmmFunc(pInArgs, pOutArgs);
}

void destroy(GMM_INIT_OUT_ARGS *pInArgs) {
    auto destroyGmmFunc = reinterpret_cast<decltype(&GmmAdapterDestroy)>(gmmLib->getProcAddress(GMM_ADAPTER_DESTROY_NAME));
    UNRECOVERABLE_IF(!destroyGmmFunc);
    destroyGmmFunc(pInArgs);
}
} // namespace GmmInterface
} // namespace NEO